NVIDIA Tools Extension (NVTX) for CUDA 11 (Python Bindings)

11.8.86 · active · verified Sat Apr 11

NVTX (NVIDIA Tools Extension SDK) is a cross-platform C-based API with Python, C++, and Rust wrappers, used for annotating events, code ranges, and resources within applications. This allows developers to gain contextual information for performance analysis and visualization using NVIDIA developer tools such as Nsight Systems, Nsight Compute, and Nsight Graphics. The `nvidia-nvtx-cu11` package provides the NVTX Python bindings specifically compiled for CUDA 11 environments, enabling Python applications to leverage NVTX for profiling. It is currently at version 11.8.86. The underlying Python API is exposed via the `nvtx` module, which also has a separate PyPI distribution and a more frequent release cadence.

Warnings

Install

Imports

Quickstart

Annotate Python functions and code blocks using decorators (`@nvtx.annotate`) or context managers (`with nvtx.annotate:`). To visualize the annotations, run your script with NVIDIA Nsight Systems.

import time
import nvtx

@nvtx.annotate(color="blue", message="my_function_range")
def my_function():
    for i in range(2):
        with nvtx.annotate("loop_iteration", color="red", category=i):
            time.sleep(0.05) # Simulate some work

if __name__ == "__main__":
    my_function()
    print("Execution finished. To profile, run with NVIDIA Nsight Systems: `nsys profile -t nvtx python <your_script_name>.py`")

view raw JSON →