The nvmath.device module is experimental and potentially subject to future changes.

cuSOLVERDx APIs (nvmath.device)#

Overview#

These APIs offer integration with the NVIDIA cuSOLVERDx library, providing device-level dense matrix factorization and linear solver functions that execute directly within CUDA kernels. Detailed documentation of cuSOLVERDx can be found in the cuSOLVERDx documentation.

Note

The solver device APIs support both the numba-cuda and the numba-cuda-mlir compilers. See Supported Compilers for details.

Architecture#

The nvmath-python cuSOLVERDx API is organized into two layers:

Solver Class: 1:1 C++ Binding

The Solver class provides a direct 1:1 binding to the cuSOLVERDx C++ API, offering complete control over all library features and parameters. This interface allows users to access the flexibility of cuSOLVERDx with Python syntax, maintaining compatibility with the underlying C++ library semantics.

Pythonic Adapters

The API provides several adapter classes to simplify common use cases:

  • CholeskySolver - Specialized for Cholesky factorization and solve operations on symmetric positive definite matrices

  • LUSolver - Specialized for LU factorization without pivoting and solve operations on general matrices

  • LUPivotSolver - Specialized for LU factorization with partial pivoting and solve operations on general matrices

  • QRFactorize - Specialized for QR factorization of general matrices

  • LQFactorize - Specialized for LQ factorization of general matrices

  • QRMultiply - Specialized for multiplication by the unitary matrix Q from a QR factorization

  • LQMultiply - Specialized for multiplication by the unitary matrix Q from an LQ factorization

  • TriangularSolver - Specialized for solve operations on triangular matrices

  • LeastSquaresSolver - Specialized for solving overdetermined or underdetermined least squares problems

Supported Functions#

The following table lists all supported cuSOLVERDx functions with their corresponding Python adapters:

Function

Description

Adapter Class

potrf

Cholesky factorization

CholeskySolver

potrs

Linear system solve after Cholesky factorization

CholeskySolver

posv

Fused Cholesky factorization with solve

Solver

getrf_no_pivot

LU factorization without pivoting

LUSolver

getrs_no_pivot

LU solve without pivoting

LUSolver

gesv_no_pivot

Fused LU factorization (without pivoting) with solve

Solver

getrf_partial_pivot

LU factorization with partial pivoting

LUPivotSolver

getrs_partial_pivot

LU solve with partial pivoting

LUPivotSolver

gesv_partial_pivot

Fused LU factorization (with partial pivoting) with solve

Solver

geqrf

QR factorization

QRFactorize

unmqr

Multiplication of Q from QR factorization

QRMultiply

ungqr [0.3.2]

Unitary matrix Q generation from QR factorization

Solver

gelqf

LQ factorization

LQFactorize

unmlq

Multiplication of Q from LQ factorization

LQMultiply

unglq [0.3.2]

Unitary matrix Q generation from LQ factorization

Solver

trsm

Triangular matrix-matrix solve

TriangularSolver

gels

Overdetermined or underdetermined least squares problems

LeastSquaresSolver

gtsv_no_pivot [0.3.2]

General tridiagonal matrix solve without pivoting

Solver

htev [0.3.2]

Eigenvalue solver for Hermitian tridiagonal matrices

Solver

heev [0.3.2]

Eigenvalue solver for Hermitian dense matrices

Solver

Version Support#

Note

All functionality up to cuSOLVERDx 0.2.1 is fully supported. Functionality from cuSOLVERDx 0.4.0 or later is partially supported.

Functions marked with [0.3.2] require libmathdx 0.3.2 or later and are only accessible through the base Solver class.

API Reference#

Solver(function, size, precision, execution, *)

A class that encapsulates a partial dense matrix factorization and solve device function.

CholeskySolver(size, precision, execution, ...)

A class that encapsulates Cholesky factorization and solve device functions for Hermitian positive definite matrices.

LUSolver(size, precision, execution, *[, ...])

A class that encapsulates cuSOLVERDx LU factorization without pivoting and linear solver for general matrices.

LUPivotSolver(size, precision, execution, *)

A class that encapsulates cuSOLVERDx LU factorization with partial pivoting and linear solver for general matrices.

QRFactorize(size, precision, execution, *[, ...])

A class that encapsulates QR orthogonal factorization device function for general matrices using Householder reflections.

LQFactorize(size, precision, execution, *[, ...])

A class that encapsulates LQ orthogonal factorization device function for general matrices using Householder reflections.

QRMultiply(size, precision, execution, side, *)

A class that encapsulates the multiplication of a matrix C by the unitary matrix Q from a QR factorization (UNMQR operation).

LQMultiply(size, precision, execution, side, *)

A class that encapsulates the multiplication of a matrix C by the unitary matrix Q from an LQ factorization (UNMLQ operation).

TriangularSolver(size, precision, execution, ...)

A class that encapsulates triangular matrix-matrix solve device function ('trsm').

LeastSquaresSolver(size, precision, execution, *)

A class that encapsulates least squares solver device function ('gels').