1 Lecture 25: Parallel Algorithms II Topics: matrix, graph, and sort algorithms Tuesday presentations:  Each group: 10 minutes  Describe the problem,

Slides:



Advertisements
Similar presentations
Dense Linear Algebra (Data Distributions) Sathish Vadhiyar.
Advertisements

Lecture 19: Parallel Algorithms
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
East Los Angeles College
MATH 685/ CSI 700/ OR 682 Lecture Notes
1 Parallel Algorithms II Topics: matrix and graph algorithms.
Lecture 7 Intersection of Hyperplanes and Matrix Inverse Shang-Hua Teng.
SOLVING SYSTEMS OF LINEAR EQUATIONS. Overview A matrix consists of a rectangular array of elements represented by a single symbol (example: [A]). An individual.
Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
Tejas Tapsale. N ASH ’ S S YSTOLIC I MPLEMENTATION O F F ADDEEV ’ S A LGORITHM IN VHDL.
Chapter 2 Matrices Finite Mathematics & Its Applications, 11/e by Goldstein/Schneider/Siegel Copyright © 2014 Pearson Education, Inc.
Numerical Algorithms Matrix multiplication
1.2 Row Reduction and Echelon Forms
Linear Equations in Linear Algebra
P1 RJM 07/08/02EG1C2 Engineering Maths: Matrix Algebra 5 Solving Linear Equations Given the equations 3x + 4y = 10 2x + z = 7 y + 2z = 7 Solve by removing.
Solving Systems of Linear Equations Part Pivot a Matrix 2. Gaussian Elimination Method 3. Infinitely Many Solutions 4. Inconsistent System 5. Geometric.
Goldstein/Schnieder/Lay: Finite Math & Its Applications, 9e 1 of 86 Chapter 2 Matrices.
Matrices. Special Matrices Matrix Addition and Subtraction Example.
Lecture 21: Parallel Algorithms
1 Parallel Algorithms III Topics: graph and sort algorithms.
1 Lecture 24: Parallel Algorithms I Topics: sort and matrix algorithms.
10.1 Gaussian Elimination Method
Finite Mathematics & Its Applications, 10/e by Goldstein/Schneider/SiegelCopyright © 2010 Pearson Education, Inc. 1 of 86 Chapter 2 Matrices.
Part 3 Chapter 8 Linear Algebraic Equations and Matrices PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The.
Matrices Write and Augmented Matrix of a system of Linear Equations Write the system from the augmented matrix Solve Systems of Linear Equations using.
Solving Systems of Equations and Inequalities
Scientific Computing Linear Systems – LU Factorization.
Systems and Matrices (Chapter5)
System of Linear Equations Nattee Niparnan. LINEAR EQUATIONS.
Basic Operations MultiplicationDeterminants Cramer’s RuleIdentityInverses Solving Systems of equations APPENDIX.
Solving Systems of Equations and Inequalities Section 3.1A-B Two variable linear equations Section 3.1C Matrices Resolution of linear systems Section 3.1D.
Copyright © 2007 Pearson Education, Inc. Slide 7-1.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Review for Chapter 4 Important Terms, Symbols, Concepts 4.1. Systems of Linear Equations in Two Variables.
Copyright © 2000 by the McGraw-Hill Companies, Inc. Barnett/Ziegler/Byleen Precalculus: A Graphing Approach Chapter Eight Systems: Matrices.
Matrices King Saud University. If m and n are positive integers, then an m  n matrix is a rectangular array in which each entry a ij of the matrix is.
Copyright © 2011 Pearson, Inc. 7.3 Multivariate Linear Systems and Row Operations.
Linear Systems Gaussian Elimination CSE 541 Roger Crawfis.
Presentation by: H. Sarper
1 Lecture 21: Core Design, Parallel Algorithms Today: ARM Cortex A-15, power, sort and matrix algorithms.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
CALTECH CS137 Winter DeHon 1 CS137: Electronic Design Automation Day 12: February 6, 2006 Sorting.
ΑΡΙΘΜΗΤΙΚΕΣ ΜΕΘΟΔΟΙ ΜΟΝΤΕΛΟΠΟΙΗΣΗΣ 4. Αριθμητική Επίλυση Συστημάτων Γραμμικών Εξισώσεων Gaussian elimination Gauss - Jordan 1.
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.
Lecture 8 Matrix Inverse and LU Decomposition
Matrices and Systems of Equations
Matrices and Systems of Equations
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Winter 2014Parallel Processing, Fundamental ConceptsSlide 1 2 A Taste of Parallel Algorithms Learn about the nature of parallel algorithms and complexity:
Linear Systems Dinesh A.
Copyright © 1999 by the McGraw-Hill Companies, Inc. Barnett/Ziegler/Byleen College Algebra, 6 th Edition Chapter Six Systems of Equations & Inequalities.
1 1.2 Linear Equations in Linear Algebra Row Reduction and Echelon Forms © 2016 Pearson Education, Ltd.
Numerical Computation Lecture 6: Linear Systems – part II United International College.
All Pairs Shortest Path Algorithms Aditya Sehgal Amlan Bhattacharya.
Chapter 7: Systems of Equations and Inequalities; Matrices
Gaussian Elimination and Gauss-Jordan Elimination
Linear Algebra Lecture 4.
Chapter 8: Lesson 8.1 Matrices & Systems of Equations
Lecture 16: Parallel Algorithms I
Lecture 22: Parallel Algorithms
4th Homework Problem In this homework problem, we wish to exercise the tearing and relaxation methods by means of a slightly larger problem than that presented.
Linear Equations in Linear Algebra
Chapter 4 Systems of Linear Equations; Matrices
Parallel Sorting Algorithms
Numerical Analysis Lecture10.
All pairs shortest path problem
Dense Linear Algebra (Data Distributions)
Chapter 4 Systems of Linear Equations; Matrices
Lecture 8 Matrix Inverse and LU Decomposition
Linear Equations in Linear Algebra
Presentation transcript:

