I am creating a pipeline from 2 modules, one module holds the __raygen and _miss programs while the other holds the __closesthit and __intersection programs. However, if I use sqrt() in the 2nd module, I get the following run time error:
COMPILE ERROR:
Info: Pipeline has 2 module(s), 4 entry function(s), 6 trace call(s), 0 continuation callable call(s), 0 direct callable call(s), 318 basic block(s) in entry functions, 5677 instruction(s) in entry functions, 136 non-entry function(s), 708 basic block(s) in non-entry functions, 11170 instruction(s) in non-entry functions
Error: Symbol '_ZSt4sqrtf' was defined multiple times. First seen in: '__raygen__blort_and_1_more_ID1'
The only #includes in that 2nd module are < cuda_runtime.h > and < optix.h >.
If I change that sqrt() call to sqrtf(), then the error no longer occurs, and everything runs fine. I will also mention that when I include additional files like <thrust/complex.h> in the 2nd module, even more pipeline link errors appear, despite the fact that my code does not even instantiate a complex value:
COMPILE ERROR:
Info: Pipeline has 2 module(s), 4 entry function(s), 6 trace call(s), 0 continuation callable call(s), 0 direct callable call(s), 318 basic block(s) in entry functions, 5677 instruction(s) in entry functions, 138 non-entry function(s), 710 basic block(s) in non-entry functions, 11172 instruction(s) in non-entry functions
Error: Symbol '_ZN6thrust6system6detail10sequential3tagC1Ev' was defined multiple times. First seen in: '__intersection__sphere_and_1_more_ID2'
Error: Symbol '_ZN6thrust6system6detail10sequential3tagC2Ev' was defined multiple times. First seen in: '__intersection__sphere_and_1_more_ID2'
Error: Symbol '_ZSt4sqrtf' was defined multiple times. First seen in: '__intersection__sphere_and_1_more_ID2'
Is this a limitation of the pipeline linker? Is the linker not really intended to link amongst multiple modules even though its interface appears to support that? Or are there certain files, eg cuda_runtime.h which should not be included in Optix programs? Thanks.
System Details
CENTOS 7 – 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Cuda 10.2
Optix 7.4
NVIDIA GeForce RTX 2080 Ti
GPU memory: 11264 MiB
Driver: 510.54
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)