You are on page 1of 23

Amdahl’s Law

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 1


• Suppose, Moni have to attend an invitation.
• Moni’s another two friend Diya and Hena are also invited.
• There are conditions that all three friends have to go
there separately and all of them have to be present at
door to get into the hall.
• Now Moni is coming by car, Diya by bus and Hena is
coming by foot.
• Now, how fast Moni and Diya can reach there it doesn’t
matter, they have to wait for Hena.
• So to speed up the overall process, we need to
concentrate on the performance of Hena other than
Moni or Diya

Amdahl’s Law relates the improvement of the system’s


performance with the parts that didn’t perform well,

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 2


Amdahl’s law
Amdahl's law is an expression used to find the
maximum expected improvement to an overall
system when only part of the system is improved.
• Used in parallel computing to predict the theoretical
maximum speedup using multiple processors.

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 3


Expression
• Amdahl’s law is generally written as:
'
• 𝑆𝑝𝑒𝑒𝑑𝑢𝑝 = 9:45;<=212342567
'()*+,-./012342567 8
>45;=: =9 ?@A:=B6@62;

• 𝑆𝑝𝑒𝑒𝑑𝑢𝑝 be denoted as 𝑆
• 𝑓𝑟𝑎𝑐𝑡𝑖𝑜𝑛K0L+0,MN be denoted as 𝑓K
• 𝑓𝑎𝑐𝑡𝑜𝑟 𝑜𝑓 𝑖𝑚𝑝𝑟𝑜𝑣𝑒𝑚𝑒𝑛𝑡 be denoted as 𝑓Q
• Amdahl’s Law can be rewritten as:
1
𝑆=
𝑓K
1 − 𝑓KComputing
+ (Sem V)
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed
𝑓Q 4
1
𝑆=
𝑓K
1 − 𝑓K +
𝑓Q

Enhancement 1 Enhancement 2
Speedup of 20 on 10 % of code. Speedup of 1.6 on 80 % of code
1 1
𝑆= 𝑆=
0.1 0.8
1 − 0.1 + 20 1 − 0.8 + 1.6
S=1.105 S= 1.43
Infinite speed up on 10% code?

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 5


The execution time of half of the program is
increased by a speed up factor of 2. What is the
program speed up overall?
1
𝑆=
𝑓K
1 − 𝑓K +
𝑓Q
𝑓Q = 4 à Speedup 1.6
• 𝑓K à 50 % = 0.5
𝑓Q = 100 à Speedup 1.98
• 𝑓Q à 2 𝑓Q = 1000 à Speedup 1.998
𝑓Q = 10000 à Speedup 1.9998
1
Overall Speed up S = 0.5 = 1.33
1 − 0.5 + 2

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 6


Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 7
Predict System Speedup

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 8


Predict Speedup of Fraction
Enhanced

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 9


1.3 1.3

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 10


OpenMP
Installation on LinuX
• Steps for Installation of OpenMP
• STEP 1: Check the GCC version of the compiler
gcc --version
• STEP 2: If the system doesn’t have the GCC compiler, we can
use the following command
sudo apt install gcc
• STEP 3: Configuring OpenMP
check whether the OpenMP are configured into our compiler
or not, using the command
echo |cpp -fopenmp -dM |grep -i open
• Step 4: Install OpenMP
sudo apt install libomp-dev
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 11
First Program

Compile: gcc -fopenmp -o test test.c


Execute: ./test

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 12


Installation in Windows
(Codeblocks + MinGW)

Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 13


Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 14
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 15
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 16
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 17
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 18
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 19
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 20
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 21
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 22
Dr Vengadeswaran Asst. Prof. ICS311 Parallel and Distributed Computing (Sem V) 23

You might also like