Cuda 4.0 与 Visual Studio 2010 cl 编译器错误
因为我在 Nvidia 论坛 中没有得到任何帮助(请参阅我的帖子位于线程底部),看来我并不是唯一一个在类似问题上挣扎的人遇到问题,我就在这里尝试一下。
我尝试编译 Cuda SDK 4.0 示例并遵循非常好的 Ade Miller 的教程。但编译“.cu”文件不起作用。
这是编译器调用的(示例)命令:
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe"
-gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env
--cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC bin\x86_amd64"
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" -G0
--keep-dir "x64\Debug" -maxrregcount=0 --machine 64 --compile -D_NEXUS_DEBUG
-g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "x64\Debug\Hello.cu.obj"
"D:\Code\CUDA\Test_Cuda_4_0\Test_Cuda_4_0\Hello.cu"
这是我总是收到的奇怪错误消息。
nvcc fatal : Compiler 'cl' in PATH different than the one specified with -ccbin
编辑:更准确地说:Visual Studio 只是告诉我命令没有成功(“退出代码 -1”)->要看到此错误消息,我必须在命令行中自己调用该命令。
1) 为什么nvcc
应该关心环境变量中的路径与命令行选项指定的路径不同?如果它愿意的话,这不是会让命令行选项完全无用吗?
2)如何修复;)?
我使用Win7 64Bit,VS2010 Prof SP1,以及以下nvidia版本: cudatoolkit_4.0.17_win_64 devdriver_4.0_winvista-win7_64_270.81_general gpucomputingsdk_4.0.19_win_64
非常感谢您的帮助!
As I did not get any help in the Nvidia forums (see my post at the bottom of the thread), and it seems I am not the only one struggeling with similar problems, I will give it a try here.
I tried to compile the Cuda SDK 4.0 examples as well as following the very nice tutorial by Ade Miller. But compiling the ".cu" file won't work.
This is the (exemplary) command the compiler invokes:
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe"
-gencode=arch=compute_10,code=\"sm_10,compute_10\" --use-local-env
--cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC bin\x86_amd64"
-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include" -G0
--keep-dir "x64\Debug" -maxrregcount=0 --machine 64 --compile -D_NEXUS_DEBUG
-g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o "x64\Debug\Hello.cu.obj"
"D:\Code\CUDA\Test_Cuda_4_0\Test_Cuda_4_0\Hello.cu"
And this is the strange error message I always get.
nvcc fatal : Compiler 'cl' in PATH different than the one specified with -ccbin
EDIT: To be a bit more precise: Visual Studio just tells me the command did not succeed ("exit code -1") -> to see this error message I have to invoke the command by myself in the command line.
1) Why should nvcc
care about the path in the environment variable differing from the one specified with the command line option? If it would care, wouldn't this make the command line option completely useless?
2) How to fix ;) ?
I use Win7 64Bit, VS2010 Prof SP1, and the following nvidia versions:
cudatoolkit_4.0.17_win_64
devdriver_4.0_winvista-win7_64_270.81_general
gpucomputingsdk_4.0.19_win_64
Many thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用常规方法开始编写 CUDA 程序,如入门指南(复制示例)中给出的。要解决上述问题,您必须将其添加为环境变量。但由于 SDK 示例已经链接,因此不会出现问题。
try using the conventional method to start writing a CUDA program, as given in Getting Started guide(Copy the sample). To solve the above problem you have to add it as an environment variable. But since the SDK samples are already linked, they don't give problems.
我有类似的问题。之前我将
cl.exe
复制到C:\Program Files\NVIDIA GPUComputing Toolkit\CUDA\v5.0\bin
中,用nvcc.exe测试几个参数
并忘记从该目录中删除该文件。我删除了这个文件,一切正常。对于我的问题,PATH
的目的实际上是针对此路径:C:\Program Files\NVIDIA GPUComputing Toolkit\CUDA\v5.0\bin
并且不是<环境变量中的 code>PATH 。I had a similar problem. previously i copied
cl.exe
inC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin
for test several parameters withnvcc.exe
and forget delete this file from this directory. i removed this file and everything is OK. purpose ofPATH
for my problem in really was for this path:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin
and wasn'tPATH
in Environment variables.