KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Goal: create a shared library containing my CUDA kernels that has a CUDA-free wrapper/header. create a test executable for the shared library. Problem shared library MYLIB.so seems to compile fine. (no problem). Error in linking: ./libMYLIB.so: undefined reference to __cudaRegisterLinkedBinary_39_tmpxft_000018cf_00000000_6_MYLIB_cpp1_ii_74c599a1 simplified makefile: libMYlib.so : MYLIB.o g++ -shared -Wl,-soname,libMYLIB.so -o libMYLIB.so MYLIB.o -L/the/cuda/lib/dir -lcudart MYLIB.o : MYLIB.cu MYLIB.h nvcc -m64 -arch=sm_20 -dc -Xcompiler '-fPIC' MYLIB.cu -o MYLIB.o -L/the/cuda/lib/dir -lcudart test : test.cpp libMYlib.so g++ test.cpp -o test -L. -ldl -Wl,-rpath,. -lMYLIB -L/the/cuda/lib/dir -lcudart indeed nm libMYLIB.so shows that all CUDA api functions are "undefined symbols": U __cudaRegisterFunction U __cudaRegisterLinkedBinary_39_tmpxft_0000598c_00000000_6_CUPA_cpp1_ii_74c599a1 U cudaEventRecord U cudaFree U cudaGetDevice U cudaGetDeviceProperties U cudaGetErrorString U cudaLaunch U cudaMalloc U cudaMemcpy So CUDA somehow did not get linked to the shared library MYLIB.so What am I missing? CUDA did not even get linked to the object file somehow: nm MYLIB.o U __cudaRegisterFunction U __cudaRegisterLinkedBinary_39_tmpxft_0000598c_00000000_6_CUPA_cpp1_ii_74c599a1 U cudaEventRecord U cudaFree U cudaGetDevice U cudaGetDeviceProperties U cudaGetErrorString U cudaLaunch U cudaMalloc U cudaMemcpy (same as above)
Tags (comma-separated)
Save Edits
Cancel