Recap

8
1 Recap Recap

description

Recap. Amdahl’s Law. Performance impact of optimizing part of a program: Let an optimization speedup f fraction of time by a factor of s : New Time = OldTime x [(1-f) x 1 + f x (1/s)] Speedup = s > 1.0 for speedup, f

Transcript of Recap

Page 1: Recap

1

RecapRecap

Page 2: Recap

2

Amdahl’s Law• Performance impact of optimizing part of a program:

• Let an optimization speedup f fraction of time by a factor of s:

– New Time = OldTime x [(1-f) x 1 + f x (1/s)]

– Speedup =

• s > 1.0 for speedup, f <= 1.0 as it is a fraction

NewTime

OldTimeSpeedup

sf

fsf

fOldTime

OldTime

1

1

])1[(

Page 3: Recap

3

Amdahl’s Law

Old Time New Time

= s

Page 4: Recap

4

Example 1

Which change is more effective on a certain Processor: speeding up 10-fold the floating point square root operation only, which takes up 20% of execution time, or speeding up 2-fold all floating point operations, which take up 50% of total execution time? (Assume that the cost of accomplishing either change is the same, and thetwo changes are mutually exclusive.)

Which change is more effective on a certain Processor: speeding up 10-fold the floating point square root operation only, which takes up 20% of execution time, or speeding up 2-fold all floating point operations, which take up 50% of total execution time? (Assume that the cost of accomplishing either change is the same, and thetwo changes are mutually exclusive.)

SPEEDUPSQ = 1/((1-0.2) + (0.2/10)) = 1.22, or 22%

SPEEDUPFP = 1/((1-0.5) + (0.5/2)) = 1.33, or 33%

Page 5: Recap

5

Example

SPEEDUPSQ = 1/((1-0.2) + (0.2/10)) = 1.22, or 22%

SPEEDUPFP = 1/((1-0.5) + (0.5/2)) = 1.33, or 33%

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Sqrt (b) Sqrt (a) FP (b) FP (a)

Page 6: Recap

6

Amdahl’s Law

Law of Diminishing Returns: The Performance Enhancement Possible Is Limited By the Amount That the Improved Feature Is Used.

Page 7: Recap

7

Example

• A server spends 50% of CPU time on I/O and 50% on computation. What is the speedup if we replace the CPU with one that is 8 times faster?

enhancementspeedup overall

enhancement

enhancement

enhanc sement peedup overall

2n1n

0.5 n 11 0.5n

n 8 n 1.77

1

1.1

1.2

1.3

1.4

1.5

1.6

1.7

1.8

1.9

2

1 3 5 7 9 11 13 15 17 19 21 23 25 27

Enhancement Factor

Sp

eed

up

Page 8: Recap

8

• Suppose a program takes 1 unit of time to execute serially

• A fraction of the program, s, is inherently serial (unparallelizable)

• For example, consider a program that, when executing on one core processor, spends 20% of its time in a non-parallelizable region. How much faster will this program run on a 4-processor system?

• What is the maximum speedup from parallelization? 5

Multi-Core (parallelism) and Amdah’s law

New Execution Time

=1-s

+ sP

New Execution Time =.8T

+ .2T = 0.4T4

Speedup =1T/0.4T = 2.5