Introducing CUPTI Python API

Overview

CUPTI Python provides Python APIs for creation of profiling tools that target CUDA Python applications.

This release of CUPTI Python supports a subset of CUPTI C Activity and Callback APIs on Linux x86_64 . This includes Python samples to show use of the CUPTI Python APIs.

Please refer to the CUPTI Python 12.6.0 overview, release notes, and user guide for more details.

For more information on CUPTI, please see the CUPTI Overview page.

Platform support

  • Linux x86_64

Runtime requirements

  • CUDA Toolkit version 12.6
    • Only the NVRTC redistributable component is required from the CUDA Toolkit.
      CUDA Toolkit Documentation Installation Guides can be used for guidance.
    • Note that the NVRTC component in the Toolkit can be obtained via PYPI, Conda or Local Installer.
  • Python version >= 3.9

Installing from PyPI

  • $ pip install cupti-python

Setting for CUPTI C Library

  • cupti-python has a dependency on nvidia-cuda-cupti-cu12. It uses the CUPTI C library “libcupti.so” from nvidia-cuda-cupti-cu12.
  • However, if nvidia-cuda-cupti-cu12 is uninstalled, the LD_LIBRARY_PATH environment variable needs to be set to the directory in which “libcupti.so” is present.
  • When the CUDA Toolkit is installed, “libcupti.so” is present under CUDA_TOOLKIT_INSTALL_PATH/extras/CUPTI/lib64.
    e.g. If the CUDA_TOOLKIT_INSTALL_PATH is /usr/local/cuda-12.6 :
    $ export LD_LIBRARY_PATH=/usr/local/cuda-12.6/extras/CUPTI/lib64

Cupti Python Samples

  • Once CUPTI Python is installed, the CUPTI samples are located under the “site-packages/cupti-python-samples” directory.

  • You can determine the location of your site-packages directory by executing the following command.

    • $ python3 -m site
  • Prior to executing the samples you need to install the following:

    • numba
    • numpy
  • Refer “cupti-python-samples/README.txt” for usage of samples.

Known Limitations

  1. The function_params field of cupti.cupti.CallbackData is currently not supported, “None” will be returned if used.