23
Computer Science 320 Measuring Speedup

Computer Science 320

  • Upload
    carlyn

  • View
    52

  • Download
    0

Embed Size (px)

DESCRIPTION

Computer Science 320. Measuring Speedup. What Is Running Time?. T ( N , K ) says that the running time T is a function of the problem size N and the number of processors K - PowerPoint PPT Presentation

Citation preview

Page 1: Computer Science 320

Computer Science 320

Measuring Speedup

Page 2: Computer Science 320

What Is Running Time?

• T(N, K) says that the running time T is a function of the problem size N and the number of processors K

• To determine speedup, we’ll always determine both Tseq(N, K) and Tpar(N, K), where K = 1 and K > 1, respectively

Page 3: Computer Science 320

What Is Speed?

• Speed is the rate at which program runs can be done

• S(N, K) = 1 / T(N, K)

• Measured in program runs per second, rather than seconds per run

Page 4: Computer Science 320

What Is Speedup?

• Speedup is the speed of a parallel version running on K processors relative to a sequential version running on one processor

• Speedup(N, K) = Spar(N, K) / Sseq(N, 1)

• Why seq in the denominator?

Page 5: Computer Science 320

Speedup in Terms of Running Time

Speedup(N, K) = Tseq(N, K) / Tpar(N, K)

Ideally, the speedup should equal K, or a linear speedup

The real speedup of most algorithms is sublinear

Page 6: Computer Science 320

What Is Efficiency?

Eff(N, K) = Speedup (N, K) / K

Usually a fraction < 1

Page 7: Computer Science 320

Amdahl’s Law

• The sequential portion of a parallel program puts an upper bound on the efficiency it can achieve

• The sequential parts are usually run at startup and cleanup

Page 8: Computer Science 320

What Is the Sequential Fraction?

• The sequential fraction F is the fraction of the code that must be run sequentially

• F * T(N, 1) is the running time of the sequential part on a single processor

• (1 – F) * T(N, 1) is the running time of the parallel part on a single processor

Page 9: Computer Science 320
Page 10: Computer Science 320

Amdahl’s Law

T(N, K) = F * T(N, K) + 1/K * (1 – F) * T(N, K)

Running time when the parallel part is equally divided among K processors

Page 11: Computer Science 320

Speedup and Efficiency in Terms of Sequential Fraction

Speedup(N, K) = 1 / (F + (1 – F) / K)

Eff(N, K) = 1 / (K * F + 1 – F)

Page 12: Computer Science 320

Consequences of Amdahl

• As K increases, the speedup approaches 1 / F

• As K goes to infinity, the efficiency approaches 0

Page 13: Computer Science 320

Predicted Speedups

Page 14: Computer Science 320

Predicted Efficiencies

Page 15: Computer Science 320

A Normal Plot for up to 8 Processors

Page 16: Computer Science 320

Experimentally Determining F

To calculate the sequntial fraction F from the running time measurements, we rearrange Amdahl’s Law to get

F = (K * T(N, K) - T(N, 1)) / (K * T(N, 1) - T(N, 1))

Called EDSF

If F is not a constant or EDSF versus K is not a horizontal line, something’s not right with the program

Page 17: Computer Science 320

Measuring Running Times

• Not the same on each run with the same data set

• Take the minimum time of several runs, not the average time. Why?

Page 18: Computer Science 320

Experimental Situation

• Close all unnecessary apps and prevent remote logins

• Tseq(N, 1) must be at least 60 seconds

• Run the sequential program 7 times on each data size N, and take the minimum time

Page 19: Computer Science 320

Experimental Situation

• For each data size N and for each K from 1 up to the number of available processors, run Tpar(N, K) 7 times and take each minimum time

Page 20: Computer Science 320

Running Time of Key Search

Page 21: Computer Science 320

Speedup of Key Search

Page 22: Computer Science 320

Efficiency of Key Search

Page 23: Computer Science 320

EDSF of Key Search