使用Nsight如何实现核函数的递归或者嵌套
实现cuda+ubuntu+nsight+动态并行,需要实现核函数的嵌套或者递归。
在新建工程的时候需要打开
要不然会报错。
例如:我需要这么一行代码
核函数中需要嵌套一个核函数,实现动态并行。
编译器会报错
../src/deviceGpu.cu(5): error: kernel launch from __device__ or __global__ functions requires separate compilation mode
1 error detected in the compilation of "/tmp/tmpxft_00003c34_00000000-6_deviceGpu.cpp1.ii".
make: *** [src/deviceGpu.o] Error 1
src/subdir.mk:33: recipe for target 'src/deviceGpu.o' failed
解决办法就是打开
这个选项。
在什么位置哪?
右击项目-》属性-》build-》settings-》cuda
勾选,保存,编译没得问题了。完美解决,据说需要sm>2.0因为我的GPUsm是5.2的。没有报错,2.0的太老了,似乎NVIDIA公司已经不支持了。