{"id":785,"library":"nvidia-cuda-cupti-cu12","title":"NVIDIA CUDA CUPTI Runtime Libraries","description":"The `nvidia-cuda-cupti-cu12` package provides the CUDA Profiling Tools Interface (CUPTI) runtime libraries for CUDA 12.x. CUPTI is a dynamic library that enables the creation of profiling and tracing tools for CUDA applications. This package primarily supplies the low-level C libraries, with Python bindings provided by the `cupti-python` package. The current version is 12.9.79 and it is actively maintained by NVIDIA.","status":"active","version":"12.9.79","language":"python","source_language":"en","source_url":"https://pypi.org/project/nvidia-cuda-cupti-cu12/","tags":["cuda","nvidia","profiling","gpu","cupti"],"install":[{"cmd":"pip install nvidia-cuda-cupti-cu12","lang":"bash","label":"Install only CUPTI runtime libs"},{"cmd":"pip install --extra-index-url https://pypi.ngc.nvidia.com nvidia-cuda-runtime-cu12","lang":"bash","label":"Install as part of CUDA runtime metapackage (recommended)"},{"cmd":"pip install cupti-python","lang":"bash","label":"Install Python bindings (recommended for Python usage)"}],"dependencies":[{"reason":"Provides Python APIs for interacting with CUPTI functionality; `nvidia-cuda-cupti-cu12` supplies the underlying C library.","package":"cupti-python","optional":false},{"reason":"Often used in examples and for just-in-time compilation of CUDA kernels in Python for profiling.","package":"numba-cuda","optional":true},{"reason":"Provides CUDA Python Driver APIs, used in some advanced CUPTI Python samples.","package":"cuda-python","optional":true}],"imports":[{"wrong":"from nvidia.cupti import cupti","symbol":"cupti","correct":"import nvidia.cupti"}],"quickstart":{"code":"import numpy as np\nfrom numba import cuda\nfrom cupti import cupti\n\n@cuda.jit\ndef vector_add(A, B, C):\n    idx = cuda.grid(1)\n    if idx < A.size:\n        C[idx] = A[idx] + B[idx]\n\ndef func_buffer_requested():\n    buffer_size = 8 * 1024 * 1024  # 8MB buffer\n    max_num_records = 0\n    return buffer_size, max_num_records\n\ndef func_buffer_completed(activities: list):\n    for activity in activities:\n        if activity.kind == cupti.ActivityKind.CONCURRENT_KERNEL:\n            print(f\"Kernel Name: {activity.name}\")\n            print(f\"Kernel Duration (ns): {activity.end - activity.start}\")\n\n# Initialize data\nvector_length = 1024 * 1024\nA = np.random.rand(vector_length)\nB = np.random.rand(vector_length)\nC = np.zeros_like(A)\n\nthreads_per_block = 128\nblocks_per_grid = (vector_length + (threads_per_block - 1)) // threads_per_block\n\n# Register CUPTI callbacks\ncupti.activity_register_callbacks(func_buffer_requested, func_buffer_completed)\n\n# Enable CUPTI activity collection for concurrent kernels\ncupti.activity_enable(cupti.ActivityKind.CONCURRENT_KERNEL)\n\n# Launch kernel\nvector_add[blocks_per_grid, threads_per_block](A, B, C)\ncuda.synchronize()\n\n# Flush and disable CUPTI activity\ncupti.activity_flush()\ncupti.activity_disable(cupti.ActivityKind.CONCURRENT_KERNEL)\n","lang":"python","description":"This quickstart demonstrates how to use `cupti-python` to profile a simple Numba CUDA kernel. It registers callbacks to capture kernel launch information and then flushes the collected activities. Ensure you have `numba-cuda` and a CUDA-capable GPU with appropriate drivers installed. This code assumes `cupti-python` is installed and the `libcupti.so` library (provided by `nvidia-cuda-cupti-cu12`) is discoverable."},"warnings":[{"fix":"Install `cupti-python` alongside `nvidia-cuda-cupti-cu12` using `pip install cupti-python`.","message":"The `nvidia-cuda-cupti-cu12` package provides the underlying C/C++ libraries. For Python-level interaction and APIs, the `cupti-python` package must also be installed. Direct Python imports are typically from `cupti` (the `cupti-python` module), not `nvidia_cuda_cupti_cu12`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `nvidia-cuda-cupti-cu12` is installed or set `export LD_LIBRARY_PATH=$CUDA_TOOLKIT_INSTALL_PATH/extras/CUPTI/lib64` before running CUPTI Python applications.","message":"CUPTI Python relies on the `libcupti.so` C library. If `nvidia-cuda-cupti-cu12` is uninstalled or if `libcupti.so` cannot be found automatically, you may need to explicitly set the `LD_LIBRARY_PATH` environment variable to the directory containing `libcupti.so` (e.g., `$CUDA_TOOLKIT_INSTALL_PATH/extras/CUPTI/lib64`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update profiling tools and code to use `CUpti_ActivityKernel9` where appropriate. Review CUPTI release notes for specific migration details.","message":"In CUDA Toolkit 12.0, the activity record `CUpti_ActivityKernel8` was deprecated and replaced by `CUpti_ActivityKernel9` to accommodate new fields for devices with compute capability 9.0 and higher. This impacts users interacting with the low-level CUPTI C API, and potentially `cupti-python` users working with older code that explicitly references these activity kinds.","severity":"breaking","affected_versions":"CUDA Toolkit 12.0 and later (corresponds to `nvidia-cuda-cupti-cu12` versions aligned with CUDA 12.0+)"},{"fix":"Always use the latest version of `nvidia-cuda-cupti-cu12` and ensure your CUDA Toolkit installation and GPU drivers are up-to-date.","message":"Older versions of `nvidia-cuda-cupti-cu12` (e.g., 12.4.127, 12.3.101) have been flagged with severe vulnerabilities. While the current version 12.9.79 should address these, always ensure you are running the latest stable version and keep your CUDA Toolkit and drivers updated.","severity":"gotcha","affected_versions":"<12.9.79"},{"fix":"Install 'numba' using pip: `pip install numba`.","message":"The script attempts to import 'numba' but it is not installed. 'numba' is a separate Python package and must be explicitly installed if your application depends on it.","severity":"breaking","affected_versions":"All versions"},{"fix":"First, install `nvidia-pyindex` using `pip install nvidia-pyindex` to configure pip to use the NVIDIA index. Then, install `nvidia-cuda-cupti-cu12`.","message":"The `nvidia-cuda-cupti-cu12` package is hosted on the NVIDIA Python Package Index, not directly on PyPI. Attempting to install it directly via `pip install` without configuring the NVIDIA index will lead to a 'placeholder project' error during installation.","severity":"breaking","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'12':24 '12.9.79':67 'activ':71 'applic':42 'bind':55 'c':51 'creation':34 'cu12':11 'cuda':2,9,15,23,41,75 'cupti':3,10,19,26,60,79 'cupti-python':59 'current':64 'dynam':29 'enabl':32 'gpu':78 'interfac':18 'level':50 'librari':5,21,30,52 'low':49 'low-level':48 'maintain':72 'nvidia':1,8,74,76 'nvidia-cuda-cupti-cu12':7 'packag':12,44,62 'primarili':45 'profil':16,36,77 'provid':13,56 'python':54,61 'runtim':4,20 'suppli':46 'tool':17,39 'trace':38 'version':65 'x':25","created_at":"2026-03-29T04:21:35.629459+00:00","updated_at":"2026-04-16T17:26:53.977894+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'nvidia.cupti'"},"ecosystem":"pypi","meta_description":null,"install_score":50,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"12.9.79","cli_name":"","cli_version":null,"type":"library","homepage":"https://developer.nvidia.com/cuda-zone","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/nvidia-cuda-cupti-cu12/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-27","next_check":"2026-07-10","install_tag":"draft"}}