Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to specify host compiler for nvcc

📅 2014-Feb-14 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

[caption id="attachment_4247" align="aligncenter" width="640"][Host compiler specified in Nsight]( Host compiler specified in Nsight[/caption]

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