Option One
http://osask.cn/front/ask/view/929586
In addition to compiling, the device code required dynamic parallel relocatable link .
Your nvcc
command line specifies only a compilation operation ( -rdc=true -c
).
g++
It does not perform any device code link. Therefore, in this case, when used g++
for the final operation of the link , the link device code requires additional steps .
Something like this:
nvcc -arch=sm_35 -rdc=true -c file.cu
nvcc -arch=sm_35 -dlink -o file_link.o file.o -lcudadevrt -lcudart
g++ file.o file_link.o main.cpp -L<path> -lcudart -lcudadevrt
方案二
https://blog.csdn.net/bruce_0712/article/details/78515133
我的案例