Amdahl’s Law: Calculate the Speedup Limit of Parallelization
Amdahl’s law shows how the serial portion caps speedup for a fixed workload. Use the parallelizable fraction and worker count to estimate an ideal limit; data movement, synchronization, and memory bottlenecks reduce real gains.
Amdahl’s Law: Calculate the Speedup Limit of Parallelization
Amdahl’s law says the serial portion that cannot be parallelized sets an upper bound on speedup for a fixed workload. The parallelizable fraction and number of equal-speed workers give an ideal estimate, but real gains are lower because of data movement, synchronization, and memory bottlenecks.
The ideal speedup model and its assumptions
Let P be the fraction of one-worker runtime that can be parallelized, and N the number of equally fast workers. If the serial part stays unchanged and the parallel part is divided evenly, relative runtime is (1-P)+P/N, and speedup is its reciprocal. This assumes fixed work, a perfect split, and no extra costs. Amdahl’s 1967 paper discusses how sequential data-management work can limit parallel gains.
Ideal time relative to baseline: `T_N / T_1 = (1 - P) + P / N`
Ideal speedup: `S(N) = 1 / ((1 - P) + P / N)`
| Parallel workers N | Ideal time relative to baseline | Ideal speedup |
|---|---|---|
| 1 | 1.000 | 1.00× |
| 2 | 0.550 | 1.82× |
| 4 | 0.325 | 3.08× |
| 8 | 0.213 | 4.71× |
| ∞ | 0.100 | 10.00× |
This table calculates the model for P=90%; it is not a measurement. Even with infinitely many workers, the 10% serial portion limits speedup to 10x.
What work can be parallelized, and how much parallelism is enough?
P is a share of runtime for a chosen input, not the share of source-code lines that look parallel. Independent array elements are easy to split; a recurrence that needs the previous result leaves serial work. In CUDA, threads are grouped into blocks. NVIDIA’s guide says one block gives work to only one SM, so too few tasks may not use a multi-SM GPU fully. This is specific to NVIDIA’s GPU model.
Limits and costs of speedup
Real runtime also includes preparing, splitting, and combining work. Too few or imbalanced tasks, data movement, communication, synchronization, and memory limits can reduce gains. NVIDIA distinguishes memory bandwidth, math bandwidth, and latency as performance limits; insufficient parallelism can leave GPU resources underused.
| Limiting factor | How to check | Example direction for improvement |
|---|---|---|
| Data dependencies | Profile and analyze the algorithm | Define independent units of work |
| Imbalanced workload | Compare completion time per worker | Split work more evenly |
| Memory bottleneck | Profile bandwidth, cache, and stalls | Improve data reuse and access order |
| Communication or synchronization | Measure time and transferred data by stage | Reduce communication or adjust work granularity |
A safe process for applying it
First validate a sequential baseline implementation and its results.
Find independent units of work and divide a small input.
Check that the parallel result matches the baseline.
Measure initialization, data movement, and result aggregation as well as execution time.
Vary the input size to find where speedup persists.
CUDA calls and kernel launches are often asynchronous. Use CUDA events to time the GPU section, and also measure end-to-end wall time including setup, transfers, synchronization, and result aggregation; they answer different questions.
Sources
[NVIDIA CUDA Programming Guide: Programming Model](https://docs.nvidia.com/cuda/cuda-programming-guide/01-introduction/programming-model.html)
[NVIDIA GPU Performance Background User’s Guide](https://docs.nvidia.com/deeplearning/performance/dl-performance-gpu-background/index.html)
[Gene M. Amdahl, Validity of the Single Processor Approach to Achieving Large Scale Computing Capabilities (AFIPS, 1967)](https://www-inst.eecs.berkeley.edu/~n252/paper/Amdahl.pdf)
[NVIDIA CUDA C++ Best Practices Guide — Timing](https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/#timing)