gpt4 book ai didi

c++ - 编译包含动态并行性的代码失败

转载 作者:可可西里 更新时间:2023-11-01 18:07:55 25 4
gpt4 key购买 nike

我正在使用 CUDA 5.5 和计算能力为 3.5 的 NVDIA GeForce GTX 780 进行动态并行编程。我在内核函数中调用内核函数,但它给了我一个错误:

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,那么您可以执行以下操作。这称为单独编译。

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 programming guide 中也有同样的解释。

关于c++ - 编译包含动态并行性的代码失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19287461/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com