03 Performance
03 Performance
Partner Fundin
s g
1 bioexcel.eu
Reusing this material
This means you are free to copy and redistribute the material and adapt and build on the
material under the following terms: You must give appropriate credit, provide a link to the
license and indicate if changes were made. If you adapt or build on the material you must
distribute your work under the same license as the original.
Note that this presentation contains images owned by others. Please seek their
permission before reusing these images.
bioexcel.eu
Outline
•Performance Metrics
•Scalability
•Amdahl’s law
•Gustafson’s law
•Load Imbalance
bioexcel.eu
Why care about parallel performance?
bioexcel.eu
Performance Metrics
• How do we quantify performance when running in parallel?
• Speedup:
• typically S(N,P) < P
bioexcel.eu
Parallel Scaling
bioexcel.eu
Strong Scaling
bioexcel.e
Typical strong scaling behaviour
Speed-up vs No of processors
300
250
200
Speed-u
Ideal
150 actual
p
100
50
0
0 50 100 150 200 250 300
No of processors
bioexcel.eu
Weak Scaling
bioexcel.eu
Typical weak scaling behaviour
20
18
16
14
12
Runtime (s)
Actual
10
Ideal
8
6
4
2
0
1 n
No. of processors
bioexcel.eu
Limits to scaling – the serial fraction
Amdahl’s Law
bioexcel.eu
Analogy: Flying Delhi to Japan
bioexcel.eu
Delhi (Home) to Japan (Hotel)
• By Jumbo Jet
• distance: 5600 km; speed: 700 kph
• time: 8 hours ?
• No!
• 1 hour by Cab to Delhi Airport + 1 hour for check in etc.
• 1 hour immigration + 1 hour taxi downtown
• fixed overhead of 4 hours; total journey time: 4 + 8 = 12 hours
• Triple the flight speed with Concorde to 2100 kph
• total journey time = 4 hours + 2 hours 40 mins = 6.7 hours
• speedup of 1.8 not 3.0
• Max speedup = 3 (i.e. 4 hours)
bioexcel.eu
Amdahl’s Law - illustrated
“The performance improvement to be gained by parallelisation is
limited by the proportion of the code which is serial”
Gene Amdahl, 1967
bioexcel.eu
Amdahl’s Law
•Hypothetical
(N,1)
runtime in parallel =
T (N, P) = αT (N,1) +
(1− α)T
P
T (N,1) P
• Hypothetical speedup =
S(N, P) =T (N,P) = αP + (1− α )
bioexcel.eu
Amdahl’s Law
• Hypothetical speedup =
bioexcel.eu
Delhi (Home) to Japan (Hotel)
• By Jumbo Jet
• distance: 5600 km; speed: 700 kph
• time: 8 hours ?
• No!
• 1 hour by Cab to Delhi Airport + 1 hour for check in etc.
• 1 hour immigration + 1 hour taxi downtown
• fixed overhead of 4 hours; total journey time: 4 + 8 = 12 hours
bioexcel.eu
Exercise-1
Consider the following snippet of the program.
Assume each of the 3 for loops takes same time on the sequential
execution.
If the above snippet is executed on a parallel machine that has P
processors, then what is the maximum speed up we can achieve?
bioexcel.eu
Exercise-2
bioexcel.eu
Limits to scaling – problem size
Gustafson’s Law
bioexcel.eu
Flying London to Sydney
bioexcel.eu
Buckingham Palace to Sydney Opera
• By Jumbo Jet
• distance: 16800 km; speed: 700 kph; flight time; 24 hours
• serial overhead stays the same: total time: 4 + 24 = 28 hours
• Gustafson’s law!
• bigger problems scale better
• increase both distance (i.e. N) and max speed (i.e. P) by three
• maintain same balance: 4 “serial” + 8 “parallel”
bioexcel.eu
Gustafson’s Law - illustrated
We need larger problems for larger numbers of processors
bioexcel.eu
Gustafson’s Law
(1− α) N T (1,1)
= αT (1,1) +
P
• And total runtime
on 1 processor = T (N,1) = αT (1,1) + (1− α ) N T(1,1)
bioexcel.eu
Gustafson’s Law
bioexcel.eu
Gustafson’s Law – consequence
Efficient Use of Large Parallel Machines
• If you increase the amount of work done by each parallel
task then the serial component will not dominate
• Increase the problem size to maintain scaling
• Can do this by adding extra complexity or increasing the overall
problem size
bioexcel.eu
Load Imbalance
• These laws all assumed all processors are equally busy
• what happens if some run out of work?
• Specific case
• four people pack boxes with cans of soup: 1 minute per box
bioexcel.eu
Quantifying Load Imbalance
• Box packing
• LIF = 6/3 = 2
bioexcel.eu
Summary
bioexcel.eu