NVCC compatibility with GCC

I want to transfer a function of a large open source C code on a GPU, and I wanted to start by compiling the code with nvcc, and then proceed to developing the kernel.

The code compiles and executes fine with gcc of course, but although it compiles with nvcc when I try to execute it I get the message from the program: [blastall] ERROR: Invalid Arg->type in

The big question is: is nvcc truly a superset of gcc? If a C code works with gcc should it necessarily work with nvcc without any problems?

The other question is: does anybody have any idea what might be the reason I am getting this error? I will start debugging, but I wouldn’t mind any leads.


nvcc is not a compiler. It uses gcc to compile host-code. You can check with the —dryrun command which gcc commands were issued by nvcc

As already set, nvcc is just a compiler driver. It separates the host-side code of the application from the device-side code. Which compiler for host is used is depending on the platform you are on. For the device-part, the nvopencc (Open64) compiler is used.

Page 22 in the NVCC manual has a very descriptive figure of the compilation trajectory.

What does your Makefile look like?

I have attached the makefiles. There are more, but these are the important ones.

I start execution from makedis.csh

The only changes I have made are in the linux-x86.mk file where I commented out the NCBI_CC and I replaced gcc with nvcc and I took out the “-pipe” because nvcc was giving errors.

The other change I made was on the NCBI_LDFLAGS1 where I took out the -mcpu=pentium4 because again I was getting errors.

P.S. I added the .txt extension to the make files myself, because without it I was getting a message saying I couldn’t upload those kinds of files.
makeall.unx.txt (31.5 KB)
linux_x86.ncbi.mk.txt (2.11 KB)
makedis.csh.txt (14.9 KB)

Right! Where you take a wrong turn is when you straightforwardly replaced gcc with nvcc:



… which is never going to work the way you expect. If you look into the makefiles supplied with the Nvidia SDK, you will notice that C++ files are all assigned to the ´CCFILES’ variable, which - with a little help from ´common.mk´ - will get compiled by g++ and not by nvcc.

So keep your makefiles just the way they were and instead add rules for CUDA files so that they - and only those - will get compiled by nvcc.