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 编程指南
这篇关于编译包含动态并行性的代码失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:编译包含动态并行性的代码失败


- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 近似搜索的工作原理 2021-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 从python回调到c++的选项 2022-11-16
- C++ 协变模板 2021-01-01
- 静态初始化顺序失败 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01