Go to Home/NewsGo to ContactGo to About
Language selection
Menu Principal
Accueil
My CV
- - - - - - - - - - - - -
GPU BLOG
GPU Articles & News
GPU Forum
- - - - - - - - - - - - -
Stages
Projets OpenGL
Projets UTBM
3D Gallery
- - - - - - - - - - - - -
Liens
Plan du site
Blog posts
Random Image
gpurt1b.png
Syndicate
Identification





Mot de passe oublié ?


CUDA visual studio integration
22-04-2009

cudalogo2 Just would like to give small tips I found to help working with CUDA under visual studio.

First, syntax highlighting for .cu files can be enabled with these few steps:

  1. Copy the content of the “usertype.dat” file provided by nvidia (NVIDIA CUDA SDK\doc\syntax_highlighting\visual_studio_8) into your “Microsoft Visual Studio 8\Common7\IDE” folder from your program files folder.

  2. Open Visual Studio and Take Tools -> Options. Under Text Editor -> File Extension tab, specify the extension “cu” as a new type.

Visual Studio rely on a feature named Intellisense to provide functions and variables names completion, definitions lookup and all these kind of features. To get intelligence working with .cu files, yo have to modify a windows registry key: Add c and cuh extensions to NCB Default C/C++ Extensions key under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Languages\Language Services\C/C++" path. (Thanks to http://www.wizardsofeast.com/?p=378 for the tip)

For those using Visual Assist X, you can do the following. First, find the Visual Assist X install directory: (X:\Program Files\Visual Assist X\AutoText\latest) and then make a copy of Cpp.tpl and rename it to Cu.tpl. Second, Open and close Visual Studio (this initializes Visual Assist X parameters by creating some folders/variables in the Registry ). Third, open regedit and go to: "HKEY_CURRENT_USER\Software\Whole Tomato\Visual Assist X\VANet9" and add ".cu;" to the ExtSource key and add ".cuh;" to the ExtHeader key. (Thanks to ciberxtrem for the tip)

Finally, build rules allowing to easily compile .cu files without having to write the rules manually can be integrated installing this little wizard: http://forums.nvidia.com/index.php?showtopic=65111. More details on CUDA build rules can be found on this website : http://sarathc.wordpress.com/2008/09/26/how-to-integrate-cuda-with-visual-c/.

commentaire(s)
Pat
Ecrit par Guest le 2009-09-26 00:44:47
Thanks, makes life a little nicer haveing these features with th .cu files. Thanks again.
hi
Ecrit par Guest le 2009-10-06 09:59:31
i am new to CUDA , could you please let me know how to build cuda code in visual studio, any setting or any file which needs to copy system details. 
XP 64bit
Ankit
Ecrit par Guest le 2010-06-16 15:53:06
Hey thanks for the above highlighting info. I was able to do it. 
But I m getting a lot of errors when compiling a .cu codes. I have added CUDA rules files by the name of nvcc.rules and added the library also but am not able to figure out what else to do. For all the CUDA commands like cudaMalloc , cudaMemcopy etc are undefined.  
1) Is nvcc.rules the correct file coz in many sites I have found the name cuda.rules . I searched but I dont have any such file in my computer

Seuls les utilisateurs enregistrés peuvent écrire des commentaires.
Veuillez vous identifier ou vous enregistrer.

Powered by AkoComment 2.0!

 

| Cyril Crassin | Website based on Joomla | Janvier 2006 |