A program is eight times faster on sixteen processors. Is that good? We need to know which serial baseline was used, whether the problem changed, and what the extra processors spent time doing. The earlier chapters supplied mechanisms of waiting; this chapter supplies definitions that distinguish their effects.
1. Define the experiment before the ratio
Let denote a stated problem-size parameter and the processor count. might mean matrix dimension, number of particles or number of quadrature points; the work need not grow linearly in :
| Calculation | Representative work scaling |
|---|---|
| Dense matrix diagonalisation | |
| FFT | |
| Direct all-pairs N-body interactions | |
| Composite trapezoidal rule with N points |
Let be elapsed time for a defined workload and numerical accuracy. Use a meaningful one-processor baseline, the same timing boundaries and representative data. Include transfers or setup if the application pays them; if reporting kernel-only times, label them. Repeat measurements and report variability, compiler settings and resource placement.
For distributed timings, the job cannot finish before its slowest rank. Time local intervals with MPI_Wtime and reduce their durations using MPI_MAX; clocks need not be synchronised for local duration measurements. A barrier can align a timed phase but itself changes the experiment. For CUDA, asynchronous launches require completion-aware timing, as the next chapter explains.
The source's runtime model
Separate the one-processor work into serial and parallelisable parts:
and model the parallel time as
is elapsed-time overhead: communication, scheduling, synchronisation, imperfect load balance and other departures from ideal division. This model assumes a fixed algorithm and baseline. Cache effects, different algorithms or changed frequency can violate its assumptions and can even produce apparent superlinear speedup. Those observations need explanation rather than being forced into a nonnegative-overhead model.
2. Speedup and efficiency answer different questions
Define
Speedup asks how much elapsed time was saved. Efficiency compares processor-time consumed with the baseline time. Eightfold speedup on sixteen processors has . That may be worthwhile for a deadline even though it doubles processor-time cost.
Efficiency is not a hardware utilisation counter. A processor can be busy executing redundant work while algorithmic efficiency is poor; idle periods and overhead contribute to the same ratio.
3. Amdahl's bound follows from a floor on elapsed time
At fixed , define
Divide the runtime model by :
Since overhead is nonnegative,
This is Amdahl's law under the model's assumptions. For , the speedup ceiling as is . For , this bound has no finite ceiling, though overhead or finite available parallelism can still limit scaling. For , positive prevents unit efficiency; unit efficiency is possible in this ideal model only with both and zero overhead. At , efficiency is one by definition.
Take and zero overhead. On four processors, runtime relative to serial is , speedup and efficiency . On sixteen processors, speedup is and efficiency . Even infinitely many processors cannot exceed tenfold speedup.
Instead of comparing just three processor counts, grow the machine continuously through the integer counts. Watch the part of the bar that refuses to shrink.
Keep the problem fixed while the processor count grows. Which part can the extra workers actually shorten?
Play, pause, or scrub to inspect a moment.
Paused. P=1, F=0.1. Relative runtime 1, speedup 1, efficiency 1.
4. Strong and weak scaling change different quantities
Strong scaling varies at fixed problem size and accuracy. Weak scaling grows the problem so that useful work per processor is approximately fixed. Good scaling is an experimental outcome, not part of either definition.
If work is proportional to , doubling when doubling maintains work per processor. If work is proportional to , use instead. For a three-dimensional grid whose side length is , work proportional to gives . State whether denotes side length or total grid points.
The source's example growth laws , and are illustrative algorithm models, not general HPC laws. They explain why the serial fraction and relative overhead can fall when problem size grows at fixed . Check memory capacity and algorithmic complexity before attributing better scaling to “larger N”.
The two scaling experiments hold different geometry fixed. Return to the square halo model and compare the local area with its boundary as the process grid grows.
As the process grid grows, watch the useful local area and the boundary that must be exchanged.
Play, pause, or scrub to inspect a moment.
Paused. Strong scaling milestone 1×1: global side 24, local side 24. Geometry morphs to the next integer grid; intermediate frames are not fractional process counts.
Isoefficiency asks how much growth is enough
Define processor-time overhead
Then, exactly by definition,
This is an equality, correcting the source's inequality. In the additive runtime model,
Thus elapsed overhead and processor-time overhead are not the same object. To maintain a target , solve
For example, suppose useful serial work is and elapsed overhead is , with no serial section. Then , so constant efficiency requires proportional to . This is the isoefficiency relation. It grows faster than the choice of ordinary weak scaling: constant work per processor does not guarantee constant efficiency.
5. Karp–Flatt measures an effective fraction
For and positive measured speedup, invert Amdahl's expression:
Under the source's additive model, substitution gives a more revealing identity:
The metric includes overhead. It does not directly measure a region of serial source code. For and no overhead it returns at both four and sixteen processors. If at four processors , runtime becomes of serial, speedup is , and .
An increasing effective fraction is evidence consistent with growing relative overhead. A constant value is consistent with a fixed serial fraction, but can also hide overhead with suitable scaling. The ratio alone cannot uniquely distinguish causes; use profiles and communication/imbalance timings. Negative values can arise with superlinear speedups or baseline problems and signal assumptions to investigate. The metric is undefined at .
Exercises and course connection
- Derive the overhead identity and verify the examples without a plot.
- Given measured , report speedup, efficiency, variability and Karp–Flatt values. Avoid inferring a unique cause from those values alone.
- Design a weak-scaling experiment for an algorithm. Explain why doubling both and changes work per processor.
- Relate terms in to OpenMP queueing, false sharing, MPI halo traffic and synchronisation. Which measurements would distinguish them?
The same discipline applies to accelerators: a kernel's peak arithmetic rate is insufficient if transfers and launch costs dominate. CUDA returns to the ownership and locality questions on GPU hardware.