runtime
374 / 500
question 374 Threading & Multiprocessing · easy

How fast can it get? Amdahl's law

Before parallelising a report, estimate the best possible speed-up. If a fraction p of the serial run time can be split across workers and the rest can't, the speed-up is at most 1 / ((1 - p) + p / workers) (Amdahl's law). Write max_speedup(parallel_fraction, workers).

Simulated: this runs against results recorded on real Python.

Functionmax_speedup(parallel_fraction, workers)
Inputsa fraction from 0 to 1, and a whole number of workers ≥ 1
Returnsthe speed-up limit as a float
Examples
callmax_speedup(0.9, 8)returns4.705882352941176
callmax_speedup(0.5, 8)returns1.7777777777777777
callmax_speedup(1, 4)returns4.0

Loading your progress…

How fast can it get? Amdahl's law — Python practice · Runtime