NVIDIA cuSOLVER (CUDA 12)
The `nvidia-cusolver-cu12` package provides the native runtime libraries for NVIDIA's cuSOLVER, a collection of GPU-accelerated dense and sparse direct linear solvers and Eigen solvers. It is part of the NVIDIA CUDA Toolkit and is designed to be consumed by higher-level Python libraries such as CuPy, PyTorch, and TensorFlow for dynamically loading CUDA libraries. The current version is 11.7.5.82, and its release cadence typically follows major and minor updates of the CUDA Toolkit.
Warnings
- gotcha The `nvidia-cusolver-cu12` package primarily provides native shared libraries and is not intended for direct Python import and use of symbols. Its functionality is exposed indirectly through other high-level Python libraries like CuPy, PyTorch, or TensorFlow.
- breaking The `cu12` suffix in the package name signifies compatibility with CUDA Toolkit 12.x. Installing this package with an incompatible CUDA Toolkit, GPU driver, or older GPU architecture can lead to runtime errors or performance issues.
- gotcha Pip's dependency resolver can struggle with the complex interdependencies among `nvidia-*` packages, leading to slow resolution times or conflicts.
- deprecated Certain cuSOLVER APIs, particularly within the `cuSOLVERMg` (multi-GPU) and some `cuSOLVERSp` (sparse) modules, have been deprecated in recent CUDA Toolkit versions.
Install
-
pip install nvidia-cusolver-cu12
Imports
- N/A
This package provides native shared libraries (e.g., .so, .dll) for cuSOLVER.
Quickstart
import cupy as cp
# This example uses CuPy, which dynamically loads cuSOLVER routines
# via packages like nvidia-cusolver-cu12 if available.
# Create a random positive definite matrix A and a vector b on the GPU
A = cp.random.rand(5, 5, dtype=cp.float64)
A = A @ A.T + cp.identity(5) # Make it symmetric positive definite
b = cp.random.rand(5, dtype=cp.float64)
# Solve the linear system Ax = b using CuPy's linalg.solve
# CuPy internally dispatches to cuSOLVER routines for this operation.
x = cp.linalg.solve(A, b)
print("Matrix A:\n", A)
print("Vector b:\n", b)
print("Solution x:\n", x)
# Verify the solution (A @ x - b should be close to zero)
print("Verification (A @ x - b):\n", A @ x - b)
print("Norm of residual (should be close to zero):", cp.linalg.norm(A @ x - b))