{"library":"nvidia-cuda-nvrtc-cu12","title":"NVIDIA CUDA NVRTC for CUDA 12.x","description":"NVRTC (NVIDIA Runtime Compiler) is a library designed for runtime compilation of CUDA C++ source code into PTX (Parallel Thread Execution) assembly. This Python package, `nvidia-cuda-nvrtc-cu12`, provides the native runtime libraries (DLLs/SOs) for CUDA 12.x, enabling dynamic code generation and execution on NVIDIA GPUs. It's a fundamental component of the CUDA Toolkit, actively maintained by NVIDIA, and crucial for other Python libraries that leverage JIT CUDA compilation.","language":"python","status":"active","last_verified":"Sat Apr 11","install":{"commands":["pip install nvidia-cuda-nvrtc-cu12"],"cli":null},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\n\n# This package primarily provides native runtime libraries (DLLs/SOs)\n# for CUDA's NVRTC component, which are consumed by other higher-level\n# CUDA-enabled Python libraries (e.g., PyTorch, CuPy) for JIT compilation.\n# There is no direct Python API exposed by this specific package for end-user import.\n# The following code demonstrates verifying CUDA's availability, which implicitly\n# relies on the correctly installed underlying CUDA runtime components like NVRTC.\n\ntry:\n    import torch\n    print(f\"PyTorch CUDA available: {torch.cuda.is_available()}\")\n    if torch.cuda.is_available():\n        print(f\"PyTorch CUDA version: {torch.version.cuda}\")\n        print(f\"Current CUDA device: {torch.cuda.get_device_name(0)}\")\nexcept ImportError:\n    print(\"PyTorch not installed. Cannot verify CUDA availability via PyTorch.\")\n\ntry:\n    import cupy\n    print(f\"CuPy CUDA available: {cupy.cuda.is_available()}\")\n    if cupy.cuda.is_available():\n        print(f\"CuPy CUDA version: {cupy.cuda.runtime.get_version()}\")\n        print(f\"Current CUDA device: {cupy.cuda.Device(0).name}\")\nexcept ImportError:\n    print(\"CuPy not installed. Cannot verify CUDA availability via CuPy.\")\n\n# A successful installation of nvidia-cuda-nvrtc-cu12 means these libraries\n# are available for use by such frameworks.","lang":"python","description":"The `nvidia-cuda-nvrtc-cu12` package does not expose a direct Python API for end-user import. Instead, it provides the underlying native NVRTC runtime libraries that are consumed by other CUDA-enabled Python frameworks like PyTorch or CuPy. This quickstart demonstrates verifying CUDA's availability using these frameworks, which implicitly confirms that `nvidia-cuda-nvrtc-cu12` is correctly installed as a runtime component. You might need to install `torch` or `cupy` separately (e.g., `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121` or `pip install cupy-cuda12x`).","tag":"draft","tag_description":"notable failures across runtimes","last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":0}]},"compatibility":null}