Sunday, September 1, 2013

How to highlight cuda code in visual studio 10.0


Step 1: go to the following path
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v5.0\doc\syntax_highlighting\visual_studio_7
You will find two files:
readme.txt
usertype.dat

Step 2: Following the instruction in 'readme.txt', 
a) Copy 'usertype.dat' file to the following path
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE

b) Add cuda extension '.cu' and '.cuh' via
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. 

c) Restart Visual Studio and your CUDA code should now have syntax highlighting.