NVIDIA cuSOLVER (CUDA 12)

11.7.5.82 · active · verified Sun Mar 29

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

Install

Imports

Quickstart

This quickstart demonstrates how a higher-level library, CuPy, leverages the underlying cuSOLVER libraries provided by `nvidia-cusolver-cu12`. When installed, `cupy.linalg.solve` and other linear algebra functions can utilize cuSOLVER for GPU-accelerated computations. Ensure CuPy is also installed (`pip install cupy-cuda12x`).

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))

view raw JSON →