I have an automatic build process which creates a C# wrapper around my CUDA code.
Since I’m working also in the driver API i need to decorate each kernel with an
extern “C” global keyword.
For that reason I created a header-file in which I have defined this macro
#definekernel extern “C” global
to be used in every CUDA code to make life a little easier.
Also I have defined a lot of different method and constants. The problem is that I
always have to type the #include. Is there a way that the #include is done automatically?
At least in some config or as command line when I call NVCC?
The nvcc manual (provided in the GPU Computing Toolkit) shows sample nvcc output when run with the -v option, and apparently cudafe (called by nvcc) has an option “–preinclude”. As a quick test, I modified the vectorAdd program, changing this line:
int n = 50000;
int n = VECTOR_SIZE;
I then created a header file called vector_size_header.h with the following contents:
thanks for the answer. The method works quite fine for me. The only problem is that I have installed some parts of my framework in “C:\Program Files” and it seems that the command line parser of NVCC does not recognize white spaces in the command line argument.
which is delegated to cudafe. Since internally nvcc call cudafe.exe it seems that it’s not possible to hand over arguments with a white space in it.
I have tried to escape with different methods, also of course using “…” in various combinations, escaping it with \ but nothing worked.