Compiling code containing dynamic parallelism fails(编译包含动态并行性的代码失败)
问题描述
我正在使用 CUDA 5.5 和计算能力为 3.5 的 NVDIA GeForce GTX 780 进行动态并行编程.我在内核函数中调用内核函数,但它给了我一个错误:
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:
错误:从 __global__ 函数("kernel_5") 调用 __global__ 函数("kernel_6") 只允许在 compute_35 或更高架构上使用
error : calling a __global__ function("kernel_6") from a __global__ function("kernel_5") is only allowed on the compute_35 architecture or above
我做错了什么?
推荐答案
你可以这样做
nvcc -arch=sm_35 -rdc=true simple1.cu -o simple1 -lcudadevrt
或
如果您有 2 个文件 simple1.cu 和 test.c,那么您可以执行以下操作.这称为单独编译.
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
cuda 编程指南
这篇关于编译包含动态并行性的代码失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:编译包含动态并行性的代码失败
基础教程推荐
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- CString 到 char* 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
