CUDA Debugger > How To > Set Build Options in VS 2008

NVIDIA Nsight uses build options that you specify in the Visual Studio 2008 property pages to build your CUDA application. The properties that you need to specify depend on whether you want to use v3.2 or v4.0 of the CUDA Toolkit to build the project.

NVIDIA Nsight 3.2 installs versions 4.0, 4.1, and 4.2 of the CUDA Toolkit. The default installation directory for the CUDA Toolkit is:

$(ProgramFiles)\NVIDIA GPU Computing Toolkit\CUDA

You can identify the different versions by the directory name. For example, version 4.2 of the compiler is in: ...\CUDA\v4.2\bin\nvcc.exe

If you installed the CUDA Toolkit version 4.2 from the CUDA SDK, the default install directory is the same as above. The important thing to note is that in order to build a project that is compatible with NVIDIA Nsight, the NVIDIA CUDA Compiler (nvcc) must support the switch for generating debug symbolics: -G0.

To use CUDA Toolkit 4.2 to build a project:

  1. In the Solution Explorer, click on the project name so that it is highlighted.
  2. From the Project menu, choose Properties. The Property Pages window opens.


  3. Change project properties to work with the 4.2 Toolkit.
    1. From the Configuration combo box at top left of the dialog box, select the configuration you wish to build, such as Debug.
    2. Under Configuration Properties, select C/C++. Next to Additional Include Directories, specify the path to the CUDA include directory:

      $(CUDA_PATH_V4_2)\include



    3. Under Configuration Properties, select Linker. Next to Additional Library Directories, specify the path to the CUDA library files:

      $(CUDA_PATH_V4_2)\lib\$(PlatformName)



    4. Under Configuration Properties, select the Input node under Linker. Change other build options appropriate for your project. For example, you might add cuda.lib to Additional Dependencies if your application implements the CUDA driver API.
    5. Click OK to accept changes and close the Property Pages window.

    NVIDIA Nsight defines CUDA_PATH_V4_2 as a system environment variable. For more information, see Environment Variables.

Build Options on the Command Line

The compiler that ships with the NVIDIA Nsight supports a switch for generating debug symbolics: - G0.

If you use the command line to build your project, make sure to add:

-G0

to the NVIDIA CUDA Compiler (nvcc) command line. The switch causes the compiler to generate CUDA debug symbolics.

You only need this when building from source files containing GPU code. You might notice a runtime slowdown when you are actively debugging code built with the  -G0 switch. We recommend that you include CUDA debug symbolics only as needed. Building only the few files of interest with -G0 will give you a better debugging experience.

See Also

How Tos
Configure a VS 2008 Project to Work with Nsight

Reference
Common MSBuild Project Properties


NVIDIA® Nsight™ Development Platform, Visual Studio Edition User Guide Rev. 3.2.131009 ©2009-2013. NVIDIA Corporation. All Rights Reserved.

of