I would like to create a Cuda module for use in the Cuda Driver API without interacting with the host compiler. The main impetus for this is that the decisions in my group on when to change versions of host compilers and cuda compilers is not always within our control. I would like to guard against cases where an upgrade on one side results in incompatibilities between the host and cuda compilers.
For example, I have a file, test.cu that contains only cuda device code. I would like to compile it into ptx:
nvcc --ptx kernel.cu
and then subsequently load this into my executing program like this:
cuModuleLoad(&module, "kernel.ptx");
When I try to compile the cuda file, I get the following error:
In file included from /usr/local/cuda/bin/../include/cuda_runtime.h:59:0,
from <command-line>:0:
/usr/local/cuda/bin/../include/host_config.h:82:2:
error: #error -- unsupported GNU version! gcc 4.5 and up are not supported!
Since I didn't include cuda_runtime.h in my code, I compiled in verbose mode to see what was going on and saw that the first step is to use my host compiler and force inclusion of this file:
> nvcc --verbose --ptx kernel.cu
#$ gcc -E -x c++ -D__CUDACC__ -C "-I/usr/local/cuda/bin/../include"
"-I/usr/local/cuda/bin/../include/cudart" -include "cuda_runtime.h"
-m64 -o "/tmp/tmpxft_00001058_00000000-4_kernel.cpp4.ii" "kernel.cu"
Since I know my .cu file has no host code, I would like to just force nvcc to skip the host integration steps, but I can't find a way to do that. Does anyone know if/how this can be done?