Lecture 02
Lecture 02
Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Efficiency and
(CS-3216) Scalability of a
Parallel Algorithm
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Preliminaries Efficiency and
Scalability of a
Parallel Algorithm
Reference Books
Amdahl’s Law
Reference Books
Parallel and
Agenda Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Preliminaries Efficiency and
Scalability of a
Parallel Algorithm
Reference Books
Amdahl’s Law
Reference Books
Parallel and
Multi-programming Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Department of CS,
GCU, Lahore
Preliminaries
Department of CS,
GCU, Lahore
Amdahl’s Law
multiprogramming
Efficiency and
▶ In time-sharing systems, the CPU executes multiple jobs Scalability of a
Parallel Algorithm
by switching among them, but the switches occur so Reference Books
frequently that the users can interact with each
program while it is running
▶ A time-shared operating system allows many users to
share the computer simultaneously
▶ As the system switches rapidly from one user to the
next, each user is given the impression that the entire
computer system is dedicated to his use, even though it
is being shared among many users
Parallel and
Time sharing (Multi-Tasking) Distributed
Computing
Department of CS,
GCU, Lahore
Amdahl’s Law
multiprogramming
Efficiency and
▶ In time-sharing systems, the CPU executes multiple jobs Scalability of a
Parallel Algorithm
by switching among them, but the switches occur so Reference Books
frequently that the users can interact with each
program while it is running
▶ A time-shared operating system allows many users to
share the computer simultaneously
▶ As the system switches rapidly from one user to the
next, each user is given the impression that the entire
computer system is dedicated to his use, even though it
is being shared among many users
Parallel and
Time sharing (Multi-Tasking) Distributed
Computing
Department of CS,
GCU, Lahore
Amdahl’s Law
multiprogramming
Efficiency and
▶ In time-sharing systems, the CPU executes multiple jobs Scalability of a
Parallel Algorithm
by switching among them, but the switches occur so Reference Books
frequently that the users can interact with each
program while it is running
▶ A time-shared operating system allows many users to
share the computer simultaneously
▶ As the system switches rapidly from one user to the
next, each user is given the impression that the entire
computer system is dedicated to his use, even though it
is being shared among many users
Parallel and
Multi-processing vs Multi-threading Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Preliminaries Efficiency and
Scalability of a
Parallel Algorithm
Reference Books
Amdahl’s Law
Reference Books
Parallel and
Amdahl’s Laws Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Efficiency and
Scalability of a
Parallel Algorithm
Department of CS,
GCU, Lahore
Preliminaries
Efficiency and
increase of performance of parallel algorithm compared Scalability of a
Parallel Algorithm
to sequential algorithm
Reference Books
▶ It is the ratio of sequential execution time to parallel
execution time
▶ Suppose you have a sequential code for a problem that
can be executed in total T (s) time, and T (p) be the
parallel time for the same algorithm over p processors,
then speedup is calculated as follows:
▶ Speedup = T (s)
T (p)
Parallel and
Speedup Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Efficiency and
increase of performance of parallel algorithm compared Scalability of a
Parallel Algorithm
to sequential algorithm
Reference Books
▶ It is the ratio of sequential execution time to parallel
execution time
▶ Suppose you have a sequential code for a problem that
can be executed in total T (s) time, and T (p) be the
parallel time for the same algorithm over p processors,
then speedup is calculated as follows:
▶ Speedup = T (s)
T (p)
Parallel and
Amdahl’s Laws Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Efficiency and
▶ Suppose that fraction of total time that the algorithm Scalability of a
Parallel Algorithm
must consume in serial executions is f Reference Books
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Efficiency and
▶ Suppose that fraction of total time that the algorithm Scalability of a
Parallel Algorithm
must consume in serial executions is f Reference Books
Department of CS,
GCU, Lahore
Preliminaries
▶ S= 1
f + 1−f
p
Parallel and
Derivation Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
▶ S= 1
f + 1−f
p
Parallel and
Derivation Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
▶ S= 1
f + 1−f
p
Parallel and
Derivation Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
▶ S= 1
f + 1−f
p
Parallel and
Amdahl’s Laws Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Efficiency and
Scalability of a
Parallel Algorithm
▶ S= 1
Reference Books
f + 1−f
p
▶ What if you have infinite number of processors?
▶ What you have to do for further speedup?
Parallel and
Amdahl’s Laws Examples Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
▶ Suppose 70% of a sequential algorithm is parallelizable Amdahl’s Law
Department of CS,
GCU, Lahore
Preliminaries
▶ Suppose 70% of a sequential algorithm is parallelizable Amdahl’s Law
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Efficiency and
Scalability of a
▶ (Bonus Question) From the maximum speedup obtain Parallel Algorithm
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Preliminaries Efficiency and
Scalability of a
Parallel Algorithm
Reference Books
Amdahl’s Law
Reference Books
Parallel and
Parallel Efficiency Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Efficiency and
Scalability of a
Parallel Algorithm
▶ Parallel efficiency is the measure of effectiveness of the Reference Books
resource utilization. It is the ratio of speedup to the
number of compute nodes
▶ E = speedup
p
Parallel and
Scalability Distributed
Computing
Department of CS,
GCU, Lahore
Amdahl’s Law
▶ Informally, a technology is scalable if it can handle
Efficiency and
ever-increasing problem sizes. Scalability of a
Parallel Algorithm
▶ However, in discussions of parallel program performance, Reference Books
Department of CS,
GCU, Lahore
Amdahl’s Law
▶ Informally, a technology is scalable if it can handle
Efficiency and
ever-increasing problem sizes. Scalability of a
Parallel Algorithm
▶ However, in discussions of parallel program performance, Reference Books
Department of CS,
GCU, Lahore
Amdahl’s Law
▶ Informally, a technology is scalable if it can handle
Efficiency and
ever-increasing problem sizes. Scalability of a
Parallel Algorithm
▶ However, in discussions of parallel program performance, Reference Books
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Preliminaries Efficiency and
Scalability of a
Parallel Algorithm
Reference Books
Amdahl’s Law
Reference Books
Parallel and
Reference Books Distributed
Computing
Department of CS,
GCU, Lahore
Preliminaries
Amdahl’s Law
Efficiency and
▶ Introduction to Parallel Computing, Second Scalability of a
Parallel Algorithm
Edition, by Ananth Grama
Reference Books
▶ Parallel programming in C with MPI and OpenMP by
Michael J. Quinn
▶ An Introduction to Parallel Programming by Peter S.
Pacheco
▶ Professional CUDA C Programming by John Cheng