Karlsruhe Institute of Technology An Error Correction Solver for Linear Systems Evaluation of Mixed Precision Implementations Hartwig Anzt Berkeley, June 23rd 2010 Engineering Mathematics and Computing Lab (EMCL) KIT – University of the State of Baden-Wuerttemberg and www.kit.edu National Research Center of the Helmholtz Association
Numerical Simulation, Optimization and HPC Karlsruhe Institute of Technology Engineering Mathematics and Computing Lab 2/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Numerical Simulation, Optimization and HPC Karlsruhe Institute of Technology Engineering Mathematics and Computing Lab Topics Tools Meteorology and Environment Mathematical Modeling Medicine and Biotechnology FEM-Software Energy Scientific Computing 3/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Numerical Simulation, Optimization and HPC Karlsruhe Institute of Technology Engineering Mathematics and Computing Lab Topics Tools Meteorology and Environment Mathematical Modeling Medicine and Biotechnology FEM-Software Energy Scientific Computing Simulation of Tropical Cyclones Simulation of the Human Respiratory System www.united-airways.eu www.emcl.kit.edu 4/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Computational Fluid Dynamics Karlsruhe Institute of Technology Linear Systems in Fluid Dynamics Partial differential equations model Fluid Flow Problems Discretization methods lead to nonlinear equations systems Linearization methods lead to linear system Ax = b Solving the linear system is often the most time-consuming step in the simulation process. 5/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Acceleration Scenarios Karlsruhe Institute of Technology Computational Effort Acceleration Concepts Characteristics of the linear problem Use of different precision formats Characteristics of the applied solver Use of Coprocessor Technology Used floating point format Parallelization of the linear solvers Fundamental Idea of Mixed Precision Solvers: Acceleration without loss of accuracy High precision only in relevant parts Low precision for most of the algorithm Outsource low precision computations on parallel low precision Coprocessor Use different precision formats within the Iterative Refinement Method 6/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Iterative Refinement Method Karlsruhe Institute of Technology Newton’s Method: x i + 1 = x i − ( ∇ f ( x i )) − 1 f ( x i ) Idea: Apply Newton’s Method to the function f ( x ) = b − Ax 1: initial guess as starting vector: x 0 x i + 1 x i − ( ∇ f ( x i )) − 1 f ( x i ) 2: compute initial residual: r 0 = b − Ax 0 = 3: while ( � Ax i − b � 2 > ε � r 0 � ) do x i − ( − A − 1 )( b − Ax i ) = r i = b − Ax i 4: x i + A − 1 ( b − Ax i ) solve: Ac i = r i = 5: update solution: x i + 1 = x i + c i 6: x i + A − 1 r i = 7: end while � �� � =: c i 7/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Iterative Refinement Method Karlsruhe Institute of Technology Newton’s Method: x i + 1 = x i − ( ∇ f ( x i )) − 1 f ( x i ) Idea: Apply Newton’s Method to the function f ( x ) = b − Ax 1: initial guess as starting vector: x 0 x i + 1 x i − ( ∇ f ( x i )) − 1 f ( x i ) 2: compute initial residual: r 0 = b − Ax 0 = 3: while ( � Ax i − b � 2 > ε � r 0 � ) do x i − ( − A − 1 )( b − Ax i ) = r i = b − Ax i 4: x i + A − 1 ( b − Ax i ) solve: Ac i = r i = 5: update solution: x i + 1 = x i + c i 6: x i + A − 1 r i = 7: end while � �� � =: c i 8/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Iterative Refinement Method Karlsruhe Institute of Technology Newton’s Method: x i + 1 = x i − ( ∇ f ( x i )) − 1 f ( x i ) Idea: Apply Newton’s Method to the function f ( x ) = b − Ax In-Exact Newton Method x i + 1 x i − ( ∇ f ( x i )) − 1 f ( x i ) = Apply iterative method to solve Ac i = r i x i − ( − A − 1 )( b − Ax i ) = x i + A − 1 ( b − Ax i ) = Residual stopping criterion ε inner >> ε x i + A − 1 r i = � �� � E.g. Krylov Subspace Solver =: c i 9/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Mixed Precision Iterative Refinement Karlsruhe Institute of Technology 1: initial guess as starting vector: x 0 2: compute initial residual: r 0 = b − Ax 0 3: while ( � Ax i − b � 2 > ε � r 0 � ) do Any error correction solver can be used r i = b − Ax i 4: solve: Ac i = r i 5: i.e. Krylov Subspace Methods (CG, GMRES ...) update solution: x i + 1 = x i + c i 6: 7: end while Anzt Anzt Compute residual Update Solution C heck Stopping Criterion Set initial Vector Solution Solve error correction equation Anzt Anzt 10/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Mixed Precision Iterative Refinement Karlsruhe Institute of Technology 1: initial guess as starting vector: x 0 2: compute initial residual: r 0 = b − Ax 0 3: while ( � Ax i − b � 2 > ε � r 0 � ) do Any error correction solver can be used r i = b − Ax i 4: solve: Ac i = r i 5: i.e. Krylov Subspace Methods (CG, GMRES ...) update solution: x i + 1 = x i + c i 6: 7: end while Anzt Anzt High Precision Format Compute residual Update Solution Check Stopping Criterion Set initial Vector Solution T ypecast residual into low precision T ypecast solution update into high precision Low Precision Format Solve error correction equation in low precision Anzt Anzt 11/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Numerical Experiments Karlsruhe Institute of Technology Implementation Issues Test Matrices Double precision GMRES-(10) Artificially created Test Matrices on 1 core Increasing dimension Mixed precision GMRES-(10) Fixed Condition Number on 1 core sparse/dense Double precision GMRES-(10) Real Application Test Matrices on 4 cores Discretization of Fluid Flow in Venturi Mixed precision GMRES-(10) Nozzle on 4 cores different dimension, condition Mixed precision GMRES-(10) number, sparsity on NVIDIA TESLA S1070 12/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Motivation Hybrid Mixed Precision Solvers Iterative Refinement Method Numerical Experiments Conclusions Test-Case: Artificial Test Matrices Karlsruhe Institute of Technology M1 M2 M3 H − 1 0 − 1 0 0 · · · · · · . ... ... ... ... . H − 1 − 1 . 10 · n W V ∗ · · · · · · ∗ ∗ · · · ∗ ... ... ... ... ... ... . ... . H 0 0 . . 10 · n V W V ∗ . . . ... ... ... ... . . . ... ... ... . 0 − 1 . 10 · n . V W . . ∗ ∗ . ... . . . ... ... ... ... ... − 1 . . . V . ∗ . ... ... ... 10 · n V W ∗ · · · · · · ∗ ∗ · · · ∗ 0 0 . ... ... ... ... . H . − 1 H 0 0 − 1 0 − 1 · · · · · · problem: artificial matrix problem: artificial matrix problem: artificial matrix problem size: variable problem size: variable problem size: variable sparsity: nnz = n 2 sparsity: nnz = n 2 sparsity: nnz = 5 n cond. number: κ ≈ 8 · 10 3 cond. number: κ ≈ 8 · 10 3 cond. number: κ < 3 storage format: MAS storage format: MAS storage format: CRS 13/23 Berkeley, June 23rd 2010 Hartwig Anzt - An Error Correction Solver for Linear Systems
Recommend
More recommend