View
52
Download
0
Category
Preview:
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
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
• To determine speedup, we’ll always determine both Tseq(N, K) and Tpar(N, K), where K = 1 and K > 1, respectively
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
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?
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
What Is Efficiency?
Eff(N, K) = Speedup (N, K) / K
Usually a fraction < 1
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
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
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
Speedup and Efficiency in Terms of Sequential Fraction
Speedup(N, K) = 1 / (F + (1 – F) / K)
Eff(N, K) = 1 / (K * F + 1 – F)
Consequences of Amdahl
• As K increases, the speedup approaches 1 / F
• As K goes to infinity, the efficiency approaches 0
Predicted Speedups
Predicted Efficiencies
A Normal Plot for up to 8 Processors
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
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?
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
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
Running Time of Key Search
Speedup of Key Search
Efficiency of Key Search
EDSF of Key Search
Recommended