Professional Documents
Culture Documents
VL2020210104311 Fat PDF
VL2020210104311 Fat PDF
VL2020210104311 Fat PDF
Programme Name & Branch: B. Tech & CSE Date of Exam & Session: 02-11-2020 & AN
______________________________________________________________________________
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)
/ \
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]
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]
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)