I did not have problems compiling the programs from the SDK (at least not those supported by my video card) but I can’t compile basic programs that I have written.
Edit:
I was wrong, the reason the SDK was compiled successfully is that I had compiled it when I had the drivers installed though unbuntu’s device drivers (version 195.xx). When I had those drivers the programs compiled fine but did not execute correctly. For example the programs I compiled before upgrading to the drivers from the nvidia website run fine now after installing the up to date drivers but they did not run correctly before upgrading the drivers. On the other hand, now I can’t compile! I have already reinstalled the cuda 3.1 toolkit.
End edit
For example if I compile this program:
// test.cu
int main()
{
return 0;
}
using nvcc -o test test.cu
I get:
/usr/local/cuda/include/surface_functions.h: In function ‘void surf1Dread(T*, surface<void, 1>, int, int, cudaSurfaceBoundaryMode)’:
/usr/local/cuda/include/surface_functions.h:100: error: there are no arguments to ‘__surf1Dreadc1’ that depend on a template parameter, so a declaration of ‘__surf1Dreadc1’ must be available
/usr/local/cuda/include/surface_functions.h:100: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/local/cuda/include/surface_functions.h:101: error: there are no arguments to ‘__surf1Dreads1’ that depend on a template parameter, so a declaration of ‘__surf1Dreads1’ must be available
/usr/local/cuda/include/surface_functions.h:102: error: there are no arguments to ‘__surf1Dreadu1’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu1’ must be available
/usr/local/cuda/include/surface_functions.h:103: error: there are no arguments to ‘__surf1Dreadu2’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu2’ must be available
/usr/local/cuda/include/surface_functions.h:104: error: there are no arguments to ‘__surf1Dreadu4’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu4’ must be available
/usr/local/cuda/include/surface_functions.h: In function ‘void surf2Dread(T*, surface<void, 2>, int, int, int, cudaSurfaceBoundaryMode)’:
/usr/local/cuda/include/surface_functions.h:460: error: there are no arguments to ‘__surf2Dreadc1’ that depend on a template parameter, so a declaration of ‘__surf2Dreadc1’ must be available
/usr/local/cuda/include/surface_functions.h:461: error: there are no arguments to ‘__surf2Dreads1’ that depend on a template parameter, so a declaration of ‘__surf2Dreads1’ must be available
/usr/local/cuda/include/surface_functions.h:462: error: there are no arguments to ‘__surf2Dreadu1’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu1’ must be available
/usr/local/cuda/include/surface_functions.h:463: error: there are no arguments to ‘__surf2Dreadu2’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu2’ must be available
/usr/local/cuda/include/surface_functions.h:464: error: there are no arguments to ‘__surf2Dreadu4’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu4’ must be available
test.cu: In function ‘void vecPrint(const char*, const float*, int)’:
test.cu:19: warning: format not a string literal and no format arguments
I have a 64 bit ubuntu 10.04 os and a 8800 GTX (768mb) video card. My cuda version info is:
nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2010 NVIDIA Corporation
Built on Mon_Jun__7_18:56:31_PDT_2010
Cuda compilation tools, release 3.1, V0.2.1221
I installed my nvidia driver from the binaries on the nvidia webpage and my current version is the newest (256.35).
Edit:
I have “solved” the problem by compiling the program using
nvcc -o test --compiler-options -fpermissive test.cu
and get
cc1: warning: command line option "-fpermissive" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-fpermissive" is valid for C++/ObjC++ but not for C
Programs compiled this way work as expected but I don’t consider this a solution because I should not have to to this.
End endit