```
Parallel Algorithm Analysis
Evaluating the work, span, and real-world speedup of parallel algorithms.
Kevin Lin, with thanks to many others.
1
Thread Counting
How many threads are created during the execution of SumTask in terms of N, the number of items (a power of 2)? Cutoff at 1024 items and call left.fork(), right.compute(), and left.join().
2
Q
Q1: How many threads are created during the execution of SumTask in terms of N, the number of items (a power of 2)? Cutoff at 1024 items and call left.fork(), right.compute(), and left.join().
Thread Counting
How many threads are created during the execution of SumTask in terms of N, the number of items (a power of 2)? Cutoff at 1024 items and call left.fork(), right.compute(), and left.join().
3
A
Execution DAG
Given a list of N items, draw the execution DAG for an algorithm that adds the items to a min-PQ, removes them from the min-PQ, and then sums all of the items in the array. Which part(s) can be parallelized?
4
Q
Q1: Given a list of N items, draw the execution DAG for an algorithm that adds the items to a min-PQ, removes them from the min-PQ, and then sums all of the items in the array. Which part(s) can be parallelized?
Execution DAG
Given a list of N items, draw the execution DAG for an algorithm that adds the items to a min-PQ, removes them from the min-PQ, and then sums all of the items in the array. Which part(s) can be parallelized?
5
A
Worst-Case Execution DAG
Draw the execution DAG for an algorithm with order N work and span.
6
Q
Q1: Draw the execution DAG for an algorithm with order N work and span.
Worst-Case Execution DAG
Draw the execution DAG for an algorithm with order N work and span.
7
A
Amdahl’s Law
How many processors would you need to get 4x speedup on a program where 4/5 of the program is parallelizable? Is this possible?
Calculator required: What percentage of a program would have to be perfectly parallelizable in order to get a 100x speedup on 256 processors?
8
Q
Q1: How many processors would you need to get 4x speedup on a program where 4/5 of the program is parallelizable? Is this possible?
Q2: What percentage of a program would have to be perfectly parallelizable in order to get a 100x speedup on 256 processors?
Amdahl’s Law
How many processors would you need to get 4x speedup on a program where 4/5 of the program is parallelizable? Is this possible?
Calculator required: What percentage of a program would have to be perfectly parallelizable in order to get a 100x speedup on 256 processors?
9
A
```