Sparse Matrix Methods Day 1: Overview Day 2: Direct methods Nonsymmetric systems Graph theoretic tools Sparse LU with partial pivoting Supernodal factorization.

Slides:



Advertisements
Similar presentations
Fill Reduction Algorithm Using Diagonal Markowitz Scheme with Local Symmetrization Patrick Amestoy ENSEEIHT-IRIT, France Xiaoye S. Li Esmond Ng Lawrence.
Advertisements

The CORS method Selecting the roots of a system of polynomial equations with combinatorial optimization H. Bekker E.P. Braad B. Goldengorin University.
Lecture 3 Sparse Direct Method: Combinatorics Xiaoye Sherry Li Lawrence Berkeley National Laboratory, USA crd-legacy.lbl.gov/~xiaoye/G2S3/
ECE 552 Numerical Circuit Analysis Chapter Four SPARSE MATRIX SOLUTION TECHNIQUES Copyright © I. Hajj 2012 All rights reserved.
Siddharth Choudhary.  Refines a visual reconstruction to produce jointly optimal 3D structure and viewing parameters  ‘bundle’ refers to the bundle.
CS 240A: Solving Ax = b in parallel Dense A: Gaussian elimination with partial pivoting (LU) Same flavor as matrix * matrix, but more complicated Sparse.
Department of Electronic Engineering, Tsinghua University Nano-scale Integrated Circuit and System Lab. GPU Sparse LU Factorization and Its Application.
MATH 685/ CSI 700/ OR 682 Lecture Notes
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Sparse Matrices in Matlab John R. Gilbert Xerox Palo Alto Research Center with Cleve Moler (MathWorks) and Rob Schreiber (HP Labs)
Solution of linear system of equations
Symmetric Minimum Priority Ordering for Sparse Unsymmetric Factorization Patrick Amestoy ENSEEIHT-IRIT (Toulouse) Sherry Li LBNL/NERSC (Berkeley) Esmond.
1cs542g-term Notes  Assignment 1 will be out later today (look on the web)
1cs542g-term Notes  Assignment 1 is out (questions?)
1cs542g-term Notes  Assignment 1 is out (due October 5)  Matrix storage: usually column-major.
1cs542g-term Sparse matrix data structure  Typically either Compressed Sparse Row (CSR) or Compressed Sparse Column (CSC) Informally “ia-ja” format.
Lecture 21: Parallel Algorithms
CS 290H: Sparse Matrix Algorithms
1cs542g-term Notes  Note that r 2 log(r) is NaN at r=0: instead smoothly extend to be 0 at r=0  Schedule a make-up lecture?
Symmetric Weighted Matching for Indefinite Systems Iain Duff, RAL and CERFACS John Gilbert, MIT and UC Santa Barbara June 21, 2002.
Avoiding Communication in Sparse Iterative Solvers Erin Carson Nick Knight CS294, Fall 2011.
Sparse Matrix Methods Day 1: Overview Day 2: Direct methods
The Landscape of Ax=b Solvers Direct A = LU Iterative y’ = Ay Non- symmetric Symmetric positive definite More RobustLess Storage (if sparse) More Robust.
High Performance Computing 1 Parallelization Strategies and Load Balancing Some material borrowed from lectures of J. Demmel, UC Berkeley.
CS 240A: Solving Ax = b in parallel °Dense A: Gaussian elimination with partial pivoting Same flavor as matrix * matrix, but more complicated °Sparse A:
Graph Algorithms in Numerical Linear Algebra: Past, Present, and Future John R. Gilbert MIT and UC Santa Barbara September 28, 2002.
Sparse Matrix Methods Day 1: Overview Matlab and examples Data structures Ax=b Sparse matrices and graphs Fill-reducing matrix permutations Matching and.
6/22/2005ICS'20051 Parallel Sparse LU Factorization on Second-class Message Passing Platforms Kai Shen University of Rochester.
CS240A: Conjugate Gradients and the Model Problem.
The Evolution of a Sparse Partial Pivoting Algorithm John R. Gilbert with: Tim Davis, Jim Demmel, Stan Eisenstat, Laura Grigori, Stefan Larimore, Sherry.
Important Problem Types and Fundamental Data Structures
CS 290H Lecture 17 Dulmage-Mendelsohn Theory
Assignment Solving System of Linear Equations Using MPI Phạm Trần Vũ.
Domain decomposition in parallel computing Ashok Srinivasan Florida State University COT 5410 – Spring 2004.
CS 290H Lecture 12 Column intersection graphs, Ordering for sparsity in LU with partial pivoting Read “Computing the block triangular form of a sparse.
MUMPS A Multifrontal Massively Parallel Solver IMPLEMENTATION Distributed multifrontal.
Scalabilities Issues in Sparse Factorization and Triangular Solution Sherry Li Lawrence Berkeley National Laboratory Sparse Days, CERFACS, June 23-24,
TECHNIQUES ALGORITHMS AND SOFTWARE FOR THE DIRECT SOLUTION OF LARGE SPARSE LINEAR EQUATIONS.
Complexity of direct methods n 1/2 n 1/3 2D3D Space (fill): O(n log n)O(n 4/3 ) Time (flops): O(n 3/2 )O(n 2 ) Time and space to solve any problem on any.
Symbolic sparse Gaussian elimination: A = LU
Lecture 5 Parallel Sparse Factorization, Triangular Solution
The Landscape of Sparse Ax=b Solvers Direct A = LU Iterative y’ = Ay Non- symmetric Symmetric positive definite More RobustLess Storage More Robust More.
Amesos Sparse Direct Solver Package Ken Stanley, Rob Hoekstra, Marzio Sala, Tim Davis, Mike Heroux Trilinos Users Group Albuquerque 3 Nov 2004.
Graph Algorithms. Definitions and Representation An undirected graph G is a pair (V,E), where V is a finite set of points called vertices and E is a finite.
CS 290H Lecture 5 Elimination trees Read GLN section 6.6 (next time I’ll assign 6.5 and 6.7) Homework 1 due Thursday 14 Oct by 3pm turnin file1.
 6.2 Pivoting Strategies 1/17 Chapter 6 Direct Methods for Solving Linear Systems -- Pivoting Strategies Example: Solve the linear system using 4-digit.
