Getting Started#

Runtime requirements#

  • Python version >= 3.10

Installing from PyPI#

$ pip install cupti-python

Setting for CUPTI C Library#

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

  • CUPTI Python automatically searches for libcupti.so* from the nvidia-cuda-cupti package in the following locations (in order):

    1. Virtual environment site-packages at <venv>/.../site-packages/nvidia/cu13/lib/libcupti.so* (when running inside a virtual environment)

    2. System site-packages at <system-site-packages>/nvidia/cu13/lib/libcupti.so* (when using system Python, or when a virtual environment was created with --system-site-packages)

    3. Additional site-packages directories at <site-packages>/nvidia/cu13/lib/libcupti.so* (any remaining directories from site.getsitepackages())

    4. User site-packages at <user-site-packages>/nvidia/cu13/lib/libcupti.so* (if user site is enabled)

    5. Fall back to the native loader (Linux: dlopen()). If the CUPTI library is not found in any site-packages directories, you can set the LD_LIBRARY_PATH environment variable to the directory containing libcupti.so*. When the CUDA Toolkit is installed, libcupti.so* is typically located under $CUDA_TOOLKIT_INSTALL_PATH/extras/CUPTI/lib64.

    Example: If the CUDA_TOOLKIT_INSTALL_PATH is /usr/local/cuda-13.0:

    $ export LD_LIBRARY_PATH=/usr/local/cuda-13.0/extras/CUPTI/lib64
    

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