从命令行编译CUDA代码 [英] Compiling CUDA code from the command line

查看:1106
本文介绍了从命令行编译CUDA代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从命令行编译CUDA代码,使用语法:

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"

我安装了CUDA Toolkit 5.5版以及Visual C ++ 2010 Express。我没有完整版的Visual Studio。

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.

我收到以下错误信息:

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

我看到人们获得VC2010 Express编译的先例使用CUDA Toolkit 5.0,例如,在此主题中

I have seen precedent of people getting VC2010 Express compiling with CUDA Toolkit 5.0, e.g., in this thread

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

因此,我不能了解什么关键的差别会有,只是因为它是CUDA 5.5而不是5.0。它会有所不同,它是VC快速,而不是VC专业?为什么会涉及编译? Do Pro和Express真的使用非常不同的编译器吗?

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?

推荐答案

我不能发表评论,我不知道这是否是一个正确的答案,因为我没有2010年快递。因此,为了帮助我尝试一个答案。

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 

从这里我希望你改变你的路径和cl版本以及

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

请注意,我已经尝试将其更改为32位。我假设这是你正在跑的。

Please note I have tried to change it to 32-bit as well. I assume this is what you are running.

干杯

这篇关于从命令行编译CUDA代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