I have just finished porting a C library to CUDA and I’m trying to link my programs against the CUDA version.
My code is in the following layout: several “.cu” files contain kernels and the C “wrappers” that call the kernels.
The idea is to simply be able to swap out the existing C library with the CUDA one, without the existing programs (written in C) being any wiser about which library is actually doing the computations.
I created the shared library as follows (after already compiling each “.cu” file with nvcc -c):
nvcc -deviceemu -I../include --shared --compiler-options '-fPIC' *.o -o cudalib.so
But when I try to link any of my programs I get errors saying that there are undefined references to the functions it is trying to call.
I know that these functions are there, because they are right next to their respective kernels in the “.cu” files!
Any help would be much appreciated.