https://devblogs.nvidia.com/separate-compilation-linking-cuda-device-code/
1. 编译:
objects = main.o particle.o v3.o all: $(objects) nvcc -arch=sm_20 $(objects) -o app %.o: %.cpp nvcc -x cu -arch=sm_20 -I. -dc $< -o $@ clean: rm -f *.o app
2 链接
nvcc –arch=sm_20 –dlink v3.o particle.o main.o –o gpuCode.o
g++ gpuCode.o main.o particle.o v3.o –lcudart –o app
原文:https://www.cnblogs.com/luoyinjie/p/12305335.html