简体   繁体   中英

Compiling CUDA code from the command line

I am trying to compile CUDA code from the command line, using the syntax:

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. I do not have a full version of 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

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. Would it make a difference that it's VC Express and not VC Professional? Why would that matter where compiling is concerned? Do Pro and Express really use very different compilers?

I can't post comments yet and I don't know if this is a correct answer since I don't have 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

"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. I assume this is what you are running.

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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