NVIDIA Tools Extension (NVTX)


The NVIDIA® Tools Extension SDK (NVTX) is a C-based Application Programming Interface (API) for annotating events, code ranges, and resources in your applications. Applications which integrate NVTX can use NVIDIA Nsight, Tegra System Profiler, and Visual Profiler to capture and visualize these events and ranges.

The NVTX API provides additional information to improve presentation of data. In general, the NVTX SDK adds additional value to NVIDIA’s tools while incurring almost no overhead when the tool is not attached to the application.

The NVTX API provides two core services:

  1. Tracing of CPU events and time ranges.
  2. Naming of OS and API resources.

NVTX can be quickly integrated into an application. The sample program below shows the use of range events (nvtxRangePush() and nvtxRangePop()), marker events (nvtxMark()), and resource naming (nvtxNameOsThread()).

#include <nvToolsExt.h> 
#include <sys/syscall.h>
#include <unistd.h>
static void wait(int seconds) {
nvtxRangePush(__FUNCTION__);
nvtxMark("Waiting...");
sleep(seconds);
nvtxRangePop();
}
int main(void) {
nvtxNameOsThread(syscall(SYS_gettid), "Main Thread");
nvtxRangePush(__FUNCTION__);
wait(1);
nvtxRangePop();
}

More information is available as comments in nvToolsExt.h. NVTX v3 is a header-only C library. The headers ship with CUDA Toolkit and Nsight tools such as Nsight Graphics and Nsight Systems.

 


NVIDIA® GameWorks™ Documentation Rev. 1.0.190923 ©2014-2019. NVIDIA Corporation. All Rights Reserved.