The default host compiler used by nvcc for linux

I am using CUDA 4.0 on Ubuntu 10.10 with a GTX 570 (computational capcability 2.0) with a set of GCC compilers. As I understand it, during compilation, the CUDA nvcc compiler driver splits .cu into host code and device code and calls the host compiler to compile the host code and compile the device code separately. Finally, it combines the generated host object code and PTX device code into a single executable file.

For Linux systems, what is the default compiler that is called to compile the host code? Is it a C ( gcc ) compiler or a C ++ ( g++ ) compiler of the GCC package?

+4
source share
2 answers

You need the -ccbin option for nvcc , for example. to use icpc (Intel C ++ compiler) use nvcc -ccbin=icpc (assuming icpc is available in your $PATH ).

Please note that you should always pass the C ++ compiler ( g++ , icpc , etc.), since nvcc treats the code as C ++, even if it is C code.

+9
source

AFAIK uses g++ (more precisely, uses gcc with a language installed in C ++) and, of course, g++ for the final layout. Run nvcc with the --verbose option to see more details if you want.

+5
source

Source: https://habr.com/ru/post/1383730/


All Articles