Squeezing a Matrix into Half Precision, with an Application to Solving Linear Systems

Type: Article

Publication Date: 2019-01-01

Citations: 62

DOI: https://doi.org/10.1137/18m1229511

Abstract

Motivated by the demand in machine learning, modern computer hardware is increasingly supporting reduced precision floating-point arithmetic, which provides advantages in speed, energy, and memory usage over single and double precision. Given the availability of such hardware, mixed precision algorithms that work in single or double precision but carry out part of a computation in half precision are now of great interest for general scientific computing tasks. Because of the limited range of half precision arithmetic, in which positive numbers lie between $6\times 10^{-8}$ and $7\times 10^4$, a straightforward rounding of single or double precision data into half precision can lead to overflow, underflow, or subnormal numbers being generated, all of which are undesirable. We develop an algorithm for converting a matrix from single or double precision to half precision. It first applies two-sided diagonal scaling in order to equilibrate the matrix (that is, to ensure that every row and column has $\infty$-norm $1$), then multiplies by a scalar to bring the largest element within a factor $\theta \le 1$ of the overflow level, and finally rounds to half precision. The second step ensures that full use is made of the limited range of half precision arithmetic, and $\theta$ must be chosen to allow sufficient headroom for subsequent computations. We apply the new algorithm to GMRES-based iterative refinement (GMRES-IR), which solves a linear system $Ax = b$ with single or double precision data by LU factorizing $A$ in half precision and carrying out iterative refinement with the correction equations solved by GMRES preconditioned with the low precision LU factors. Previous implementations of this algorithm have used a crude conversion to half precision that our experiments show can cause slow convergence of GMRES-IR for badly scaled matrices or failure to converge at all. The new conversion algorithm computes $\infty$-norms of rows and columns of the matrix and its cost is negligible in the context of LU factorization. We show that it leads to faster convergence of GMRES-IR for badly scaled matrices and thereby allows a much wider class of problems to be solved.

Locations

  • SIAM Journal on Scientific Computing - View - PDF
  • MIMS EPrints (University of Southampton) - View - PDF

Similar Works

Action Title Year Authors
+ PDF Chat Avoiding breakdown in incomplete factorizations in low precision arithmetic 2024 J. A. Scott
Miroslav TĆŻma
+ PDF Chat Avoiding breakdown in incomplete factorizations in low precision arithmetic 2024 J. A. Scott
Miroslav TĆŻma
+ Peer Review #1 of "Performance impact of precision reduction in sparse linear systems solvers (v0.1)" 2022 Nicholas J. Higham
Craig Lucas
Françoise Tisseur
Mawussi Zounon
+ Peer Review #1 of "Performance impact of precision reduction in sparse linear systems solvers (v0.2)" 2022 Nicholas J. Higham
Craig Lucas
Françoise Tisseur
Mawussi Zounon
+ Peer Review #2 of "Performance impact of precision reduction in sparse linear systems solvers (v0.1)" 2022 Takeshi Nanri
+ Peer Review #2 of "Performance impact of precision reduction in sparse linear systems solvers (v0.2)" 2022 Takeshi Nanri
+ PDF Chat A note on incomplete Cholesky factorizations in half precision arithmetic 2024 J. A. Scott
Miroslav TĆŻma
+ Mixed Precision GMRES-based Iterative Refinement with Recycling 2022 Eda Oktay
Erin Carson
+ Performance Evaluation of Mixed Precision Algorithms for Solving Sparse Linear Systems 2020 Mawussi Zounon
Nicholas J. Higham
Craig Lucas
Françoise Tisseur
+ PDF Chat Solution of Dense Linear Systems via Roundoff-Error-Free Factorization Algorithms 2018 Adolfo R. Escobedo
Erick Moreno‐Centeno
Christopher Lourenco
+ The Rise of Multiprecision Arithmetic 2017 Nicholas J. Higham
+ Improving the Performance of the GMRES Method using Mixed-Precision Techniques 2020 Neil Lindquist
Piotr Ɓuszczek
Jack Dongarra
+ Improving the Performance of the GMRES Method using Mixed-Precision Techniques 2020 Neil Lindquist
Piotr Ɓuszczek
Jack Dongarra
+ PDF Chat Iterative Refinement with Low-Precision Posits 2024 James Quinlan
E. Theodore L. Omtzigt
+ Optimal Solutions of Well-Posed Linear Systems via Low-Precision Right-Preconditioned GMRES with Forward and Backward Stabilization 2023 Xiangmin Jiao
+ PDF Chat Mixed precision low-rank approximations and their application to block low-rank LU factorization 2022 Patrick Amestoy
Olivier Boiteau
Alfredo Buttari
Matthieu Gerest
Fabienne Jézéquel
Jean-Yves L’Excellent
Théo Mary
+ A Survey of Numerical Methods Utilizing Mixed Precision Arithmetic 2020 Ahmad Abdelfattah
Hartwig Anzt
Erik G. Boman
Erin Carson
Terry Cojean
Jack Dongarra
Mark Gates
Thomas GrĂŒtzmacher
Nicholas J. Higham
Xiaoye Sherry Li
+ Obtaining Pseudo-inverse Solutions With MINRES 2023 Yang Liu
Andre Milzarek
Fred Roosta
+ Two New Block Krylov Methods for Linear Systems with Multiple Right-hand Sides 2016 Yan‐Fei Jing
Emmanuel Agullo
Bruno Carpentieri
Luc Giraud
Ting‐Zhu Huang
+ A Survey of Numerical Methods Utilizing Mixed Precision Arithmetic 2020 Ahmad Abdelfattah
Hartwig Anzt
Erik G. Boman
Erin Carson
Terry Cojean
Jack Dongarra
Mark Gates
Thomas GrĂŒtzmacher
Nicholas J. Higham
Xiaoye Sherry Li