Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling code containing dynamic parallelism fails

I am doing dynamic parallelism programming using CUDA 5.5 and an NVDIA GeForce GTX 780 whose compute capability is 3.5. I am calling a kernel function inside a kernel function but it is giving me an error:

error : calling a __global__ function("kernel_6") from a __global__ function("kernel_5") is only allowed on the compute_35 architecture or above

What am I doing wrong?

like image 349
user2865500 Avatar asked Oct 10 '13 05:10

user2865500


3 Answers

You can do something like this

nvcc -arch=sm_35 -rdc=true simple1.cu -o simple1 -lcudadevrt

or

If you have 2 files simple1.cu and test.c then you can do something as below. This is called seperate compilation.

nvcc -arch=sm_35 -dc simple1.cu 
nvcc -arch=sm_35 -dlink simple1.o -o link.o -lcudadevrt
g++ -c test.c 
g++ link.o simple1.o test.o -o simple -L/usr/local/cuda/lib64/ -lcudart

The same is explained in the cuda programming guide

like image 82
Sagar Masuti Avatar answered Nov 19 '22 03:11

Sagar Masuti


From Visual Studio 2010:

1) View -> Property Pages
2) Configuration Properties -> CUDA C/C++ -> Common -> Generate Relocatable Device Code -> Yes (-rdc=true)
3) Configuration Properties -> CUDA C/C++ -> Device -> Code Generation -> compute_35,sm_35
4) Configuration Properties -> Linker -> Input -> Additional Dependencies -> cudadevrt.lib
like image 7
Vitality Avatar answered Nov 19 '22 03:11

Vitality


You need to let nvcc generate CC 3.5 code for your device. This can be done by adding this option to nvcc command line.

 -gencode arch=compute_35,code=sm_35

You may find the CUDA samples on dynamic parallelism for more detail. They contain both command line options and project settings for all supported OS.

http://docs.nvidia.com/cuda/cuda-samples/index.html#simple-quicksort--cuda-dynamic-parallelism-

like image 4
kangshiyin Avatar answered Nov 19 '22 03:11

kangshiyin