zmir Kâtip Çelebi University
Department of Engineering Sienes
IKC-MH.57
Intro dution to High Performane and Parallel
Computing
Take-home Midterm Examination
Nov 24, 2023 16:00 De 18, 2023 23:59
Go o d Luk!
NAME-SURNAME:
SIGNATURE:
ID:
DEPARTMENT:
DURATION:
Due to De 18, 2023
Answer all the questions
Prepare your report/o de(s).
Copy your les into a diretory named
as your ID.
Upload a single le by ompressing
this diretory to UBYS.
Question Grade Out of
1 30
2.1 10
2.2 10
2.3 10
3 40
TOTAL
This page is intentionally left blank. Use the spae if needed.
1.
(30 Pts)
Summation of numb ers is p erformed both in serial and par-
allel ways. For parallel omputation, the environment is the networked
workstations and the sequential omputation is also done in the same
luster. (see the link:
MPI Hands-On; Performane Analysis)
i Complete the following tables. Data should b elong to your results.
N/Time
nproc = 1 nproc = 2 nproc = 3 nproc = 4 nproc = 5 nproc = 6
10000
N/Speed-Up
nproc = 2 nproc = 3 nproc = 4 nproc = 5 nproc = 6
10000
N/Eieny
nproc = 2 nproc = 3 nproc = 4 nproc = 5 nproc = 6
10000
ii Analyze the tables in detail.
iii How many pro essor should b e used for a sp ei value of
N
?
Why?
1
2. (30 Pts) Answer the following questions.
Cho ose only 3 of them.
i Desrib e the Flynn's lassiation for omputers. Whih type of
the omputer we have made use of ?
ii Is it p ossible to have a system eieny (E) of greater than %100?
Disuss.
iii Desrib e Blo king and Nonblo king Message-Passing.
iv Compare briey the p oint-to-p oint and olletive ommuniations.
v What ould b e your riteria to ho ose a shared- or distributed-
memory programming tehnique.
vi Disuss the onept of ommuniation overhead.
3. (40 Pts) The following
program alulates the fatorial as sequentially.
1
#i n l u d e < s t d i o . h>
2
#i n l u d e < s t d l i b . h>
3
# d e f i n e max _r ow s 2 0
4
i n t a r r a y [ m ax_ ro ws ;
5
i n t m a i n ( i n t a r g , h a r
* *
a r g v )
6
{
7
i n t i , nu m_ ro ws ;
8
l o n g i n t f a t o r i a l ;
9
p r i n t f ( " p l e a s e e n t e r t h e n u m b e r f o r t h e f a t o r i a l : " ) ;
10
s a n f ( "% i " , &n um _r ow s ) ;
11
i f ( nu m_ ro ws > max _ro ws ) {
12
p r i n t f ( " T o o many n u m b e r s . \ n " ) ;
13
e x i t ( 1 ) ;
14
}
15
/
*
i n i t i a l i z e a n a r r a y
*
/
16
f o r ( i = 0 ; i < n um_ ro ws ; i ++) {
17
a r r a y [ i = i + 1 ; }
18
/
*
o m p u t e f a t o r i a l
*
/
19
f a t o r i a l = a r r a y [ 0 ;
20
f o r ( i = 1 ; i < nu m_ row s ; i ++) {
21
f a t o r i a l
*
= a r r a y [ i ; }
22
p r i n t f ( " T h e %d ! i s % l i \ n " , num _r ow s , f a t o r i a l ) ;
23
}
Design a parallel version of the same program using MPI alls.
2