Getting Started#

Runtime requirements#

  • Python version >= 3.10

Installing from PyPI#

$ pip install cupti-python

Locating the CUPTI Library#

  • CUPTI Python has a dependency on nvidia-cuda-cupti and uses the CUPTI C library libcupti.so*.

  • CUPTI Python uses cuda.pathfinder to locate and load libcupti.so*. For detailed information about the search order and library discovery mechanism, please refer to the search order in cuda.pathfinder.load_nvidia_dynamic_lib.

Profiling Library Configuration#

  • If you intend to use profiling features such as cupti.pm_sampling, the CUPTI shared library dynamically loads libnvperf_host.so and libnvperf_target.so at runtime. These ship in the same directory as libcupti.so*, so make that directory discoverable to the dynamic linker via LD_LIBRARY_PATH.

  • e.g. If CUPTI Python is using the CUPTI shared library from the nvidia-cuda-cupti package:

$ export LD_LIBRARY_PATH=<site-packages>/nvidia/cu13/lib:$LD_LIBRARY_PATH

NVTX Configuration#

  • CUPTI Python provides support for NVTX through the activity kinds cupti.cupti.ActivityKind.MARKER, cupti.cupti.ActivityKind.MARKER_DATA, and cupti.cupti.ActivityKind.NAME.

  • To enable proper collection of NVTX-related activity records, ensure the following setup:

  • Set the NVTX_INJECTION64_PATH environment variable to point to the same CUPTI shared library that CUPTI Python is using.

  • e.g. If CUPTI Python is using the CUPTI shared library from the nvidia-cuda-cupti package, the path should be:

$ export NVTX_INJECTION64_PATH=<site-packages>/nvidia/cu13/lib/libcupti.so.13