Search code examples
nvidiaprofilernsight

What is the correct CUDA project configuration when profiling in Nsight Eclipse 7.5 in order to use NVTX?


I am trying to profile a CUDA program because I want to verify the sequential performance by using NVTX tools and compare it against it corresponding heterogeneous performance.

I recently found this article and thought I could configure my Project in Visual Studio by myself with the right parameters:

http://http.developer.nvidia.com/NsightVisualStudio/2.2/Documentation/UserGuide/HTML/Content/NVTX_Library.htm

I finally found the way to profile my first program in Visual Studio 2013 Community. The instructions of above (starting from a CUDA Runtime Project) were modified as follows:

  1. VC++ Directories -> General -> Include Directories: $(NVTOOLSEXT_PATH)\include
  2. CUDA C/C++ -> Common -> Additional Include Directories: $(NVTOOLSEXT_PATH)\include
  3. Linker -> General -> Additional Library Directories: $(NVTOOLSEXT_PATH)\lib\$(Platform)
  4. Linker -> Input -> Additional Dependencies: nvToolsExt64_1.lib
  5. Copy the file nvToolsExt64_1.dll located in $(NVTOOLSEXT_PATH)\bin\$(Platform) and paste it in your project directory MyProject/x64/debug

I tried to replicate the Visual Studio steps in Nsight Elcipse Edition 7.5, but I cannot link my NVTX functions (particularly "nvtxRangeStartA" and nvtxRangeEnd) with the correct library (libnvToolsExt.so).

I coded it in Nsight Eclipse 7.5 for Fedora Server 21.

My code is:

#include "nvToolsExt.h"
...
nvtxRangeId_t t;
t = nvtxRangeStart("MyFunction_timing");
MyFunction();
nvtxRangeEnd(t);

CAN ANYONE HELP ME PLEASE?

What do I suppose I have to do?

The Nsight errors are:

undefined reference to 'nvtxRangeEnd'
undefined reference to 'nvtxRangeStartA'

Solution

  • That is either a compiler or linker error. Since you didn't mention an error about not finding "nvToolsExt.h", I'll guess your include settings are correct and it's getting the header file.

    That leaves the most probable cause is failed linking. You need to link the library as -lnvToolsExt and the library path as -L{/usr/local/cuda/lib64}

    I've listed a linux path, which is specific to my setup. Yours is wherever the CUDA Toolkit is installed, but you really need to verify the correct library is in there. The correct library is libnvToolsExt.so, which is symlinked a couple times.

    Go to project settings in Nsight>>Properties for {Project}>>Build>>Settings>>Tool Settings>>NVCC Linker>>Libraries Libraries(-l) should have nvToolsExt Library Search Path(-L) {filesystem path}

    Please edit your post with any additional errors from the build console.