1 Lecture 25: Parallel Algorithms II Topics: matrix, graph, and sort algorithms Tuesday presentations:  Each group: 10 minutes  Describe the problem, your proposed solution, clarify novelty and related work, plan to get results, some early numbers

2 Gaussian Elimination Solving for x, where Ax=b and A is a nonsingular matrix Note that A -1 Ax = A -1 b = x ; keep applying transformations to A such that A becomes I ; the same transformations applied to b will result in the solution for x Sequential algorithm steps:  Pick a row where the first (i th ) element is non-zero and normalize the row so that the first (i th ) element is 1  Subtract a multiple of this row from all other rows so that their first (i th ) element is zero  Repeat for all i

3 Sequential Example x x2 = x /2 x1 3/ x2 = x /2 x1 3/ /2 x2 = -1/ x /2 x1 3/ /2 x2 = -1/ /2 x3 15/ /2 x1 3/ /2 x2 = 15/ /2 x3 -1/ /2 x1 3/ /2 x2 = 3/ /2 x3 -1/ /2 x1 -3/ /2 x2 = 3/ /2 x3 -1/ /2 x1 -3/ /2 x2 = 3/ x x x2 = x3 -1

4 Algorithm Implementation The matrix is input in staggered form The first cell discards inputs until it finds a non-zero element (the pivot row) The inverse  of the non-zero element is now sent rightward  arrives at each cell at the same time as the corresponding element of the pivot row

5 Algorithm Implementation Each cell stores  i =  a k,I – the value for the normalized pivot row This value is used when subtracting a multiple of the pivot row from other rows What is the multiple? It is a j,1 How does each cell receive a j,1 ? It is passed rightward by the first cell Each cell now outputs the new values for each row The first cell only outputs zeroes and these outputs are no longer needed

6 Algorithm Implementation The outputs of all but the first cell must now go through the remaining algorithm steps A triangular matrix of processors efficiently implements the flow of data Number of time steps? Can be extended to compute the inverse of a matrix

7 Graph Algorithms

8 Floyd Warshall Algorithm

9 Implementation on 2d Processor Array Row 3 Row 2 Row 1 Row 3 Row 2 Row 1/2 Row 3 Row 1/3 Row 2 Row 1 Row 2/3 Row 2/1 Row 3 Row 2 Row 3/1Row 3/2 Row 1 Row 3 Row 2 Row 1 Row 3 Row 2 Row 1

10 Algorithm Implementation Diagonal elements of the processor array can broadcast to the entire row in one time step (if this assumption is not made, inputs will have to be staggered) A row sifts down until it finds an empty row – it sifts down again after all other rows have passed over it When a row passes over the 1 st row, the value of a i1 is broadcast to the entire row – a ij is set to 1 if a i1 = a 1j = 1 – in other words, the row is now the i th row of A (1) By the time the k th row finds its empty slot, it has already become the k th row of A (k-1)

11 When the i th row starts moving again, it travels over rows a k (k > i) and gets updated depending on whether there is a path from i to j via vertices < k (and including k) Algorithm Implementation

12 Shortest Paths Given a graph and edges with weights, compute the weight of the shortest path between pairs of vertices Can the transitive closure algorithm be applied here?

13 Shortest Paths Algorithm The above equation is very similar to that in transitive closure

14 Sorting with Comparison Exchange Earlier sort implementations assumed processors that could compare inputs and local storage, and generate an output in a single time step The next algorithm assumes comparison-exchange processors: two neighboring processors I and J (I < J) show their numbers to each other and I keeps the smaller number and J the larger

15 Odd-Even Sort N numbers can be sorted on an N-cell linear array in O(N) time: the processors alternate operations with their neighbors

16 Shearsort A sorting algorithm on an N-cell square matrix that improves execution time to O(sqrt(N) logN) Algorithm steps: Odd phase: sort each row with odd-even sort (all odd rows are sorted left to right and all even rows are sorted right to left) Even phase: sort each column with odd-even sort Repeat Each odd and even phase takes O(sqrt(N)) steps – the input is guaranteed to be sorted in O(logN) steps

17 Example

18 The 0-1 Sorting Lemma If a comparison-exchange algorithm sorts input sets consisting solely of 0’s and 1’s, then it sorts all input sets of arbitrary values

19 Complexity Proof How do we prove that the algorithm completes in O(logN) phases? (each phase takes O(sqrt(N)) steps) Assume input set of 0s and 1s There are three types of rows: all 0s, all 1s, and mixed entries – we will show that after every phase, the number of mixed entry rows reduces by half The column sort phase is broken into the smaller steps below: move 0 rows to the top and 1 rows to the bottom; the mixed rows are paired up and sorted within pairs; repeat these small steps until the column is sorted

20 Example The modified algorithm will behave as shown below: white depicts 0s and blue depicts 1s

21 Proof If there are N mixed rows, we are guaranteed to have fewer than N/2 mixed rows after the first step of the column sort (subsequent steps of the column sort may not produce fewer mixed rows as the rows are not sorted) Each pair of mixed rows produces at least one pure row when sorted