编译包含动态并行的代码失败 [英] Compiling code containing dynamic parallelism fails

查看:182
本文介绍了编译包含动态并行的代码失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


错误:调用__global__函数(kernel_6 )从__global__函数(kernel_5)只允许在compute_35体系结构或以上


p>

解决方案

您可以这样做

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



如果您有两个文件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编程指南


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?

解决方案

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

这篇关于编译包含动态并行的代码失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