原文:http://blog.csdn.net/asz9255/article/details/6375281
准备好cuda4.0 64位toolkit,sdk,驱动。注意在安装vs2008时,一定要选择安装64位编译器。如果已经安装了,可在进入维护界面,升级,在VC++里,勾上64编译器。
安装好toolkit,sdk后,跟CUDA3.2一样设置环境变量,我的电脑-》属性-》高级-》环境变量:在系统变量Path的值中加入,……\NVIDIA GPU Computing SDK 3.2\C\bin\win32\Debug和……\NVIDIA GPU Computing SDK 3.2\C\bin\win32\Release(SDK安装路径)。
大功告成,注销系统,打开VS2008,可以新建CUDA项目了。
编译一个例子,不出意外的话,会报错缺少cutil64。因为CUDA4.0不在包括cutil32和和cutil64,所以我们得人工编译生成。
在......SDK/C/Common中,打开vs2008工程,在32位和64位下,分别在debug和release下重新编译工程,生成的lib在......SDK/C/Common/lib中。
打开VS,在Tool –> Options –> Projects and Solutions –> VC++ Directories 添加刚才生成的两个lib文件。
就是这样!!!
Tool->Options->Projects and Solutions->VC++ Directories
Include files中添加路径(最后):
....../NVIDIA Corporation/NVIDIA CUDA SDK/common/inc
....../NVIDIA Corporation/NVIDIA GPU Computing SDK 4.0/shared/inc
Library files中添加路径(最后):
....../NVIDIA Corporation/NVIDIA CUDA SDK/common/lib
....../NVIDIA Corporation/NVIDIA GPU Computing SDK 4.0/shared/lib
Source files中添加路径(最后):
....../NVIDIA Corporation/NVIDIA CUDA SDK/common/src
....../NVIDIA Corporation/NVIDIA GPU Computing SDK 4.0/shared/src
模板:
CUDA VS Wizard,下载地址:
http://sourceforge.net/projects/cudavswizard/files/,有32位和64位两个版本,选择和自己操作系统对应的版本即可,下载后安装
高亮:
F:\。。。\NVIDIA GPU Computing SDK 4.0\C\doc\syntax_highlighting\visual_studio_8
1. If you don't have a usertype.dat file in your "Microsoft Visual Studio 8\Common7\IDE" folder, then copy the included usertype.dat file there. If you do, append the contents of the included usertype.dat onto the end of the "Microsoft Visual Studio 8\Common7\IDE\usertype.dat"
2. Start Visual Studio 8. Select the menu "Tools->Options...". Open "Text Editor" in the tree view on the left, and click on "File Extension". Type cu in the "Extension" box, set the editor to "Microsoft Visual C++" and click "Add". Click "OK" on the dialog box.
3. Restart Visual Studio and your CUDA code should now have syntax highlighting.
无法打开sdk例子的解决办法:
It appears that the CUDA SDK 4.0 Installer may be removing the NvCudaRuntimeApi.rules and CUDA rules files located in the Visual Studio Directory. Someone at NVIDIA will be investigating in detail what exactly is happening during SDK installation. There is a copy of the the *.rules files installed in the CUDA toolkit directory. You can copy the *.rules files from:
C:\Program Files\NVIDIA Corporation\NVIDIA GPU Computing Toolkit\CUDA\r4.0\extras\visual_studio_integration\ rules\*.rules
to
${Your Visual Studio Location}\VC\VCProjectDefaults\