nvcc compilation time

Few questions on nvcc compilation time.

(1) Every time when I compile my code, nvcc generates warning messages for four times. This is quite strange. I don’t know the reason for this.

The compiler command that I used is the following

/usr/local/cuda/bin/nvcc  -gencode=arch=compute_10,code=\"sm_10,compute_10\"  -gencode=arch=compute_20,code=\"sm_20,compute_20\"  -m64 --compiler-options -fno-strict-aliasing  -I. -I/usr/local/cuda/include -I../../common/inc -I../../../shared//inc -DUNIX -O2   -o obj/x86_64/release/units.cu.o -c units.cu

Any reason on why I get the same warning messages for four times ?

(2) I also see that the compilation time is quite high when compared with pure c++/g++ compilation.

For example, if I take a test.cpp file and rename it as test.cu file, and compile it with nvcc the compilation time is about 5 times more.

Is there anyway to reduce the compilation time using nvcc ?


[font=“Courier New”]-gencod[/font]e results in a separate compiler invocation for each of the given [font=“Courier New”]code=[/font] arguments. So in your case the compiler is invoked four times to compiles the device code and a fifth time to generate the host code. If a warning is provoked by device code, it is thus emitted four times.

You can remove architectures you are not using to speed up compilation.

That is right. Thanks for the clarification. I did not realize that the default Makefile that comes with the SDK examples generates code in sm_10, sm_20, compute_10, compute_20.

I turned off the compilation for all other modes except sm_20.

The overall compilation speed issue still remains (nvcc vs g++). But not too critical at this point.