How to specify option to host compiler using nvcc

Options specified to host compiler in Nsight
-std=c++11 option specified to host compiler in Nsight

nvcc is the CUDA compiler driver that is used to compile both .cu and .cpp files. There are many options that be specified to nvcc for device code compilation. To specify options to the host compiler, place them after the option -Xcompiler.

If you are using Nsight, go to Project > Properties > Build > Settings > Tool Settings > NVCC Compiler > Build Stages. Add the compiler options that you want to the Preprocessor options (-Xcompiler) section.

Tried with: Nsight 5.5 and Ubuntu 12.04 LTS

How to specify host compiler for nvcc

Host compiler specified in Nsight
Host compiler specified in Nsight

nvcc is the compiler driver used to compile both .cu and .cpp files. It uses the cl.exe (on Windows) or gcc (on Linux) executable that it can find as the compiler for host code. Sometimes, you may want to specify a different host compiler or a different version of the host compiler to be used to compile the host code.

To do that, specify the full path of the compiler executable to the --compiler-bindir or the -ccbin option of nvcc.

If you are using Nsight, go to Project > Properties > Build > Settings > Tool Settings > NVCC Compiler > Build Stages. Specify the path of the compiler in the field Compiler Path.

Tried with: NSight 5.5 and Ubuntu 12.04