nvcc, gcc, g ++ compiler programming mixing

 Option One

http://osask.cn/front/ask/view/929586

In addition to compiling, the device code required dynamic parallel relocatable link  .

Your nvcccommand 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


我的案例


Guess you like

Origin www.cnblogs.com/liuguoyao514257665/p/11080949.html