MP6 - Course Website Directory

advertisement
CS 420/CSE 402/ECE 492
Introduction to Parallel Programming for Scientists and
Engineers
MP 6 – MPI
Due Wednesday, November 28th 2012 at 11:59 pm
Problem Statement
You have to write parallel MPI programs to implement the game of life as described in problem
6.13 of Michael J. Quinn’s book Parallel programming in C with MPI and OpenMP.
Problem 6.13. In 1970, Princeton mathematician John Conway invented the game of Life. Life
is an example of a cellular automaton. It consists of a rectangular grid of cells. Each cell is in one
of two states: alive or dead. The game consists of a number of iterations. During each iteration a
dead cell with exactly three neighbors becomes a live cell. A live cell with two or three
neighbors stays alive. A live cell with less than two neighbors or more than three neighbors
becomes a dead cell. All cells are updated simultaneously. Figure 6.12 illustrates three iterations
of Life for a small grid of cells.
Write a parallel program that reads from a file and m × n matrix containing the initial stage of the
game. It should play the game of Life for j iterations, printing the state of the game once every k
iterations, where j and k are command-line arguments. □
Figure 6.12. An initial state and three iterations of Conway’s game of Life
The Wikipedia link - http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
Note that every cell has 8 neighbors and the living cells are shown in black, and the dead cells in
white.
Students registered for 4 credits are also required to write a parallel MPI program for the
problem 4.12 (Simpson’s 1/3rd rule for integration) from Michael J. Quinn’s book Parallel
programming in C with MPI and OpenMP:
Problem 4.12. Simpson’s rule is a better numerical integration algorithm than the rectangle rule
b
(presented in class) because it converges more quickly. Suppose we want to compute  f ( x )dx .
a
We divide the interval [a , b] into n subintervals, where n is even. Let xi denote the end of the ith
interval for 1  i  n and let x0 denote the beginning of the first interval. According to
Simpson’s Rule:
b
n /2
1 

f
(
x
)
dx

f
(
x
)

f
(
x
)

 4 f ( x2i 1 )  2 f ( x2i 

0
n
a

3n 
i 1

Write an MPI program to compute the value of  using Simpson’s Rule:
f ( x )  4 / (1  x 2 ), a  0, b  1, n  50
Deliverables
For both these problems, make a single report file named README. In this file:
 Explain the parallelization strategy that you have used
 The command that you used to execute your program.
 Timings that you obtain for 2-40 MPI processes for both the problems.
 Speedup curve for both the problems
 Efficiency curve for both the problems
Language and Machines
Use C language with MPI to write your programs. We will use the MTL machines to test the
performance.
Using MPI on MTL
MPI is made available to you on the MTL machines at /home/dapa/mpich2-install /bin/.
To use MPI, issue the command
export PATH=/home/dapa/mpich2-install/bin:$PATH
This script will point your PATH variable to the appropriate directory. This command needs to
be executed only once.
Then you can use the following command to compile your program –
mpicc –o executable_name file_name.c
You can execute the programs (if your executables are in the current directory) as follows
mpirun –n #processes ./executable_name <paramaters>
Test your programs for 2-40 MPI processes.
Download