Abstract
MPLAPACK (formerly MPACK) provides a comprehensive C++ implementation of the LAPACK library, extending standard linear algebra routines to support multiple floating-point precisions. Based on LAPACK 3.9.1 and translated via the FABLE tool, MPLAPACK 2.0.1 supports formats ranging from standard 64-bit doubles to arbitrary-accuracy libraries like MPFR and GMP. This manual outlines the library's architecture, its support for hardware acceleration via OpenMP and CUDA, and its utility in solving numerically sensitive problems.
Introduction
In numerical computing, the 64-bit double precision (binary64) format is the ubiquitous standard, offering approximately 16 decimal digits of accuracy. While sufficient for many applications, it falls short for "ill-conditioned" problems where small input perturbations lead to significant output errors. Positive Semidefinite Programming (SDP), common in control theory and quantum chemistry, often involves matrices with condition numbers approaching infinity, causing standard double-precision libraries to fail. MPLAPACK addresses this by providing a familiar LAPACK-compatible API that supports extended and arbitrary precision.
Precision Support and Architecture
MPLAPACK was developed by translating the original Fortran 90 LAPACK and BLAS source code into C++ using the FABLE source-to-source conversion tool. To maintain performance and readability, the resulting code underwent manual refinement.
The library achieves precision independence through C++ function overloading and typedefs. This allows a single routine, such as Rgemm, to operate across various formats. Users can select the precision level that best balances computational speed and numerical accuracy.
As shown in the table above, the library supports standard formats (binary64, binary128, FP80), high-speed multi-double formats (double-double and quad-double), and arbitrary-precision formats (GMP and MPFR). The multi-double formats are particularly noteworthy, offering 32 to 64 digits of accuracy while remaining significantly faster than software-emulated binary128 by leveraging hardware-accelerated double precision.
Deployment and Environment
To facilitate ease of use across different research environments, MPLAPACK provides extensive support for various operating systems and compilers. The library is distributed with several Dockerfiles to ensure reproducible builds on common Linux distributions.
The library supports major distributions including CentOS, Ubuntu, and Debian, across both x86_64 (amd64) and AArch64 architectures. While GCC is the primary compiler, specialized versions for Intel oneAPI and NVIDIA CUDA are also provided.
Performance and Hardware Acceleration
A key feature of MPLAPACK 2.0.1 is its support for modern hardware acceleration.
- OpenMP: The MPBLAS routines are parallelized using OpenMP, with performance scaling almost linearly with the number of CPU cores.
- CUDA: For high-performance requirements, the library includes CUDA-enabled versions of double-double routines (
RgemmandRsyrk). On NVIDIA A100 and V100 GPUs, these routines achieve throughputs of 400–600 GFlops.
In practical tests, such as the inversion of highly ill-conditioned Hilbert matrices, MPLAPACK demonstrates extreme numerical stability. By adjusting the MPFR_PRECISION environment variable, users can reduce residual errors to levels as low as $10^{-19728}$, far beyond the capabilities of standard libraries.
Conclusion and Future Work
MPLAPACK 2.0.1 successfully bridges the gap between the robust functionality of LAPACK and the need for high-precision numerical analysis. Future development (Version 3.0) will focus on deeper integration with Python and Octave, and the consolidation of arbitrary-precision support into MPFR due to its superior handling of transcendental functions. Version 4.0 is envisioned as a fully template-based library, further simplifying the integration of new numerical types.
MPLAPACK is open-source and available on GitHub under the 2-clause BSD license.
Summary updated