NVIDIA JIT LTO Library (CUDA 12)
The `nvidia-nvjitlink-cu12` package is a metapackage that facilitates the installation of the NVIDIA JIT LTO (Just-In-Time Link Time Optimization) library, `nvJitLink`, as part of the CUDA Toolkit for CUDA 12.x environments. It ensures the presence of the native C-based `nvJitLink` library, which is used by other Python libraries like CuPy and Numba-CUDA for advanced GPU code compilation and linking at runtime. This package itself does not expose direct Python APIs for JIT linking. The current version is 12.9.86, and it follows the CUDA Toolkit's release cadence.
Warnings
- gotcha This package `nvidia-nvjitlink-cu12` is a *metapackage* for a native C library (`nvJitLink`) and part of the CUDA Toolkit. It does not provide direct Python APIs for JIT linking functionality. Python users typically interact with `nvJitLink` through higher-level libraries like `pynvjitlink-cu12`, `Numba-CUDA`, or `CuPy` that are built to utilize it.
- breaking The `nvJitLink` library has compatibility constraints regarding linking objects across different CUDA major versions, especially for LTO-IR (Link Time Optimization Intermediate Representation) inputs. Linking across major versions (e.g., CUDA 11.x with 12.x) may not work for LTO-IR inputs, although it generally works for ELF and PTX inputs.
- gotcha Installation of `nvidia-nvjitlink-cu12` from PyPI typically requires a pre-existing CUDA driver, even if it aims to install CUDA runtime components. For full development capabilities, a system-wide CUDA Toolkit installation is often still necessary as these pip wheels primarily provide runtime components and may not include developer tools (like `nvcc`).
- deprecated The `cuLink*` APIs in the CUDA Driver, which provided similar functionality to `nvJitLink`, have been deprecated for use with LTO-IR. `nvJitLink` is the recommended path for JIT LTO.
Install
-
pip install nvidia-nvjitlink-cu12 -
pip install --extra-index-url https://pypi.nvidia.com nvidia-pyindex pip install nvidia-nvjitlink-cu12
Imports
- None
This package primarily installs native libraries; direct Python imports for JIT linking functionality are not typically made from `nvidia-nvjitlink-cu12`. Higher-level libraries like `pynvjitlink-cu12`, `numba.cuda`, or `cupy` provide the Python interfaces that utilize the installed `nvJitLink` library.
Quickstart
import os
try:
import cupy as cp
print(f"CuPy is installed. CUDA available: {cp.cuda.is_available()}")
if cp.cuda.is_available():
print(f"CuPy CUDA Device Count: {cp.cuda.runtime.getDeviceCount()}")
except ImportError:
print("CuPy not installed. Install with `pip install cupy-cuda12x` to verify CUDA environment.")
try:
import numba.cuda
print(f"Numba CUDA is installed. CUDA available: {numba.cuda.is_available()}")
if numba.cuda.is_available():
print(f"Numba CUDA Device Count: {numba.cuda.count_devices()}")
except ImportError:
print("Numba-CUDA not installed. Install with `pip install numba-cuda` to verify CUDA environment.")
print("\nThis output indicates whether higher-level Python libraries can detect and use the CUDA environment, which includes the nvJitLink library provided by nvidia-nvjitlink-cu12.")