NVIDIA libmathdx Documentation#
libmathdx is a host runtime code-generation library built on top of
libmathdx can be downloaded from here: Download page.
Note
libmathdx is currently in alpha. APIs may change at any time and no guarantees are made when it comes to backward and forward compatibility.
What is it?#
libmathdx is a host library that lets users generate, at runtime, device code that exposes device functions. Those device functions implement matrix-multiply and fast copies across memory spaces (with cuBLASDx), fast Fourier transforms (with cuFFTDx), linear algebra operations (with cuSolverDx), random number generation (with cuRANDDx) and data compression/decompression (with nvCOMPDx).
Supported functionality#
At this time, the supported functionality includes:
cuBLASDx
Matrix-multiplication (with “pointer APIs” and “tensor APIs”)
Basic and “suggested” (optimized) layouts in shared memory and registers
Copy operations to and from global memory, shared memory and registers
Pipeline APIs
cuFFTDx
All functionalities, except FFTs requiring global memory workspace (“Bluestein”)
cuSolverDx
Cholesky, LU, QR and LQ factorization and solve
TRSM (triangular-solve with matrix right-hand-side)
Tridiagonal solve (GTSV, no pivoting)
Eigensolvers (HEEV, HTEV)
Least-squares (GELS)
Orthogonal/unitary factor generation (UNGQR, UNGLQ)
cuRANDDx
All functionalities
nvCOMPDx
LZ4 and ANS compression/decompression
Warp-level and block-level execution
Versioning#
libmathdx integrates specific MathDx components, as described below.
libmathdx |
cuBLASDx |
cuFFTDx |
cuSolverDx |
cuRANDDx |
nvCOMPDx |
|---|---|---|---|---|---|
0.2.0 |
0.3.1 |
1.3.1 |
0.1.1 |
Not available |
Not available |
0.2.1 |
0.4.0 |
1.5.0 |
0.2.0 |
Not available |
Not available |
0.2.2 |
0.4.0 |
1.5.0 |
0.2.0 |
Not available |
Not available |
0.2.3 |
0.4.1 |
1.5.1 |
0.2.1 |
Not available |
Not available |
0.3.0 |
0.5.0 |
1.6.0 |
0.3.0 |
0.2.0 |
Not available |
0.3.1 |
0.5.1 |
1.6.1 |
0.3.0 |
0.2.2 |
Not available |
0.3.2 |
0.6.0 |
1.7.0 |
0.4.0 |
0.2.3 |
Not available |
0.4.0 |
0.7.0 |
1.7.1 |
0.5.0 |
0.2.4 |
0.1.4 |
0.4.1 |
0.7.1 |
1.7.3 |
0.5.0 |
0.2.4 |
0.1.4 |
Requirements#
CUDA Toolkit — the current libmathdx release works with CUDA Toolkit 13.X and produces code (LTOIR) that can be consumed by the CUDA 13.X toolchain. CUDA Toolkit 12.X support was dropped after libmathdx 0.3.1, which is the last release to support it.
NVRTC — requires NVRTC 13.X.
GPU architecture — supports GPUs starting with compute-capability 7.5 (Turing) up to the most recent GPUs. Compute-capability 7.0 (Volta) support was dropped after libmathdx 0.3.1, which is the last release to support it.
How to use libmathdx?#
See the How to use libmathdx? page for the end-to-end workflow: locating libmathdx from CMake, the pointer and opaque-tensor APIs, the common code-generation workflow, and how to call the generated device functions (API & ABI). The per-library reference pages below document the operators, traits, and examples for each domain.
API reference & examples#
Open source licenses#
Some of the libmathdx routines were written by or derived from code written by Meta Platforms, Inc. and affiliates and are subject to the BSD License as follows:
BSD License For Zstandard software Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution
Neither the name Facebook, nor Meta, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Some of the libmathdx routines were written by or derived from code written by Victor Zverovich and are subject to the following license:
Copyright (c) 2012 - present, Victor Zverovich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
—Optional exception to the license —
As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into a machine-executable object form of such source code, you may redistribute such embedded portions in such object form without including the above copyright and permission notices.