Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.

Slides:



Advertisements
Similar presentations
Parallel Jacobi Algorithm Steven Dong Applied Mathematics.
Advertisements

CSCI-455/552 Introduction to High Performance Computing Lecture 25.
Dense Matrix Algorithms. Topic Overview Matrix-Vector Multiplication Matrix-Matrix Multiplication Solving a System of Linear Equations.
Algebraic, transcendental (i.e., involving trigonometric and exponential functions), ordinary differential equations, or partial differential equations...
Parallel Programming in C with MPI and OpenMP
Numerical Algorithms ITCS 4/5145 Parallel Computing UNC-Charlotte, B. Wilkinson, 2009.
MATH 685/ CSI 700/ OR 682 Lecture Notes
Solving Linear Systems (Numerical Recipes, Chap 2)
SOLVING SYSTEMS OF LINEAR EQUATIONS. Overview A matrix consists of a rectangular array of elements represented by a single symbol (example: [A]). An individual.
CISE301_Topic3KFUPM1 SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17: KFUPM Read Chapter 9 of the textbook.
Rayan Alsemmeri Amseena Mansoor. LINEAR SYSTEMS Jacobi method is used to solve linear systems of the form Ax=b, where A is the square and invertible.
Numerical Algorithms Matrix multiplication
Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Part 3 Chapter 9 Gauss Elimination
Solution of linear system of equations
Chapter 9 Gauss Elimination The Islamic University of Gaza
Numerical Algorithms • Matrix multiplication
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Lecture 6 Objectives Communication Complexity Analysis Collective Operations –Reduction –Binomial Trees –Gather and Scatter Operations Review Communication.
Sparse Matrix Algorithms CS 524 – High-Performance Computing.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming with MPI and OpenMP Michael J. Quinn.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 8 Matrix-vector Multiplication.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
1/26 Design of parallel algorithms Linear equations Jari Porras.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Design of parallel algorithms Matrix operations J. Porras.
Dense Matrix Algorithms CS 524 – High-Performance Computing.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Monica Garika Chandana Guduru. METHODS TO SOLVE LINEAR SYSTEMS Direct methods Gaussian elimination method LU method for factorization Simplex method of.
Chapter 13 Finite Difference Methods: Outline Solving ordinary and partial differential equations Finite difference methods (FDM) vs Finite Element Methods.
Today Objectives Chapter 6 of Quinn Creating 2-D arrays Thinking about “grain size” Introducing point-to-point communications Reading and printing 2-D.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Linear Algebraic Equations ~ Gauss Elimination Chapter.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Assignment Solving System of Linear Equations Using MPI Phạm Trần Vũ.
Exercise problems for students taking the Programming Parallel Computers course. Janusz Kowalik Piotr Arlukowicz Tadeusz Puzniakowski Informatics Institute.
Parallel Programming in C with MPI and OpenMP
Eigenvalue Problems Solving linear systems Ax = b is one part of numerical linear algebra, and involves manipulating the rows of a matrix. The second main.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Solving Scalar Linear Systems Iterative approach Lecture 15 MA/CS 471 Fall 2003.
1 Iterative Solution Methods Starts with an initial approximation for the solution vector (x 0 ) At each iteration updates the x vector by using the sytem.
Chapter 3 Parallel Algorithm Design. Outline Task/channel model Task/channel model Algorithm design methodology Algorithm design methodology Case studies.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
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.
Chapter 3 Solution of Algebraic Equations 1 ChE 401: Computational Techniques for Chemical Engineers Fall 2009/2010 DRAFT SLIDES.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Lecture 7 - Systems of Equations CVEN 302 June 17, 2002.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3 - Chapter 9 Linear Systems of Equations: Gauss Elimination.
Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Direct Methods for Linear Systems Lecture 3 Alessandra Nardi Thanks to Prof. Jacob White, Suvranu De, Deepak Ramaswamy, Michal Rewienski, and Karen Veroy.
Chapter 9 Gauss Elimination The Islamic University of Gaza
Dense Linear Algebra Sathish Vadhiyar. Gaussian Elimination - Review Version 1 for each column i zero it out below the diagonal by adding multiples of.
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Linear Systems Dinesh A.
Lecture 3: Today’s topics MPI Broadcast (Quinn Chapter 5) –Sieve of Eratosthenes MPI Send and Receive calls (Quinn Chapter 6) –Floyd’s algorithm Other.
Unit #1 Linear Systems Fall Dr. Jehad Al Dallal.
1 Numerical Methods Solution of Systems of Linear Equations.
Part 3 Chapter 9 Gauss Elimination
Linear Equations.
Parallel Programming in C with MPI and OpenMP
Parallel Programming with MPI and OpenMP
Numerical Algorithms • Parallelizing matrix multiplication
CSCE569 Parallel Computing
Parallel Programming in C with MPI and OpenMP
CSCE569 Parallel Computing
To accompany the text “Introduction to Parallel Computing”,
Parallel Programming in C with MPI and OpenMP
Presentation transcript:

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 12 Solving Linear Systems

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Outline Terminology Terminology Back substitution Back substitution Gaussian elimination Gaussian elimination Jacobi method Jacobi method Conjugate gradient method Conjugate gradient method

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Terminology System of linear equations System of linear equations  Solve Ax = b for x Special matrices Special matrices  Symmetrically banded  Upper triangular  Lower triangular  Diagonally dominant  Symmetric

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Symmetrically Banded Semibandwidth 2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Upper Triangular

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Lower Triangular

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Diagonally Dominant

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Symmetric

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution Used to solve upper triangular system Tx = b for x Used to solve upper triangular system Tx = b for x Methodology: one element of x can be immediately computed Methodology: one element of x can be immediately computed Use this value to simplify system, revealing another element that can be immediately computed Use this value to simplify system, revealing another element that can be immediately computed Repeat Repeat

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution 1x01x0 +1x 1 –1x2–1x2 +4x 3 8= – 2x 1 –3x2–3x2 +1x 3 5= 2x22x2 – 3x 3 0= 2x32x3 4=

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution 1x01x0 +1x 1 –1x2–1x2 +4x 3 8= – 2x 1 –3x2–3x2 +1x 3 5= 2x22x2 – 3x 3 0= 2x32x3 4= x 3 = 2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution 1x01x0 +1x 1 –1x2–1x2 0= – 2x 1 –3x2–3x2 3= 2x22x2 6= 2x32x3 4=

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution 1x01x0 +1x 1 –1x2–1x2 0= – 2x 1 –3x2–3x2 3= 2x22x2 6= 2x32x3 4= x 2 = 3

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution 1x01x0 +1x 1 3= – 2x 1 12= 2x22x2 6= 2x32x3 4=

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution 1x01x0 +1x 1 3= – 2x 1 12= 2x22x2 6= 2x32x3 4= x 1 = –6

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution 1x01x0 9= – 2x 1 12= 2x22x2 6= 2x32x3 4=

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Back Substitution 1x01x0 9= – 2x 1 12= 2x22x2 6= 2x32x3 4= x 0 = 9

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Pseudocode for i  n  1 down to 1 do x [ i ]  b [ i ] / a [ i, i ] for j  0 to i  1 do b [ j ]  b [ j ]  x [ i ] × a [ j, i ] endfor Time complexity:  (n 2 )

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Data Dependence Diagram We cannot execute the outer loop in parallel. We can execute the inner loop in parallel.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Row-oriented Algorithm Associate primitive task with each row of A and corresponding elements of x and b Associate primitive task with each row of A and corresponding elements of x and b During iteration i task associated with row j computes new value of b j During iteration i task associated with row j computes new value of b j Task i must compute x i and broadcast its value Task i must compute x i and broadcast its value Agglomerate using rowwise interleaved striped decomposition Agglomerate using rowwise interleaved striped decomposition

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Interleaved Decompositions Rowwise interleaved striped decomposition Columnwise interleaved striped decomposition

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Complexity Analysis Each process performs about n / (2p) iterations of loop j in all Each process performs about n / (2p) iterations of loop j in all A total of n -1 iterations in all A total of n -1 iterations in all Computational complexity:  (n 2 /p) Computational complexity:  (n 2 /p) One broadcast per iteration One broadcast per iteration Communication complexity:  (n log p) Communication complexity:  (n log p)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Column-oriented Algorithm Associate one primitive task per column of A and associated element of x Associate one primitive task per column of A and associated element of x Last task starts with vector b Last task starts with vector b During iteration i task i computes x i, updates b, and sends b to task i -1 During iteration i task i computes x i, updates b, and sends b to task i -1 In other words, no computational concurrency In other words, no computational concurrency Agglomerate tasks in interleaved fashion Agglomerate tasks in interleaved fashion

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Complexity Analysis Since b always updated by a single process, computational complexity same as sequential algorithm:  (n 2 ) Since b always updated by a single process, computational complexity same as sequential algorithm:  (n 2 ) Since elements of b passed from one process to another each iteration, communication complexity is  (n 2 ) Since elements of b passed from one process to another each iteration, communication complexity is  (n 2 )

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Comparison Message- passing time dominates Computation time dominates

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Gaussian Elimination Used to solve Ax = b when A is dense Used to solve Ax = b when A is dense Reduces Ax = b to upper triangular system Tx = c Reduces Ax = b to upper triangular system Tx = c Back substitution can then solve Tx = c for x Back substitution can then solve Tx = c for x

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Gaussian Elimination 4x04x0 +6x 1 +2x 2 – 2x 3 =8 2x02x0 +5x 2 – 2x 3 =4 –4x0–4x0 – 3x 1 – 5x 2 +4x 3 =1 8x08x0 +18x 1 – 2x 2 +3x 3 =40

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Gaussian Elimination 4x04x0 +6x 1 +2x 2 – 2x 3 =8 +4x 2 – 1x 3 =0 +3x 1 – 3x 2 +2x 3 =9 +6x 1 – 6x 2 +7x 3 =24 – 3x 1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Gaussian Elimination 4x04x0 +6x 1 +2x 2 – 2x 3 =8 +4x 2 – 1x 3 =0 1x21x2 +1x 3 =9 2x22x2 +5x 3 =24 – 3x 1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Gaussian Elimination 4x04x0 +6x 1 +2x 2 – 2x 3 =8 +4x 2 – 1x 3 =0 1x21x2 +1x 3 =9 3x33x3 =6 – 3x 1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Iteration of Gaussian Elimination

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Numerical Stability Issues If pivot element close to zero, significant roundoff errors can result If pivot element close to zero, significant roundoff errors can result Gaussian elimination with partial pivoting eliminates this problem Gaussian elimination with partial pivoting eliminates this problem In step i we search rows i through n-1 for the row whose column i element has the largest absolute value In step i we search rows i through n-1 for the row whose column i element has the largest absolute value Swap (pivot) this row with row i Swap (pivot) this row with row i

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Implementing Partial Pivoting Without partial pivotingWith partial pivoting

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Row-oriented Parallel Algorithm Associate primitive task with each row of A and corresponding elements of x and b Associate primitive task with each row of A and corresponding elements of x and b A kind of reduction needed to find the identity of the pivot row A kind of reduction needed to find the identity of the pivot row Tournament: want to determine identity of row with largest value, rather than largest value itself Tournament: want to determine identity of row with largest value, rather than largest value itself Could be done with two all-reductions Could be done with two all-reductions MPI provides a simpler, faster mechanism MPI provides a simpler, faster mechanism

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. MPI_MAXLOC, MPI_MINLOC MPI provides reduction operators MPI_MAXLOC, MPI_MINLOC MPI provides reduction operators MPI_MAXLOC, MPI_MINLOC Provide datatype representing a (value, index) pair Provide datatype representing a (value, index) pair

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. MPI (value,index) Datatypes MPI_DatatypeMeaning MPI_2INT Two ints MPI_DOUBLE_INT A double followed by an int MPI_FLOAT_INT A float followed by an int MPI_LONG_INT A long followed by an int MPI_LONG_DOUBLE_INT A long double followed by an int MPI_SHORT_INT A short followed by an int

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example Use of MPI_MAXLOC struct { double value; int index; } local, global;... local.value = fabs(a[j][i]); local.index = j;... MPI_Allreduce (&local, &global, 1, MPI_DOUBLE_INT, MPI_MAXLOC, MPI_COMM_WORLD);

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Second Communication per Iteration

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Complexity Complexity of tournament:  (log p) Complexity of tournament:  (log p) Complexity of broadcasting pivot row:  (n log p) Complexity of broadcasting pivot row:  (n log p) A total of n - 1 iterations A total of n - 1 iterations Overall communication complexity:  (n 2 log p) Overall communication complexity:  (n 2 log p)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Isoefficiency Analysis Communication overhead:  (n 2 p log p) Communication overhead:  (n 2 p log p) Sequential algorithm has time complexity  (n 3 ) Sequential algorithm has time complexity  (n 3 ) Isoefficiency relation n 3  Cn 2 p log p  n  C p log p Isoefficiency relation n 3  Cn 2 p log p  n  C p log p This system has poor scalability This system has poor scalability

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Column-oriented Algorithm Associate a primitive task with each column of A and another primitive task for b Associate a primitive task with each column of A and another primitive task for b During iteration i task controlling column i determines pivot row and broadcasts its identity During iteration i task controlling column i determines pivot row and broadcasts its identity During iteration i task controlling column i must also broadcast column i to other tasks During iteration i task controlling column i must also broadcast column i to other tasks Agglomerate tasks in an interleaved fashion to balance workloads Agglomerate tasks in an interleaved fashion to balance workloads Isoefficiency same as row-oriented algorithm Isoefficiency same as row-oriented algorithm

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Comparison of Two Algorithms Both algorithms evenly divide workload Both algorithms evenly divide workload Both algorithms do a broadcast each iteration Both algorithms do a broadcast each iteration Difference: identification of pivot row Difference: identification of pivot row  Row-oriented algorithm does search in parallel but requires all-reduce step  Column-oriented algorithm does search sequentially but requires no communication Row-oriented superior when n relatively larger and p relatively smaller Row-oriented superior when n relatively larger and p relatively smaller

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Problems with These Algorithms They break parallel execution into computation and communication phases They break parallel execution into computation and communication phases Processes not performing computations during the broadcast steps Processes not performing computations during the broadcast steps Time spent doing broadcasts is large enough to ensure poor scalability Time spent doing broadcasts is large enough to ensure poor scalability

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Pipelined, Row-Oriented Algorithm Want to overlap communication time with computation time Want to overlap communication time with computation time We could do this if we knew in advance the row used to reduce all the other rows. We could do this if we knew in advance the row used to reduce all the other rows. Let’s pivot columns instead of rows! Let’s pivot columns instead of rows! In iteration i we can use row i to reduce the other rows. In iteration i we can use row i to reduce the other rows.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Row 0 Reducing Using Row 0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Reducing Using Row 0 Reducing Using Row 0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Reducing Using Row 0 Reducing Using Row 0 Reducing Using Row 0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Reducing Using Row 0 Reducing Using Row 0 Reducing Using Row 0 Reducing Using Row 0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Reducing Using Row 0 Reducing Using Row 0 Reducing Using Row 0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Reducing Using Row 1 Reducing Using Row 0 Reducing Using Row 0 Row 1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Reducing Using Row 1 Reducing Using Row 1 Reducing Using Row 0 Row 1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Reducing Using Row 1 Reducing Using Row 1 Reducing Using Row 1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Communication Pattern Reducing Using Row 1 Reducing Using Row 1 Reducing Using Row 1 Reducing Using Row 1

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Analysis (1/2) Total computation time:  (n 3 /p) Total computation time:  (n 3 /p) Total message transmission time:  (n 2 ) Total message transmission time:  (n 2 ) When n large enough, message transmission time completely overlapped by computation time When n large enough, message transmission time completely overlapped by computation time Message start-up not overlapped:  (n) Message start-up not overlapped:  (n) Parallel overhead:  (np) Parallel overhead:  (np)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Analysis (2/2) Isoefficiency relation: Isoefficiency relation: Scalability function: Scalability function: Parallel system is perfectly scalable Parallel system is perfectly scalable

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Sparse Systems Gaussian elimination not well-suited for sparse systems Gaussian elimination not well-suited for sparse systems Coefficient matrix gradually fills with nonzero elements Coefficient matrix gradually fills with nonzero elements Result Result  Increases storage requirements  Increases total operation count

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example of “Fill”

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Iterative Methods Iterative method: algorithm that generates a series of approximations to solution’s value Iterative method: algorithm that generates a series of approximations to solution’s value Require less storage than direct methods Require less storage than direct methods Since they avoid computations on zero elements, they can save a lot of computations Since they avoid computations on zero elements, they can save a lot of computations

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Jacobi Method Values of elements of vector x at iteration k+1 depend upon values of vector x at iteration k Gauss-Seidel method: Use latest version available of x i

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Jacobi Method Iterations

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Rate of Convergence Even when Jacobi method and Gauss-Seidel methods converge on solution, rate of convergence often too slow to make them practical Even when Jacobi method and Gauss-Seidel methods converge on solution, rate of convergence often too slow to make them practical We will move on to an iterative method with much faster convergence We will move on to an iterative method with much faster convergence

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Conjugate Gradient Method A is positive definite if for every nonzero vector x and its transpose x T, the product x T Ax > 0 A is positive definite if for every nonzero vector x and its transpose x T, the product x T Ax > 0 If A is symmetric and positive definite, then the function If A is symmetric and positive definite, then the function has a unique minimizer that is solution to Ax = b has a unique minimizer that is solution to Ax = b Conjugate gradient is an iterative method that solves Ax = b by minimizing q(x) Conjugate gradient is an iterative method that solves Ax = b by minimizing q(x)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Conjugate Gradient Convergence Finds value of n-dimensional solution in at most n iterations

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Conjugate Gradient Computations Matrix-vector multiplication Matrix-vector multiplication Inner product (dot product) Inner product (dot product) Matrix-vector multiplication has higher time complexity Matrix-vector multiplication has higher time complexity Must modify previously developed algorithm to account for sparse matrices Must modify previously developed algorithm to account for sparse matrices

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Rowwise Block Striped Decomposition of a Symmetrically Banded Matrix Matrix Decomposition

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Representation of Vectors Replicate vectors Replicate vectors  Need all-gather step after matrix-vector multiply  Inner product has time complexity  (n) Block decomposition of vectors Block decomposition of vectors  Need all-gather step before matrix-vector multiply  Inner product has time complexity  (n/p + log p)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Comparison of Vector Decompositions

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Summary (1/2) Solving systems of linear equations Solving systems of linear equations  Direct methods  Iterative methods Parallel designs for Parallel designs for  Back substitution  Gaussian elimination  Conjugate gradient method

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Summary (2/2) Superiority of one algorithm over another depends on size of problem, number of processors, characteristics of parallel computer Superiority of one algorithm over another depends on size of problem, number of processors, characteristics of parallel computer Overlapping communications with computations can be key to scalability Overlapping communications with computations can be key to scalability