You are on page 1of 16

CSNB594/4423 Parallel Computing (2022)

Assignment 2 (30 marks, 15%)


#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:

Instructions:
 Answer ALL questions.
 All programs should be written in C language and run on Google Colab.
 Provide the complete source code and output of each program.
 Submission must be made by every group member.

Given Figure 1 that represents a task decomposition diagram of a serial program.

Figure 1 Task decomposition diagram

You are required to declare and initialize 3 arrays: A, B, and multiplyAB, and 2
variables totalA and totalB. Array A should consist of 10 elements: 1,2,3,4,5,6,7,8,9,
and 10, while array B should consist of 10 elements: 100, 200, 300, 400, 500, 600,
CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:

700, 800, 900, and 1000. The totalA variable should consists of the total of all elements
value in the array A. The totalB variable should consists of the total of all elements
value in the array B. The multiplyAB array should consists of the multiplication between
each element in A and B.

Due date: 24 November 2022 11.59 PM


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:

Question 1
Based on Figure 1, answer the following questions:
(a) Illustrate a task decomposition diagram that is suitable for a symmetric
multiprocessing (SMP) solution using OpenMP.
(b) Write a parallel program that applies OpenMP based on (a).

Question 2
Based on Figure 1, answer the following questions:
(a) Illustrate a task decomposition diagram that is suitable for a cluster solution using
Message Passing Interface (MPI).
(b) Write a parallel program that applies MPI based on (a).

Question 3
Based on Figure 1, answer the following questions:
(a) Illustrate a task decomposition diagram that is suitable for a hybrid solution using
MPI and OpenMP.
(b) Write a parallel program that applies MPI and OpenMP based on (a).
CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:

Marks 0 1–2 3–4 5 Tota


l
Question 1
(a) Task Unclear Problem Problem Problem
decompositio or no decomposition decomposition decompositio
n diagram correct but not suitable but minimal n with
answer for parallel parallel solution optimum
provide solution with/ with/ without the independent
d without the correct labels tasks with the
correct labels correct labels
(b) Parallel Unclear The program The program The program
program or no written is written is written is
correct enabling parallel enabling parallel enabling
answer but not following and following the parallel and
provide the task task following the
d decomposition decomposition task
diagram in (a), diagram in (a) decompositio
with with n diagram in
minimal/sufficien minimal/sufficien (a) with detail
t OpenMP t OpenMP OpenMP
directives/ directives/ directives/
functions functions functions

Question 2
(a) Task Unclear Problem Problem Problem
decompositio or no decomposition decomposition decompositio
n diagram correct but not suitable but minimal n with
answer for parallel parallel solution optimum
provide solution with/ with/ without the independent
d without the correct labels tasks with the
correct labels correct labels
(b) Parallel Unclear The program The program The program
program or no written is written is written is
correct enabling parallel enabling parallel enabling
answer but not following and following the parallel and
provide the task task following the
d decomposition decomposition task
diagram in (a), diagram in (a) decompositio
with with minimal/ n diagram in
minimal/sufficien sufficient MPI (a) with detail
CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:

t MPI directives/ directives/ MPI


functions functions directives/
functions

Question 3
(a) Task Unclear Problem Problem Problem
decompositio or no decomposition decomposition decompositio
n diagram correct but not suitable but minimal n with
answer for parallel parallel solution optimum
provide solution with/ with/ without the independent
d without the correct labels tasks with the
correct labels correct labels
(b) Parallel Unclear The program The program The program
program or no written is written is written is
correct enabling parallel enabling parallel enabling
answer but not following and following the parallel and
provide the task task following the
d decomposition decomposition task
diagram in (a), diagram in (a) decompositio
with with minimal/ n diagram in
minimal/sufficien sufficient hybrid (a) with detail
t hybrid of MPI of MPI and hybrid of MPI
and OpenMP OpenMP and OpenMP
directives/ directives/ directives/
functions functions functions

Total Marks
CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:

ANSWERS
Question 1
(a)
(b)
Question 2
(a)
(b)
Question 3
(a)
(b)

Convert this word document into pdf and rename the file to:
CSNB594CSNB4423 A2 <section> <student1 ID><student2 ID><student3
ID><student4 ID><student5 ID>.pdf before the submission.

Submission type: Online


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:


CSNB594/4423 Parallel Computing (2022)
Assignment 2 (30 marks, 15%)
#1 Student Student Name:HARVEEN A/L VELAN Section #:01 A
ID:SW0104101
#2 Student ID: Student Name: Section #:

#3 Student ID: Student Name: Section #:

#4 Student ID: Student Name: Section #:

#5 Student ID: Student Name: Section #:

You might also like