NVTX resource naming allows custom names to be associated with host OS threads and CUDA resources such as devices, contexts, and streams. The names assigned using NVTX are displayed by NVIDIA Nsight, Tegra System Profiler, and Visual Profiler.
The nvtxNameOsThreadA()
function is used to name a host OS thread. The nvtxNameOsThreadW()
function is not supported in the CUDA implementation of NVTX and has no effect if called. The following example shows how the current host OS thread can be named.
// Windows
nvtxNameOsThread(GetCurrentThreadId(), "MAIN_THREAD");
// Linux/Mac
nvtxNameOsThread(pthread_self(), "MAIN_THREAD");
The nvtxNameCudaDeviceA()
and nvtxNameCudaStreamA()
functions are used to name CUDA device and stream objects, respectively. The nvtxNameCudaDeviceW()
and nvtxNameCudaStreamW()
functions are not supported in the CUDA implementation of NVTX and have no effect if called. The nvtxNameCudaEventA()
and nvtxNameCudaEventW()
functions are also not supported. The following example shows how a CUDA device and stream can be named.
nvtxNameCudaDeviceA(0, "my cuda device 0");
cudaStream_t cudastream;
cudaStreamCreate(&cudastream);
nvtxNameCudaStreamA(cudastream, "my cuda stream");
The nvtxNameCuDeviceA()
, nvtxNameCuContextA()
and nvtxNameCuStreamA()
functions are used to name CUDA driver device, context and stream objects, respectively. The nvtxNameCuDeviceW()
, nvtxNameCuContextW()
and nvtxNameCuStreamW()
functions are not supported in the CUDA implementation of NVTX and have no effect if called. The nvtxNameCuEventA()
and nvtxNameCuEventW()
functions are also not supported. The following example shows how a CUDA device, context and stream can be named.
CUdevice device;
cuDeviceGet(&device, 0);
nvtxNameCuDeviceA(device, "my device 0");
CUcontext context;
cuCtxCreate(&context, 0, device);
nvtxNameCuContextA(context, "my context");
cuStream stream;
cuStreamCreate(&stream, 0);
nvtxNameCuStreamA(stream, "my stream");
NVIDIA® GameWorks™ Documentation Rev. 1.0.220830 ©2014-2022. NVIDIA Corporation and affiliates. All Rights Reserved.