gpt4 book ai didi

cuda - 使用动态并行 (CUDA) 编译 .cu 文件

转载 作者:行者123 更新时间:2023-12-04 04:31:29 44 4
gpt4 key购买 nike

我换了一个新的 GPU GeForce GTX 980 cc 5.2,所以它必须支持动态并行。但是,我什至无法编译一个简单的代码(来自编程指南)。我不会在这里提供它(没有必要,只是有一个全局内核调用另一个全局内核)。

1)我使用VS2013进行编码。在 property pages -> CUDA C/C++ -> device ,我改了code generation属性(property)到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 generation属性(property)到 compute_52,sm_52 ,出现错误: Unsupported gpu architecture 'compute_52' .但是我的cc是5.2。所以我最多可以编译 3.5 cc 的代码?

谢谢

最佳答案

关于第 1 项,cuda 动态并行性需要 separate compilation and linking ( -rdc=true ),以及设备 cudart 库的链接 ( -lcudadevrt )。也使用 CUBLAS 的动态并行也需要在设备 CUBLAS 库 ( -lcublas_device ) 中进行链接。可能最简单的方法来定义所有这些应该在 Visual Studio 项目中的位置是从查看 the device cublas sample 的 Visual Studio 项目开始。 .
关于第 2 项,您的 GTX 980 计算能力 5.2 未被识别的原因是您需要 cuda 6.5 工具包的最新更新,该工具包可用 here .
(请注意,cublas_device 功能已从最新版本的 CUDA 中删除。)

关于cuda - 使用动态并行 (CUDA) 编译 .cu 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27851809/

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