您的位置:首页 > 其它

CUDA vc2005环境配置方法总结

2008-06-01 16:20 417 查看
安装CUDA SDK
安装CUDA toolkit 安装CUDA驱动。
配置相应的环境变量:CUDA_BIN_PATH=C:/CUDA/BIN;
CUDA_INC_PATH=C:/CUDA/INCLUDE;                      CUDA_LIB_PATH=.;C:/CUDA/lib;C:/CUDA/lib/cuda.lib;C:/CUDA/lib/cudart.lib;
 解压cuda_build_rule.zip得到cuda.rules。(目录中最好没有中文)新建工程。
在工程上右键选custom build rules->Find Existing,选中cuda.rules,点击ok。现在可以像编译.c/.cpp一样编译.cu了。
在工程目录下新建文本文件,存为.cu格式,增加到工程中,编辑代码。
在.cu文件上右键选属性,你将会看到多出来一个CUDA目录。说明以上操作成功。在工程属性里,[C/C++]à[General]àAdditional Include Directories 添加 $CUDA_INC_PATH 在工程属性里,[Linker]à[General]àAdditional Library Directories 添加 $CUDA_LIB_PATH 在工程属性里,[Linker]à[Input]àAdditional Dependencies 添加 c:/CUDA/lib/cudart.lib 重新编译工程。  
  Visual Assist 添加支持*.cu文件
1.       打开注册表,在HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/8.0/Languages/File Extensions/ 下面添加子键 .cu 然后copy .cpp的键值到.cu。这样才能表示cu也是VS下的VC的工程文件。 2.       打开注册表HKEY_CURRENT_USER/Software/Whole Tomato/Visual Assist X/VANet8 在ExtSource键添加键值.cu。
3.       打开Visual Assist属性,在projects 的C/C++ Directories custom下面添加CUDA的头文件目录,这样才能在Visual Assist 生成规则的时候找到CUDA自身的特殊定义才能生成Visual Assist的关键字,如__global__.  
Want pretty syntax highlighting when editing your .cu files in Visual Studio? Heres how:   --- Visual Studio .Net 2005 / 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, and click "Add".  Click "OK" on the dialog box.     
3. Restart Visual Studio and your CUDA code should now have syntax highlighting.   (CUDA guide中的方法,试过但并不好使)    
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息