Understanding the Amdahl's and Gustafson's law speedup calculator — concept and principle
When you spread a program over more processors, how much faster does it get? Amdahl's law answers for a fixed problem size; Gustafson's law answers when the problem grows with the machine. This calculator gives both speedups, the theoretical ceiling with unlimited cores and the parallel efficiency, so you can judge whether adding cores is worthwhile.
How it is calculated
Let P be the parallel fraction (as a decimal) and N the number of processors.
- Amdahl speedup: S = 1 ÷ ((1 − P) + P ÷ N).
- Maximum speedup (N → ∞): 1 ÷ (1 − P).
- Gustafson scaled speedup: S = N − (1 − P) × (N − 1).
- Efficiency: Amdahl speedup ÷ N × 100%.
P is measured on the single-processor run: the share of its time that can run in parallel.
The principle
Amdahl's law (1967) splits the original run time into a serial part (1 − P) that no extra processor can shorten and a parallel part P that divides by N. As N grows, the parallel part shrinks towards zero but the serial part stays, so speedup approaches 1 ÷ (1 − P). Even 5% serial code caps speedup at 20×. Gustafson (1988) observed that people usually use bigger machines to solve bigger problems in the same time. If the serial part stays fixed while the parallel work scales with N, the scaled speedup grows almost linearly. Both laws are correct; they answer different questions (strong scaling versus weak scaling).
Worked example
- Inputs: P = 90% = 0.9, N = 16.
- Amdahl: 0.9 ÷ 16 = 0.05625; 0.1 + 0.05625 = 0.15625; 1 ÷ 0.15625 = 6.4×.
- Ceiling: 1 ÷ 0.1 = 10×.
- Gustafson: 16 − 0.1 × 15 = 16 − 1.5 = 14.5×.
- Efficiency: 6.4 ÷ 16 = 40%.
| Parallel fraction (%) | Amdahl speedup |
|---|---|
| 22.5 | 1.267326733 |
| 45 | 1.72972973 |
| 67.5 | 2.723404255 |
| 90 | 6.4 |
| 112 | -18.28571429 |
| 135 | -3.764705882 |
| 180 | -1.454545455 |
How to read the result
Efficiency shows how much of the hardware you are actually using. At 40%, more than half of the 16 cores' capacity is lost to the serial part, so cutting serial work helps more than adding cores. Compare the Amdahl speedup with the ceiling: if you are already near it, more cores give little.
Common mistakes
- Treating P as fixed; synchronisation and communication often grow with N, making real speedup lower.
- Measuring P on the parallel run instead of the original serial run.
- Assuming Gustafson's result means a fixed job finishes 14.5× faster; it describes a larger job in the same time.
Frequently asked questions
What is the difference between strong and weak scaling?
Strong scaling keeps the problem size fixed (Amdahl); weak scaling grows the problem with the processors (Gustafson).
How can I estimate my parallel fraction?
Measure speedups at a few core counts and solve Amdahl's formula for P, which is the idea behind the Karp–Flatt metric.
Does Amdahl's law apply to GPUs?
Yes. Data transfer and serial host code act as the serial fraction and limit overall speedup.
Sources: G. M. Amdahl, "Validity of the single processor approach to achieving large scale computing capabilities", AFIPS Conference Proceedings 30, 1967 · J. L. Gustafson, "Reevaluating Amdahl's Law", Communications of the ACM 31(5), 1988