JAVA AND MATRIX COMPUTATION
Solution of Sparse Linear Systems
Lecture 4 Sparse Factorization: Data-flow Organization
CS240A: Conjugate Gradients and the Model Problem.
Direct Methods for Sparse Linear Systems Lecture 4 Alessandra Nardi Thanks to Prof. Jacob White, Suvranu De, Deepak Ramaswamy, Michal Rewienski, and Karen.
Department of Electronic Engineering, Tsinghua University Nano-scale Integrated Circuit and System Lab. Performance Analysis of Parallel Sparse LU Factorization.
Administrivia: October 5, 2009 Homework 1 due Wednesday Reading in Davis: Skim section 6.1 (the fill bounds will make more sense next week) Read section.
Domain decomposition in parallel computing Ashok Srinivasan Florida State University.
Data Structures and Algorithms in Parallel Computing Lecture 7.
CS 290H Administrivia: May 14, 2008 Course project progress reports due next Wed 21 May. Reading in Saad (second edition): Sections
CS 290H 31 October and 2 November Support graph preconditioners Final projects: Read and present two related papers on a topic not covered in class Or,
CS 290H Lecture 15 GESP concluded Final presentations for survey projects next Tue and Thu 20-minute talk with at least 5 min for questions and discussion.
CS 290H Lecture 9 Left-looking LU with partial pivoting Read “A supernodal approach to sparse partial pivoting” (course reader #4), sections 1 through.
Symmetric-pattern multifrontal factorization T(A) G(A)
Conjugate gradient iteration One matrix-vector multiplication per iteration Two vector dot products per iteration Four n-vectors of working storage x 0.
Lecture 3 Sparse Direct Method: Combinatorics
Power Systems Network and Clique Decomposition
CS 290N / 219: Sparse Matrix Algorithms
Solving Linear Systems Ax=b
CS 290H Administrivia: April 16, 2008
The Landscape of Sparse Ax=b Solvers
CSCE569 Parallel Computing
Read GLN sections 6.1 through 6.4.
Nonsymmetric Gaussian elimination
Presentation transcript:

Sparse Matrix Methods Day 1: Overview Day 2: Direct methods Nonsymmetric systems Graph theoretic tools Sparse LU with partial pivoting Supernodal factorization (SuperLU) Multifrontal factorization (MUMPS) Remarks Day 3: Iterative methods

GEPP: Gaussian elimination w/ partial pivoting PA = LU Sparse, nonsymmetric A Columns may be preordered for sparsity Rows permuted by partial pivoting (maybe) High-performance machines with memory hierarchy = x P

Symmetric Positive Definite: A=R T R Symmetric Positive Definite: A=R T R [Parter, Rose] G(A) G + (A) [chordal] for j = 1 to n add edges between j’s higher-numbered neighbors fill = # edges in G + symmetric

1.Preorder Independent of numerics 2.Symbolic Factorization Elimination tree Nonzero counts Supernodes Nonzero structure of R 3.Numeric Factorization Static data structure Supernodes use BLAS3 to reduce memory traffic 4.Triangular Solves Symmetric Positive Definite: A=R T R O(#flops) O(#nonzeros in R) } O(#nonzeros in A), almost

Modular Left-looking LU Alternatives: Right-looking Markowitz [Duff, Reid,...] Unsymmetric multifrontal [Davis,...] Symmetric-pattern methods [Amestoy, Duff,...] Complications: Pivoting => Interleave symbolic and numeric phases 1.Preorder Columns 2.Symbolic Analysis 3.Numeric and Symbolic Factorization 4.Triangular Solves Lack of symmetry => Lots of issues...

Symmetric A implies G + (A) is chordal, with lots of structure and elegant theory For unsymmetric A, things are not as nice No known way to compute G + (A) faster than Gaussian elimination No fast way to recognize perfect elimination graphs No theory of approximately optimal orderings Directed analogs of elimination tree: Smaller graphs that preserve path structure [Eisenstat, G, Kleitman, Liu, Rose, Tarjan]

Directed Graph A is square, unsymmetric, nonzero diagonal Edges from rows to columns Symmetric permutations PAP T AG(A)

+ Symbolic Gaussian Elimination Symbolic Gaussian Elimination [Rose, Tarjan] Add fill edge a -> b if there is a path from a to b through lower-numbered vertices AG (A) L+U

Structure Prediction for Sparse Solve Given the nonzero structure of b, what is the structure of x? A G(A) xb =  Vertices of G(A) from which there is a path to a vertex of b.

Sparse Triangular Solve = G(L T ) Lxb 1.Symbolic: –Predict structure of x by depth-first search from nonzeros of b 2.Numeric: –Compute values of x in topological order Time = O(flops)

Left-looking Column LU Factorization for column j = 1 to n do solve pivot: swap u jj and an elt of l j scale: l j = l j / u jj Column j of A becomes column j of L and U L 0 L I ( ) ujljujlj = a j for u j, l j L L U A j

GP Algorithm GP Algorithm [G, Peierls; Matlab 4] Left-looking column-by-column factorization Depth-first search to predict structure of each column +: Symbolic cost proportional to flops -: BLAS-1 speed, poor cache reuse -: Symbolic computation still expensive => Prune symbolic representation

Symmetric Pruning Symmetric Pruning [Eisenstat, Liu] Use (just-finished) column j of L to prune earlier columns No column is pruned more than once The pruned graph is the elimination tree if A is symmetric Idea: Depth-first search in a sparser graph with the same path structure Symmetric pruning: Set L sr =0 if L jr U rj  0 Justification: A sk will still fill in r r j j s k = fill = pruned = nonzero

GP-Mod Algorithm GP-Mod Algorithm [Matlab 5-6] Left-looking column-by-column factorization Depth-first search to predict structure of each column Symmetric pruning to reduce symbolic cost +: Symbolic factorization time much less than arithmetic -: BLAS-1 speed, poor cache reuse => Supernodes

Symmetric Supernodes Symmetric Supernodes [Ashcraft, Grimes, Lewis, Peyton, Simon] Supernode-column update: k sparse vector ops become 1 dense triangular solve + 1 dense matrix * vector + 1 sparse vector add Sparse BLAS 1 => Dense BLAS 2 { Supernode = group of (contiguous) factor columns with nested structures Related to clique structure of filled graph G + (A)

Nonsymmetric Supernodes Original matrix A Factors L+U

Supernode-Panel Updates for each panel do Symbolic factorization: which supernodes update the panel; Supernode-panel update: for each updating supernode do for each panel column do supernode-column update; Factorization within panel: use supernode-column algorithm +: “BLAS-2.5” replaces BLAS-1 -: Very big supernodes don’t fit in cache => 2D blocking of supernode-column updates jj+w-1 supernode panel } }

Sequential SuperLU Sequential SuperLU [Demmel, Eisenstat, G, Li, Liu] Depth-first search, symmetric pruning Supernode-panel updates 1D or 2D blocking chosen per supernode Blocking parameters can be tuned to cache architecture Condition estimation, iterative refinement, componentwise error bounds

SuperLU: Relative Performance Speedup over GP column-column 22 matrices: Order 765 to 76480; GP factor time 0.4 sec to 1.7 hr SGI R8000 (1995)

Column Intersection Graph G  (A) = G(A T A) if no cancellation (otherwise  ) Permuting the rows of A does not change G  (A) AG  (A)ATAATA

Filled Column Intersection Graph G  (A) = symbolic Cholesky factor of A T A In PA=LU, G(U)  G  (A) and G(L)  G  (A) Tighter bound on L from symbolic QR Bounds are best possible if A is strong Hall [George, G, Ng, Peyton] A chol (A T A) G  (A)

Column Elimination Tree Elimination tree of A T A (if no cancellation) Depth-first spanning tree of G  (A) Represents column dependencies in various factorizations A chol (A T A) T  (A) +

Column Dependencies in PA = LU If column j modifies column k, then j  T  [k]. [George, Liu, Ng] k j T[k]T[k] If A is strong Hall then, for some pivot sequence, every column modifies its parent in T  (A). [G, Grigori]

Efficient Structure Prediction Given the structure of (unsymmetric) A, one can find... column elimination tree T  (A) row and column counts for G  (A) supernodes of G  (A) nonzero structure of G  (A)... without forming G  (A) or A T A [G, Li, Liu, Ng, Peyton; Matlab] + + +

Shared Memory SuperLU-MT Shared Memory SuperLU-MT [Demmel, G, Li] 1D data layout across processors Dynamic assignment of panel tasks to processors Task tree follows column elimination tree Two sources of parallelism: Independent subtrees Pipelining dependent panel tasks Single processor “BLAS 2.5” SuperLU kernel Good speedup for 8-16 processors Scalability limited by 1D data layout

SuperLU-MT Performance Highlight (1999) 3-D flow calculation (matrix EX11, order 16614):

Column Preordering for Sparsity PAQ T = LU: Q preorders columns for sparsity, P is row pivoting Column permutation of A  Symmetric permutation of A T A (or G  (A)) Symmetric ordering: Approximate minimum degree [Amestoy, Davis, Duff] But, forming A T A is expensive (sometimes bigger than L+U). Solution: ColAMD: ordering A T A with data structures based on A = x P Q

Column AMD Column AMD [Davis, G, Ng, Larimore; Matlab 6] Eliminate “row” nodes of aug(A) first Then eliminate “col” nodes by approximate min degree 4x speed and 1/3 better ordering than Matlab-5 min degree, 2x speed of AMD on A T A Question: Better orderings based on aug(A)? A A ATAT 0 I row col aug(A) G(aug(A))

SuperLU-dist: GE with static pivoting SuperLU-dist: GE with static pivoting [Li, Demmel] Target: Distributed-memory multiprocessors Goal: No pivoting during numeric factorization 1.Permute A unsymmetrically to have large elements on the diagonal (using weighted bipartite matching) 2.Scale rows and columns to equilibrate 3.Permute A symmetrically for sparsity 4.Factor A = LU with no pivoting, fixing up small pivots: if |a ii | < ε · ||A|| then replace a ii by  ε 1/2 · ||A|| 5.Solve for x using the triangular factors: Ly = b, Ux = y 6.Improve solution by iterative refinement

Row permutation for heavy diagonal Row permutation for heavy diagonal [Duff, Koster] Represent A as a weighted, undirected bipartite graph (one node for each row and one node for each column) Find matching (set of independent edges) with maximum product of weights Permute rows to place matching on diagonal Matching algorithm also gives a row and column scaling to make all diag elts =1 and all off-diag elts <= A PA

Iterative refinement to improve solution Iterate: r = b – A*x backerr = max i ( r i / (|A|*|x| + |b|) i ) if backerr lasterr/2 then stop iterating solve L*U*dx = r x = x + dx lasterr = backerr repeat Usually 0 – 3 steps are enough

SuperLU-dist: Distributed static data structure Process (or) mesh L U Block cyclic matrix layout

Question: Preordering for static pivoting Less well understood than symmetric factorization Symmetric: bottom-up, top-down, hybrids Nonsymmetric: top-down just starting to replace bottom-up Symmetric: best ordering is NP-complete, but approximation theory is based on graph partitioning (separators) Nonsymmetric: no approximation theory is known; partitioning is not the whole story

Symmetric-pattern multifrontal factorization T(A) G(A)

Symmetric-pattern multifrontal factorization T(A) G(A) For each node of T from leaves to root: Sum own row/col of A with children’s Update matrices into Frontal matrix Eliminate current variable from Frontal matrix, to get Update matrix Pass Update matrix to parent

Symmetric-pattern multifrontal factorization T(A) G(A) F 1 = A 1 => U 1 For each node of T from leaves to root: Sum own row/col of A with children’s Update matrices into Frontal matrix Eliminate current variable from Frontal matrix, to get Update matrix Pass Update matrix to parent

Symmetric-pattern multifrontal factorization G(A) F 2 = A 2 => U F 1 = A 1 => U 1 For each node of T from leaves to root: Sum own row/col of A with children’s Update matrices into Frontal matrix Eliminate current variable from Frontal matrix, to get Update matrix Pass Update matrix to parent T(A)

Symmetric-pattern multifrontal factorization T(A) G(A) F 2 = A 2 => U F 1 = A 1 => U F 3 = A 3 +U 1 +U 2 => U

Symmetric-pattern multifrontal factorization T(A) G(A) Really uses supernodes, not nodes All arithmetic happens on dense square matrices. Needs extra memory for a stack of pending update matrices Potential parallelism: 1.between independent tree branches 2.parallel dense ops on frontal matrix

MUMPS: distributed-memory multifrontal MUMPS: distributed-memory multifrontal [Amestoy, Duff, L’Excellent, Koster, Tuma] Symmetric-pattern multifrontal factorization Parallelism both from tree and by sharing dense ops Dynamic scheduling of dense op sharing Symmetric preordering For nonsymmetric matrices: optional weighted matching for heavy diagonal expand nonzero pattern to be symmetric numerical pivoting only within supernodes if possible (doesn’t change pattern) failed pivots are passed up the tree in the update matrix

Remarks on (nonsymmetric) direct methods Combinatorial preliminaries are important: ordering, bipartite matching, symbolic factorization, scheduling not well understood in many ways also, mostly not done in parallel Multifrontal tends to be faster but use more memory Unsymmetric-pattern multifrontal: Lots more complicated, not simple elimination tree Sequential and SMP versions in UMFpack and WSMP (see web links) Distributed-memory unsymmetric-pattern multifrontal is a research topic Not mentioned: symmetric indefinite problems Direct-methods technology is also needed in preconditioners for iterative methods