Visual Assist X and CUDA Better intellisense and syntax highlight

Hey all,

If you happen to use Visual Assist X from Whole Tomato Software (http://www.wholetomato.com/), you may wonder how you can get visual assist to recognize CUDA files and parse and highlight them like regular C/C++ files. I wondered the same thing, and the helpful people at the Whole Tomato forums pointed me to their FAQ, which has instructions for exactly what I needed.

Follow the instructions here, using .cu as the file extension:
http://www.wholetomato.com/forum/topic.asp?TOPIC_ID=5481

Note that you might also want to go into the VA settings->Projects->C/C++ Directories, switch to “Custom” Platform mode, and add your /inc directory to the list of search directories.

Enjoy!

Mark

I have been unsuccessful with the instructions given on the Whole Tomato website. Has anyone else faced this problem as well?

Thanks,

Greenman

Mark, thank you very much!

I think I got mixed result… cuda{something} function didn’t appear, as so quantifiers… :(

I came across the same problem.The way you told above is unuseful for me.Some people can help me?Thank you.

The steps I do to configure the Visual Assist X properly are the next ones (for Visual Studio 2008):

First, close all the instances of Visual Studio and install the software.

Second, 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

Third, Open and close Visual Studio (this initializes Visual Assist X parameters by creating some folders/variables in the Registry ).

Fourth, open the regedit table and go to:

HKEY_CURRENT_USER\Software\Whole Tomato\Visual Assist X\VANet9

Finally add .cu; to the ExtSource key and add .cuh; to the ExtHeader key

A part from that you can use what this link (from the user wizardsofeast) put to improve intellisense, specially for navigating through functions. Using this one in combination with Visual Assit X is superb :rolleyes: :

http://www.wizardsofeast.com/?p=378

Hello, Some good folks over at Visual Assist (see sources below). They helped clean up Visual Assist X a little more when working with CUDA. I tried their suggestion and I no longer get any annoying squiggly lines under some of the keywords in .cu files for device and global functions.

To summarize it(and add to it more), I wrote up some instructions: (note: see sources below for additional info)

==================================================================
To help make it so Visual Assist X does not fail with cuda and underline unknown words, perform the following:

  1. copy C:\Program Files\Visual Assist X\Misc\StdAfx.h to C:\Users\RWHITE\AppData\Roaming\VisualAssist\ Misc\StdAfx.h

  2. Then insert the following to C:\Users\RWHITE\AppData\Roaming\VisualAssist\ Misc\StdAfx.h

///////////////////////////////////////////////////////////// //////////////////
// macro for visual assist compatibility with cuda
#define launch_bounds(x)
#define restrict
#define device
#define global
#define shared
#define constant
struct int3{
int x;
int y;
int z;
};
struct uint3{
unsigned int x;
unsigned int y;
unsigned int z;
};
struct uint3{
unsigned int x;
unsigned int y;
unsigned int z;
};
struct blockIdx{
int x;
int y;
int z;
};
struct threadIdx{
unsigned int x;
unsigned int y;
unsigned int z;
};
struct blockDim{
int x;
int y;
int z;
};
struct blockIdx{
int x;
int y;
int z;
};
typedef int warpSize;

  1. Last, Open Visual studio and run from the menu: VA Options -> Performance -> General -> Rebuild symbol databases

==================================================================
Sources

http://www.wholetoma…?TOPIC_ID=10225
http://www.wholetoma…p?TOPIC_ID=5956

tools > options> projects and solutions > VC++ directories

choose your platform. i use win32 but theres probably a better way but i dont know how to create a custom config. this way works fine.

foreach X in {library files, source files, include files} in the “show directories for:” drop down,
add folder “(CUDA_PATH)\<<X>>" for includes it would be "(CUDA_PATH)\include”
for source files it would be “(CUDA_PATH)\src" for library files it would be "(CUDA_PATH)\lib”

this will enable f12 lookups to work,and make visual assist properly populate translations for cude #defines. this approach is far superior to faking out with a corrupted StdAfx.h files in roaming.

the above comment applies to Visual studio 2008 only

also, in Visual Studio 2008
tools > options> projects and solutions > VC++ Project Settings

add .cuh and .cu to “Extensions to include”

and *.cu to “C/C++ file extensions”

Thank you for the idea.

I’ve never used CUDA myself, but if the keywords such as constant and shared are not defined in some way in the source itself, cleverly combining the two solutions (roaming file and your new way) may result in an enhanced “superior” experience :)

Anyway, you may find it more convenient to use va_stdafx.h which you can put next to your solution or project: http://docs.wholetomato.com/default.asp?W302

(Just don’t forget to put a new line at EOF)

Thomas
Whole Tomato Software

Is there the way to make visual assist X to understand starting of kernels? It highlights “<<<” as error. This is not critical but is annoying.

I would be needing the knowledge on this since im starting an online business and my website went live recently.