This package provides the native CUDA Runtime libraries as Python Wheels, enabling Python applications to leverage GPU acceleration by providing core runtime functionalities. It is part of NVIDIA's initiative to offer native Python support for CUDA, simplifying GPU-based parallel processing for high-performance computing, data science, and AI workloads. The current version is 12.9.79, with releases generally aligning with the NVIDIA CUDA Toolkit.
pip install nvidia-cuda-runtime-cu12Verified import paths — ran on the pinned version, not inferred.
While `nvidia-cuda-runtime-cu12` itself doesn't offer direct high-level Python APIs, its successful installation allows frameworks like PyTorch to leverage the CUDA runtime. This snippet demonstrates how to verify that a CUDA-enabled PyTorch (which depends on this runtime) can detect and utilize your GPU.
Ensure your NVIDIA GPU drivers are updated to a version compatible with CUDA 12.x. Check NVIDIA's official documentation for driver requirements corresponding to your specific CUDA version.
For compilation, download and install the complete NVIDIA CUDA Toolkit from developer.nvidia.com/cuda-downloads alongside this runtime package. Ensure `nvcc` is in your system's PATH.
Manually add the CUDA binary and library paths (e.g., `/usr/local/cuda/bin`, `/usr/local/cuda/lib64` on Linux, or `%CUDA_PATH%\bin`, `%CUDA_PATH%\lib\x64` on Windows) to your system's environment variables. Restart your shell or IDE after changes.
Consult the NVIDIA CUDA Toolkit Release Notes and Programming Guide for details on deprecated features and API changes during major upgrades. Thoroughly test your applications after upgrading.
Set `CUDA_MODULE_LOADING=EAGER` in your environment before running the application. For example, `export CUDA_MODULE_LOADING=EAGER && python my_script.py` on Linux/macOS.
Ensure that the 'torch' package is installed in your Python environment using pip (e.g., `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121` for CUDA 12.1, adjusting for your specific CUDA version or 'cpu' if no GPU is used). Verify that the correct Python interpreter and environment are being used.
To install packages from the NVIDIA Python Package Index, first install the `nvidia-pyindex` package: `pip install nvidia-pyindex`. Then, proceed with the installation of the desired CUDA runtime package, e.g., `pip install nvidia-cuda-runtime-cu12`.