Visual Studio 2010 (Windows 7) 中的 Hello World C++ CUDA 程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4171154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Hello World C++ CUDA Program in Visual Studio 2010 (Windows 7)
提问by Athena
I am trying to compile this Hello World programin Windows 7 with Visual Studio 2010 installed, but I get the following error message when I run nvcc hellocuda.cu
:
我试图在安装了 Visual Studio 2010 的 Windows 7 中编译这个Hello World 程序,但是当我运行时收到以下错误消息nvcc hellocuda.cu
:
nvcc fatal : nvcc cannot find a supported cl version. Only MSVC 8.0 and MSVC 9.0 are supported
How can I compile this CUDA program ?
我怎样才能编译这个 CUDA 程序?
采纳答案by Athena
Visual Studio 2008 Expresswas needed. (Thanks sgolodetz)
需要 Visual Studio 2008 Express。(感谢斯戈洛德茨)
So with Visual Studio 2010 Professional (maybe 2010 Express works too?), NVIDIA Parallel Nsight, CUDA Toolkit, Developer Drivers, and GPU Computing SDK code samples (toolkit, drivers, and sdk can be downloaded here) I was able to run the example Hello World in CUDAprogram.
因此,使用 Visual Studio 2010 Professional(也许 2010 Express 也适用?)、NVIDIA Parallel Nsight、CUDA Toolkit、Developer Drivers 和 GPU Computing SDK 代码示例(工具包、驱动程序和 sdk 可在此处下载)我能够运行该示例CUDA程序中的Hello World。
How to create/upgrade a CUDA project in VS2008 and VS2010 to work with Nsight 1.5 and CUDA 3.2was veryhelpful in starting a new VS 2010 CUDA project with the proper settings.
如何创建/在VS2008和VS2010一个CUDA项目升级到与Nsight 1.5和CUDA 3.2的工作是非常的开始是正确的设置一个新的VS 2010的CUDA项目很有帮助。
Side note: I was never able to get the command line nvcc
to work correctly, but I rather use VS 2010 IDE instead.
旁注:我永远无法让命令行nvcc
正常工作,但我宁愿使用 VS 2010 IDE。
Update: How do I start a new CUDA app in visual studio 2008?'s answer was also useful
更新:如何在 Visual Studio 2008 中启动新的 CUDA 应用程序?的回答也很有用
回答by swatkat
NVCC checks VC++ compiler version from Visual Studio environment variables. NVCC says it supports only MSVC 8.0 and 9.0 compilers. In your case, you have MSVC 10.0 compiler. There seems to be a workaround to this issue, check out post #7 in this thread:
http://forums.nvidia.com/index.php?showtopic=179531and also
http://forums.nvidia.com/index.php?showtopic=88585
NVCC 从 Visual Studio 环境变量检查 VC++ 编译器版本。NVCC 表示它仅支持 MSVC 8.0 和 9.0 编译器。在您的情况下,您有 MSVC 10.0 编译器。这个问题似乎有一个解决方法,请查看此线程中的第 7 篇文章:
http: //forums.nvidia.com/index.php?showtopic=179531和
http://forums.nvidia.com/index。 php?showtopic=88585
回答by Stuart Golodetz
If you keep having problems getting it working with MSVC10, bear in mind that you can download the Express version of MSVC9 (i.e. the 2008 version) for free -- so you can always download it and compile with that instead. But I would try swatkat's workaround first :)
如果您在使用 MSVC10 时遇到问题,请记住,您可以免费下载 MSVC9 的 Express 版本(即 2008 版本)——因此您可以随时下载并使用它进行编译。但我会先尝试 swatkat 的解决方法:)
Here's the link:
这是链接:
回答by Tom
With CUDA 4.0 you can use the VC10 toolchain. See this answerfor a step-by-step.
在 CUDA 4.0 中,您可以使用 VC10 工具链。有关分步说明,请参阅此答案。