5

我在带有 CUDA 5 的 Linux 上使用计算能力为 35 的 tesla k20。通过简单的子内核调用,它会产生编译错误:Unresolved extern function cudaLaunchDevice

我的命令行如下所示:

nvcc --compile -G -O0 -g -gencode arch=compute_35 , code=sm_35 -x cu -o fill.cu fill.o

cudadevrt.a在 lib64 中看到 .. 我们需要添加它还是需要做什么来解决它?没有子内核调用一切正常。

4

2 回答 2

11

您必须在启用可重定位设备代码的情况下显式编译并链接设备运行时库才能使用动态并行性。所以你的编译命令必须包含--relocatable-device-code true并且链接命令(你没有向我们展示)应该包含-lcudadevrt.

此过程在动态并行编程指南 pdf 的“工具包支持 DYNAMIC PARALLELISM”部分中有详细描述,可在此处获得。

于 2012-12-15T08:20:25.987 回答
6

也许我有点跑题了,但我想提一下,我在 Windows/Visual Studio 2010 下遇到了同样的问题,我已经使用 talonmies 的最后一条评论在几个步骤中解决了这个问题。

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

我希望这些信息是有用的。

于 2012-12-19T12:02:17.787 回答