Objective
Adding processors does not speed up a program indefinitely: the part that cannot be parallelized limits the improvement. Amdahl's law says that, if a fraction p of the work is parallelizable, with n processors the speedup is 1 / ((1 - p) + p / n).
Instructions
- Read
p(decimal between 0 and 1, not including 1) and an integerq. Then readqvalues ofn(number of processors). - First show
Limit: x: the maximum possible speedup,1 / (1 - p), with 2 decimals. - For each
nshown processors: a (efficiency e%). The efficiency is the speedup divided byn, as a percentage with 1 decimal.
0.9
3
1
4
100
Limit: 10.00
1 processors: 1.00 (efficiency 100.0%)
4 processors: 3.08 (efficiency 76.9%)
100 processors: 9.17 (efficiency 9.2%)
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise