Linear Algebra#
Overview#
The Linear Algebra module nvmath. in nvmath-python leverages various NVIDIA
math libraries to support dense [1] linear algebra computations. As of version 0.7.0, we
offer both a generic matrix multiplication API based on the cuBLAS and NVPL libraries and a
specialized matrix multiplication API (nvmath.) based on the cuBLASLt
library. See Generic and Specialized APIs for motivation.
At a high-level, if your use case is predominantly GEMM and requires particular flexibility in matrix data layouts, input and/or compute types, and also in choosing the algorithmic implementation, look at the specialized APIs. Otherwise, look at the generic APIs.
API Reference#
Generic Linear Algebra APIs (nvmath. linalg)#
The generic linear algebra module includes matrix multiplication APIs which accept structured matrices as input, but do not allow for control over computational precision or algorithm selection and planning.
|
Perform the specified matrix multiplication computation \(\alpha a @ b + \beta c\). |
|
Create a stateful object encapsulating the specified matrix multiplication computation \(\alpha a @ b + \beta c\) and the required resources to perform the operation. |
A NumPy custom dtype which describes a structured matrix. |
|
A class which constructs and validates |
|
A class which constructs and validates |
|
A class which constructs and validates |
|
A class which constructs and validates |
|
A class which constructs and validates |
|
|
A data class for providing CPU execution options. |
|
A data class for providing GPU execution options. |
|
A dataclass for providing options to a |
Specialized Linear Algebra APIs (nvmath. linalg. advanced)#
The specialized linear algebra module includes a matrix multiplication API which only accepts general matrices, but provides extra functionality such as epilog functions, more options and controls over computational precision, and control over algorithm selection and planning.
|
Perform the specified matrix multiplication computation \(F(\alpha a @ b + \beta c)\), where \(F\) is the epilog. |
NumPy dtype object that encapsulates the matrix qualifiers in linalg.advanced. |
|
|
An interface class to query algorithm capabilities and configure the algorithm. |
|
Create a stateful object encapsulating the specified matrix multiplication computation \(\alpha a @ b + \beta c\) and the required resources to perform the operation. |
alias of |
|
alias of |
|
|
See |
|
These flags can be combined with the | operator: OP_TYPE_FMA | OP_TYPE_TENSOR_HMMA ... |
alias of |
|
|
A data class for providing epilog options as part of |
|
A data class for providing options to the |
|
A data class for providing options to the |
|
A data class for providing quantization_scales to |
Helpers#
The Specialized Linear Algebra helpers module nvmath.
provides helper functions to facilitate working with some of the complex features of
nvmath. module.
Matmul helpers (nvmath. linalg. advanced. helpers. matmul)#
|
Create MXFP8 block scale with the same value for the whole tensor |
|
Compute a reciprocal of MXFP8 block scale. |
|
Apply MXFP8 block scale factors to tensor |
|
Computes the offset of MXFP8 scale used for element |
Footnotes