A Parallel, In-Place, Rectangular Matrix Transpose Algorithm
Computational Complexity Analysis
Stefan Amberger
ICA & RISC amberger.stefan@gmail.com
A Parallel, In-Place, Rectangular Matrix Transpose Algorithm - - PowerPoint PPT Presentation
Stefan Amberger ICA & RISC amberger.stefan@gmail.com A Parallel, In-Place, Rectangular Matrix Transpose Algorithm Computational Complexity Analysis Table of Contents 1. Introduction 2. Revision of TRIP 3. Analysis of Computational
Stefan Amberger
ICA & RISC amberger.stefan@gmail.com
1. Introduction 2. Revision of TRIP 3. Analysis of Computational Complexity
a. Work b. Span c. Parallelism d. Generalizations
2
3
Work “execution time on one processor” i.e.: all vertices of computation dag approximation: # of nodes of computation dag Span “execution time on infinitely many processors” i.e. length of critical path of computation dag approximation: # of nodes on critical path
4
Introduction to Algorithms Third Edition, p777ff
Computational Complexity of Parallel Algorithms
Parallelism
path
speedup
5
TRIP: If matrix is rectangular TRIP transposes sub-matrices, then combines the result with merge or split merge: first rotates the middle part of the array, then recursively merges the left and right parts
split: first recursively splits the left and right parts of the array, then rotates the middle part of the array
6
7
Matrix dimensions M x N and N x M recursive calls are symmetric TRIP’s recursive call are either all merge or all split
8
“power condition”
9
10
Work of Base Algorithms
Show that under power condition, for M x N matrix
11
Work of TRIP
METHOD don’t count vertices in computation dag count inner nodes in recursion tree and swaps
Work of TRIP Work of merge Work of rol
12
Proof Sketch
TRIP recursion is analogous for tall and wide matrices
This difference does not cause a change in the amount of work of TRIP.
13
wide matrices
14
Work as function of Matrix Dimensions
15
16
Span of Base Algorithms
Calculate span of tall matrix transpose count levels and swaps on critical path, that includes span of
recursive procedures)
17
Result
18
Span as function of Matrix Dimensions
19
Rectangular Matrices Square Matrices calculation:
20
21
22
23
Power Condition not Satisfied
24
Power Condition not Satisfied
25
Power Condition not Satisfied
27
If matrix is rectangular TRIP transposes sub-matrices, then combines the result with merge or split
28
merge combines the transposes of sub-matrices of tall matrices merge first rotates the middle part of the array, then recursively merges the left and right parts of the array rol(arr, k) … left rotation (circular shift) of array arr by k elements
29
split combines the transposes of sub-matrices of wide matrices split first recursively splits the left and right parts of the array, then rotates the middle part of the array split and merge are inverse to each other
30
31
Calculate work of tall matrix transpose
recursive procedures)
32
Overview
Combining Nodes via merge
33
Proof - TRIP Tree
Spanning Divide Tree
34
Proof - Merge Tree
Combining via merge, rotate sub-arrays
Integrate rol result into merge work
35
Proof - Merge Tree
Integrate merge result into TRIP work
36
Proof - TRIP Tree
Recap
37
Proof - Square Transpose
Lower Bound on # of inner nodes purely ternary tree Upper Bound on # of inner nodes purely quaternary tree
38
Proof - Square Transpose
Integrate square transpose result into TRIP work work of square transpose (including swapping)
39
Proof - TRIP Tree
40
Novel Algorithm TRIP transposes rectangular matrices
41
1. Work 2. Span 3. Parallelism
42