Вы находитесь на странице: 1из 3

CS405 Parallel Computing

BS-Computer Science (SSUET)

LECTURE 4: PARALLEL COMPUTING METRICS


Briefly define the Amdahls Law? Amdahls Law Amdahls Law calculates the speedup of parallel code based on three variables: Duration of running the application on a single-core machine The percentage of the application that is parallel The number of processor cores Here is the formula, which returns the ratio of single-core versus Multicore performance.

This formula uses the duration of the application on a single-core machine as the benchmark. The numerator of the equation represents that base duration, which is always one. The dynamic portion of the calculation is in the denominator. The variable P is the percent of the application that runs in parallel, and N is the number of processor cores. Numerical 1: Suppose you have an application that is 75 percent parallel and runs on a machine with three processor cores. Find Speedup by using Amdahls Law? Solution: In the formula, P is 0.75 (the parallel portion) and N is 3 (the number of cores). Speedup = 1 (1 - 0.75) + (0.75 / 3) You can reduce that as follows: Speedup = 1 = 1 =2 0.25 + 0.25 0.5 The final result is a speedup of two. Your application will run twice as fast on a three processorcore machine. Numerical 2: If you have an algorithm in which only 50 percent (P = 0.50) of its total work is executed in parallel with two physical cores. An algorithm with 1,000 units of work split into 500 units of sequential work and 500 units of parallelized work. Find Speedup by using Amdahls Law? If the sequential version of code takes 1,000 seconds to complete then how long, the new version with some parallelized code will take? Solution: Maximum speed up (in times) = 1 / ((1 - 0.50) + (0.50 / 2)) = 1.33x
Lecturer: Engr. Muhammad Nadeem Page 1

CS405 Parallel Computing

BS-Computer Science (SSUET)

The final result is a speedup of 1.33. Your application will run 1.33 as fast on a two processor- core machine. 1000/1.33 = 750 seconds. Numerical 3: The maximum speedup for the same algorithm on a microprocessor with eight physical cores. Find Speedup by using Amdahls Law? If the sequential version of code takes 1,000 seconds to complete then how long, the new version with some parallelized code will take? Solution: Maximum speed up (in times) = 1 / ((1 - 0.50) + (0.50 / 8)) = 1.77x The final result is a speedup of 1.77. Your application will run 1.77 as fast on eight processor- core machine. 1000/1.77 = 562.5 seconds. Numerical 4: Find the maximum speedup for the algorithm according to the number of physical cores, from 1 to 16. In algorithm in which 90 percent (P = 0.90) of its total work is executed in parallel? Solution: Maximum speedup (in times) = 1 / ((1 - 0.90) + (0.90 / 16)) = 6.40x The final result is a speedup of 6.40. Your application will run 6.40 as fast on eight processor- core machine. Briefly define the Gustafsons Law? Gustafsons Law John Gustafson noticed that Amdahls Law viewed the algorithms as fixed, while considering the changes in the hardware that runs them. Thus, he suggested a reevaluation of this law in 1988. He considers that speedup should be measured by scaling the problem to the number of processors and not by fixing the problem size. When the parallel-processing possibilities offered by the hardware increase, the problem workload scales. Gustafsons Law provides the following formula with the focus on the problem size to measure the amount of work that can be performed in a fixed time: Total work (in units) = S + (N P)
Lecturer: Engr. Muhammad Nadeem Page 2

CS405 Parallel Computing Where:

BS-Computer Science (SSUET)

S represents the units of work that run with a sequential execution. P is the size of each unit of work that runs completely in parallel. N is the number of available execution units (processors or physical cores).

Numerical 1: You can consider a problem composed of 50 units of work with a sequential execution. The problem can also schedule parallel work in 50 units of work for each available core. If you have a microprocessor with two physical cores, find the maximum amount of work? Solution: Total work (in units) = 50 + (2 50) = 150 units of work

Numerical 2: The same algorithm can run on a microprocessor with eight physical cores. In this case find the maximum amount of work? Solution: Total work (in units) = 50 + (8 50) = 450 units of work

Efficiency of Multi-Core Processors: Speedup measures how much faster the parallel execution than the serial execution Efficiency measures how well the multi-core resources are utilized. Assume the number of cores is N and the speedup is S when executing program P Efficiency (P) = S(P) N

Lecturer: Engr. Muhammad Nadeem

Page 3

Вам также может понравиться