VL2020210104311 Fat PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

SCHOOL OF COMPUTER SCIENCE ENGINEERING

FALL SEMESTER 2020-2021

FINAL ASSESSMENT TEST Slot: ELA (L33 + L34) Class: VL2020210104311

Programme Name & Branch: B. Tech & CSE Date of Exam & Session: 02-11-2020 & AN

Course Code & Title: CSE4001-Parallel and Distributed Computing (ELA)

Faculty Name: Dr. K. Murugan Total No of Students: 67

Exam Duration: 60 Minutes Maximum Marks: 50

______________________________________________________________________________

SET A:

1)
a) Use OpenMP to implement a producer-consumer program in which some of the
threads are producers and others are consumers. The producers read text from a
collection of files, one per producer. They insert lines of text into a single shared queue.
The consumers take the lines of text and tokenize them. Tokens are “words” separated
by white space. When a consumer finds a token, it writes it to stdout. [25 MARKS]

b) Write a C program to use MPI_Reduce that divides the processors into the
group to find the addition independently. [25 MARKS]
SET B:

2)

a) Develop an OpenMP example program for producer and consumer problem.


Producer will generate random numbers between 0 and 99; consumers will grab
them, maintaining global sums, with everyone stopping when sums exceed a
given level. [25 MARKS]

b) Consider a set of processes arranged in a ring as shown below. Use a token


passing method to compute the sum of the ranks of the processes. [25 MARKS]

/ \

0 2

\ /

3
SET C:

3
a) Assume that a program generates large quantities of floating point data that is
stored in an array. In order to determine the distribution of the data, we can make
a histogram of the data. To make a histogram, we simply divide the range of the
data up into equal sized subintervals, or bins; determine the number of
measurements in each bin; and plot a bar graph showing the relative sizes of the
bin. Use MPI to implement the histogram. [25 MARKS]

b) Using openMP, design, develop and run a multi-threaded program to generate


and print Armstrong numbers. One thread has to generate the numbers up to the
specified limit N=2020 and another thread has to print them. [25 MARKS]
SET D:

4)
a). Conway‟s Game of Life is played on a rectangular grid of cells that may or may
not contain an organism. The state of the cells is updated each time step by
applying the following set of rules:
 Every organism with two or three neighbours survives.
 Every organism with four or more neighbours dies from overpopulation.
 Every organism with zero or one neighbours dies from isolation.
 Every empty cell adjacent to three organisms gives birth to a new one. Create an
MPI program that evolves a board of arbitrary size (dimensions could be specified
at the command line) over several iterations. The board could be randomly
generated or real from a file. Try applying the geometric decomposition pattern to
partition the work among your process. [25 MARKS]

b) Write an open MP program using C to perform the arithmetic operations using


various threads and find total time taken? [25 MARKS]
SET E:

i) Write a code that sets a real variable on each of N processors equal to MPI rank
(Task ID) of the task. Then write your own routine to perform a reduction operation
over all processors to sum the values using only MPI rank and MPI Recv calls. Do
this global reduction operation using the following communication algorithms:
a. Communications in a ring.
b. Hypercube communications.
Put in timing calls using MPI WTime to test the timing of your routines compared to
using the MPI routine MPI Allreduce to do the same computation. [25 MARKS]

ii) Write an OpenMp program using C to find maximum and minimum among three
numbers by using two threads. [25 MARKS]
SET F:

6)

a) Develop an OpenMP example program for producer and consumer problem.


Producer will generate random numbers between 0 and 99; consumers will grab
them, maintaining global sums, with everyone stopping when sums exceed a
given level. [25 MARKS]

b) Write an MPI program for Broadcasting by using MPI_Send and MPI_Recv .


[25 MARKS]

You might also like