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

One thought on “How to specify host compiler for nvcc

  1. Giving -ccbin option solve this issue but I have now and other error.
    When I try to build a program with the following command line on widows : nvcc -ccbin C:\TDM-GCC-64\bin\g++.exe -o test.exe test.cpp
    I have the following message : nvcc fatal : Host compiler targets unsupported OS.
    I didn’t find how to solve it, and I don’t know where does it could came from.

    PS: g++ -o test.exe test.cpp work without any problem

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.