MPLAPACK version 2.0.1 user manual

Maho Nakata

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.

Supported precision libraries, associated C++ types, and their decimal digit 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.

Supported Docker environments and build configurations for MPLAPACK.

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 (Rgemm and Rsyrk). 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

Abstract

The MPLAPACK (formerly MPACK) is a multiple-precision version of LAPACK (https://www.netlib.org/lapack/). MPLAPACK version 2.0.1 is based on LAPACK version 3.9.1 and translated from Fortran 90 to C++ using FABLE, a Fortran to C++ source-to-source conversion tool (https://github.com/cctbx/cctbx_project/tree/master/fable/). MPLAPACK version 2.0.1 provides the real and complex version of MPBLAS, and the real and complex versions of MPLAPACK support all LAPACK features: solvers for systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems, and related matrix factorizations except for mixed-precision routines. The MPLAPACK defines an API for numerical linear algebra, similar to LAPACK. It is easy to port legacy C/C++ numerical codes using MPLAPACK. MPLAPACK supports binary64, binary128, FP80 (extended double), MPFR, GMP, and QD libraries (double-double and quad-double). Users can choose MPFR or GMP for arbitrary accurate calculations, double-double or quad-double for fast 32 or 64-decimal calculations. We can consider the binary64 version as the C++ version of LAPACK. Moreover, it comes with an OpenMP accelerated version of MPBLAS for some routines and CUDA (A100 and V100 support) for double-double versions of Rgemm and Rsyrk. The peak performances of the OpenMP version are almost proportional to the number of cores, and the performances of the CUDA version are impressive, and approximately 400-600 GFlops. MPLAPACK is available at GitHub (https://github.com/nakatamaho/mplapack/) under the 2-clause BSD license.
BibTeX
@misc{nakata2021mplapack,
  author = {Maho Nakata},
  title = {{MPLAPACK version 2.0.1 user manual}},
  year = {2021},
  eprint = {2109.13406},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2109.13406},
}
Figure