nvcc version compatibility and #include-ing a compile-time #define using nvcc -DINC=\"header.h\&


I am working on a project using CUDA to perform inference with Markov Chain Monte Carlo methods. I have access to a shared PC with a GeForce 8800GTX inside with the CUDA SDK version 1.1 installed. I developed the program I wish to run on my own PC using the CUDA SDK 2.2 but have found some difficulties in getting the program to run on the graphics card.

I can compile my code on my own PC and the shared PC using the CUDA SDK 2.2 but the code wont run unless I compile it using the CUDA SDK 1.1 that is already installed on the PC. I have tried the -arch and -code options but it does not work. I would really like to not have to edit my Makefile every time I log into the shared PC to run my code.

Also in my code I have constructs such as:

[codebox]// Define interface

host device float myfunction(int arg);

// Include implementation

#ifdef IMPL

#include IMPL

#elif defined(GNUC)

#error IMPL is undefined


This allows me to switch implementations of a function (or group of functions) from the command line without having to edit all the source files that use these functions. These files compile with nvcc 2.2 using a command like nvcc -DIMPL=“myimpl.cu” -c myfile.cu (which expands the macro inside the #include to point to the file specified on the command line) but with nvcc 1.1 I get an error error: #include expects “FILENAME” or . This means that I have to edit a lot of my source files to get the program to compile on the shared PC with the CUDA SDK 1.1.