【发布时间】:2015-03-07 06:10:34
【问题描述】:
我换用了 cc 5.2 的新 GPU GeForce GTX 980,因此它必须支持动态并行。但是,我什至无法编译一个简单的代码(来自编程指南)。这里就不提供了(没必要,只是有一个全局内核调用另一个全局内核)。
1) 我使用 VS2013 进行编码。在property pages -> CUDA C/C++ -> device 中,我将code generation 属性更改为compute_35,sm_35,这是输出:
1>------ Build started: Project: testCublas3, Configuration: Debug Win32 ------
1> Compiling CUDA source file kernel.cu...
1>
1> C:\programs\misha\cuda\Projects\test projects\testCublas3\testCublas3>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" -G --keep-dir Debug -maxrregcount=0 --machine 32 --compile -cudart static -g -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd " -o Debug\kernel.cu.obj "C:\programs\misha\cuda\Projects\test projects\testCublas3\testCublas3\kernel.cu"
1>C:/programs/misha/cuda/Projects/test projects/testCublas3/testCublas3/kernel.cu(13): error : kernel launch from __device__ or __global__ functions requires separate compilation mode
1> kernel.cu
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 6.5.targets(593,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include" -G --keep-dir Debug -maxrregcount=0 --machine 32 --compile -cudart static -g -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Od /Zi /RTC1 /MDd " -o Debug\kernel.cu.obj "C:\programs\misha\cuda\Projects\test projects\testCublas3\testCublas3\kernel.cu"" exited with code 2.
我想,我需要另一个选项来进行此编译:-rdc=true,但我没有找到可以在 VS2013 中设置它的位置。
2) 当我将code generationproperty 设置为compute_52,sm_52 时,出现错误:Unsupported gpu architecture 'compute_52'。但是我的cc是5.2。所以我可以编译最大 3.5 cc 的代码?
谢谢
【问题讨论】:
-
关于不受支持的体系结构消息,有一个为 CUDA 6.5 提供的更新以支持 cc5.2。它是here。如果您安装它,该特定错误应该会消失。
-
谢谢,已经下载。第一个问题怎么样?我必须以某种方式包含选项 -rdc=true 是真的吗?
-
是的,您必须启用单独的编译和链接,并且您还需要包含一些额外的库。也许您应该查看 cuda 示例中的 VS 项目文件之一,例如 the device cublas sample。