简体   繁体   English

从命令行编译CUDA代码

[英]Compiling CUDA code from the command line

I am trying to compile CUDA code from the command line, using the syntax: 我正在尝试使用以下语法从命令行编译CUDA代码:

nvcc -c MyFile.cu -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin"

I have CUDA Toolkit version 5.5 installed as well as Visual C++ 2010 Express. 我安装了CUDA Toolkit 5.5版以及Visual C ++ 2010 Express。 I do not have a full version of Visual Studio. 我没有完整版的Visual Studio。

I am receiving the following error message: 我收到以下错误消息:

nvcc : fatal error : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions 2008, 2010, and 2012 are supported

I have seen precedent of people getting VC2010 Express compiling with CUDA Toolkit 5.0, eg, in this thread 我已经看到了使VC2010 Express与CUDA Toolkit 5.0一起编译的先例,例如在此线程中

https://devtalk.nvidia.com/default/topic/535527/?comment=3762165 https://devtalk.nvidia.com/default/topic/535527/?comment=3762165

Therefore, I cannot understand what critical difference there would be, just because it's CUDA 5.5 and not 5.0. 因此,我无法理解会有什么关键差异,仅因为它是CUDA 5.5而不是5.0。 Would it make a difference that it's VC Express and not VC Professional? 是VC Express而不是VC Professional是否会有所作为? Why would that matter where compiling is concerned? 为什么在编译方面如此重要? Do Pro and Express really use very different compilers? Pro和Express是否真的使用完全不同的编译器?

I can't post comments yet and I don't know if this is a correct answer since I don't have 2010 express. 我还不能发表评论,我不知道这是否是正确答案,因为我没有2010 Express。 So in the interest of helping I'll try with an answer. 因此,为了帮助我,我将尝试给出答案。

I can supply you with the start of my compile line, which is slightly different from yours: 我可以为您提供我的编译行的开始,它与您的稍有不同:

set CUDAFE_FLAGS=--sdk_dir "C:\Program Files (x86)\Windows Kits\8.0\"
"C:\_work\API\CUDA\bin\nvcc.exe" --use-local-env --cl-version 2012 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64"        --keep-dir x64\Prod -maxrregcount=0  --machine 64 

From this I expect you to change the path to yours, and the cl-version as well to 因此,我希望您将路径更改为您的路径,并将cl版本也更改为

"C:\_work\API\CUDA\bin\nvcc.exe" --use-local-env --cl-version 2010 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe" --machine 32

Please note I have tried to change it to 32-bit as well. 请注意,我也尝试将其更改为32位。 I assume this is what you are running. 我认为这就是您正在运行的。

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM