Amdahl's law explained

In computer architecture, Amdahl's law (or Amdahl's argument[1]) is a formula which gives the theoretical speedup in latency of the execution of a task at fixed workload that can be expected of a system whose resources are improved.

The law can be stated as:

"the overall performance improvement gained by optimizing a single part of a system is limited by the fraction of time that the improved part is actually used".[2]
It is named after computer scientist Gene Amdahl, and was presented at the American Federation of Information Processing Societies (AFIPS) Spring Joint Computer Conference in 1967.

Amdahl's law is often used in parallel computing to predict the theoretical speedup when using multiple processors. For example, if a program needs 20 hours to complete using a single thread, and a one-hour portion of the program cannot be parallelized, then only the remaining 19 hours' execution time can be parallelized. Therefore, regardless of how many threads are devoted to a parallelized execution of this program, the minimum execution time is always more than 1 hour. Hence, the theoretical speedup is, at most, 20 times the single thread performance,

\left(\dfrac{1}{1-p}=20\right)

.

Definition

Amdahl's law can be formulated in the following way:

Slatency(s)=

1
(1-p)+
p
s
where

Furthermore,

\begin{cases} Slatency(s)\leq\dfrac1{1-p}\\[8pt] \lim\limitssSlatency(s)=\dfrac1{1-p}. \end{cases}

shows that the theoretical speedup of the execution of the whole task increases with the improvement of the resources of the system and that regardless of the magnitude of the improvement, the theoretical speedup is always limited by the part of the task that cannot benefit from the improvement.

Amdahl's law applies only to the cases where the problem size is fixed. In practice, as more computing resources become available, they tend to get used on larger problems (larger datasets), and the time spent in the parallelizable part often grows much faster than the inherently serial work. In this case, Gustafson's law gives a less pessimistic and more realistic assessment of the parallel performance.[3]

Derivation

A task executed by a system whose resources are improved compared to an initial similar system can be split up into two parts:

An example is a computer program that processes files. A part of that program may scan the directory of the disk and create a list of files internally in memory. After that, another part of the program passes each file to a separate thread for processing. The part that scans the directory and creates the file list cannot be sped up on a parallel computer, but the part that processes the files can.

The execution time of the whole task before the improvement of the resources of the system is denoted as

T

. It includes the execution time of the part that would not benefit from the improvement of the resources and the execution time of the one that would benefit from it. The fraction of the execution time of the task that would benefit from the improvement of the resources is denoted by

p

. The one concerning the part that would not benefit from it is therefore . Then:

T=(1-p)T+pT.

It is the execution of the part that benefits from the improvement of the resources that is accelerated by the factor

s

after the improvement of the resources. Consequently, the execution time of the part that does not benefit from it remains the same, while the part that benefits from it becomes:
p
s

T.

The theoretical execution time

T(s)

of the whole task after the improvement of the resources is then:

T(s)=(1-p)T+

p
s

T.

Amdahl's law gives the theoretical speedup in latency of the execution of the whole task at fixed workload

W

, which yields

Slatency(s)=

TW
T(s)W

=

T
T(s)

=

1
1-p+
p
s

.

Parallel programs

If 30% of the execution time may be the subject of a speedup, p will be 0.3; if the improvement makes the affected part twice as fast, s will be 2. Amdahl's law states that the overall speedup of applying the improvement will be:

Slatency=

1
1-p+
p
s

=

1
1-0.3+
0.3
2

=1.18.

For example, assume that we are given a serial task which is split into four consecutive parts, whose percentages of execution time are,,, and respectively. Then we are told that the 1st part is not sped up, so, while the 2nd part is sped up 5 times, so, the 3rd part is sped up 20 times, so, and the 4th part is sped up 1.6 times, so . By using Amdahl's law, the overall speedup is

Slatency=

1
p1+
p2
s2
+
p3
s3
+
p4
s4
s1

=

1
0.11+
0.18
5
+
0.23
20
+
0.48
1.6
1

=2.19.

Notice how the 5 times and 20 times speedup on the 2nd and 3rd parts respectively don't have much effect on the overall speedup when the 4th part (48% of the execution time) is accelerated by only 1.6 times.

Serial programs

For example, with a serial program in two parts A and B for which and,

Therefore, making part A to run 2 times faster is better than making part B to run 5 times faster. The percentage improvement in speed can be calculated as

percentageimprovement=100\left(1-

1
Slatency

\right).

Optimizing the sequential part of parallel programs

If the non-parallelizable part is optimized by a factor of, then

T(O,s)=(1-p)

T
O

+

p
s

T.

It follows from Amdahl's law that the speedup due to parallelism is given by

Slatency(O,s)=

T(O)
T(O,s)

=

(1-
p)1
O
+{p
{
}
1-p
O

+

p
s}.

When

s=1

, we have

Slatency(O,s)=1

, meaning that the speedup ismeasured with respect to the execution time after the non-parallelizable part is optimized.

When

s=infty

,

Slatency(O,infty)=

T(O)
T(O,s)

=

(1-
p)1
O
+{p
{
}
1-p
O

+

p
s}=

1+

p
1-p

O.

If

1-p=0.4

,

O=2

and

s=5

, then:

Slatency(O,s)=

T(O)
T(O,s)

=

{0.4
1
2

+0.6}{

0.4
2

+

0.6
5

}=2.5.

Transforming sequential parts of parallel programs into parallelizable

Next, we consider the case wherein the non-parallelizable part is reduced by a factor of, and the parallelizable part is correspondingly increased. Then

T'(O',s)=

1-p
O'

T+\left(1-

1-p
O'

\right)

T
s

.

It follows from Amdahl's law that the speedup due to parallelism is given by

S'latency(O',s)=

T'(O')
T'(O',s)

=

1
1-p
O'
+
\left(1-1-p
O'
\right)
1
s

.

Relation to the law of diminishing returns

Amdahl's law is often conflated with the law of diminishing returns, whereas only a special case of applying Amdahl's law demonstrates law of diminishing returns. If one picks optimally (in terms of the achieved speedup) what is to be improved, then one will see monotonically decreasing improvements as one improves. If, however, one picks non-optimally, after improving a sub-optimal component and moving on to improve a more optimal component, one can see an increase in the return. Note that it is often rational to improve a system in an order that is "non-optimal" in this sense, given that some improvements are more difficult or require larger development time than others.

Amdahl's law does represent the law of diminishing returns if one is considering what sort of return one gets by adding more processors to a machine, if one is running a fixed-size computation that will use all available processors to their capacity. Each new processor added to the system will add less usable power than the previous one. Each time one doubles the number of processors the speedup ratio will diminish, as the total throughput heads toward the limit of 1/(1 − p).

This analysis neglects other potential bottlenecks such as memory bandwidth and I/O bandwidth. If these resources do not scale with the number of processors, then merely adding processors provides even lower returns.

An implication of Amdahl's law is that to speed up real applications which have both serial and parallel portions, heterogeneous computing techniques are required.[4] There are novel speedup and energy consumption models based on a more general representation of heterogeneity, referred to as the normal form heterogeneity, that support a wide range of heterogeneous many-core architectures. These modelling methods aim to predict system power efficiency and performance ranges, and facilitates research and development at the hardware and system software levels.[5] [6]

See also

Further reading

External links

Notes and References

  1. Rodgers . David P. . ACM Sigarch Computer Architecture News . June 1985 . Improvements in multiprocessor system design . 13 . 3 . 225–231 [p. 226] . 0163-5964 . . New York, NY, USA . 10.1145/327070.327215 . 0-8186-0634-7 . 7083878 .
  2. Book: Reddy, Martin . API Design for C++ . 210 . 2011 . . . 10.1016/C2010-0-65832-9 . 978-0-12-385003-4 . 2010039601 . 666246330.
  3. Book: Michael . McCool . James . Reinders . Arch . Robison . Structured Parallel Programming: Patterns for Efficient Computation . Elsevier . 2013 . 61 . 978-0-12-415993-8 .
  4. Mark D. . Hill . Michael R. . Marty . Amdahl's Law in the Multicore Era . . 41 . 7 . 33–38 . 2008 . 10.1109/MC.2008.209 . 10.1.1.221.8635 .
  5. Rafiev . Ashur . Al-Hayanni . Mohammed A. N. . Xia . Fei . Shafik . Rishad . Romanovsky . Alexander . Yakovlev . Alex . 2018-07-01 . Speedup and Power Scaling Models for Heterogeneous Many-Core Systems . IEEE Transactions on Multi-Scale Computing Systems . 4 . 3 . 436–449 . 10.1109/TMSCS.2018.2791531 . 52287374 . 2332-7766.
  6. Al-hayanni . Mohammed A. Noaman . Xia . Fei . Rafiev . Ashur . Romanovsky . Alexander . Shafik . Rishad . Yakovlev . Alex . July 2020 . Amdahl's law in the context of heterogeneous many-core systems – a survey . IET Computers & Digital Techniques . en . 14 . 4 . 133–148 . 10.1049/iet-cdt.2018.5220 . 214415079 . 1751-8601. free .