Hannes
Hannes

Reputation: 304

How can I compile with gcc when using Nsight Eclipse Edition?

I have a small project in Nvidia's Nsight, which creates the makefiles for me. I want to use some SSE instructions and would like to compile cpp-files in the project with gcc instead of nvcc.

Is there a way to configure Nsight to do that or do I have to write the Makefile manually?

EDIT: .cu file should be compiled with nvcc of course.

Upvotes: 1

Views: 1934

Answers (2)

Eugene
Eugene

Reputation: 9474

You should be able to use GCC SSE instructions in the CU files - NVCC compiles all the host code with your platform compiler.

If you still would like to use GCC, you have two options:

  1. Create two projects - one is a static library project compiled with NVCC and another a regular executable project compiled with GCC. Then you can setup Nsight to link the executable with your library. (You may also use NVCC for executable and GCC for the library)
  2. As @Eric mentioned, you can create a "Makefile Project" and write the makefile by hand.

Upvotes: 1

kangshiyin
kangshiyin

Reputation: 9781

To use gcc in Nsight, you have to create makefile project and write the makefile by hand.

Alternatively, uou could use nvcc to compile your .cpp/.c file. To add extra compiler options which do not recognized by nvcc (only recognized by gcc), the nvcc option -Xcompiler should be prefixed.

One of the side-effects using nvcc is that your .cpp program will require libcudart.so to run, even it does not really need that.

Upvotes: 1

Related Questions