The purpose of this programming assignment is to gain experience in parallel programming on a cluster and MPI. For this assignment, you have to write a parallel implementation of a program to simulate the Game of Life.
The game of life simulates simple cellular automata. The game is played on a rectangular board containing cells. At the start, some of the cells are occupied, the rest are empty. The game consists of constructing successive generations of the board. The rules for constructing the next generation from the previous one are:
Your program should read in a file containing the coordinates of the initial cells. Sample files are located here: life.1.250x250.data and life.2.250x250.data (250x250 board). You can also find many other sample patterns on the web (use your favorite search engine on "game of life" and/or "Conway").
Your program should take four command line arguments: the name of the data file, the number of generations to iterate, X_limit, and Y_limit. To be more specific, the command line of your program should be:
./life <input file name> <# of generations> <X_limit> <Y_limit>
The number of processes the program will run on is specified as part of the mpirun command with the -np argument.
mpirun -np <number of processes> ./life <input file name> <# of generations> <X_limit> <Y_limit>
Your program should write a single file called <input-file-name>.<no-of-generations>.csv
(from one designated rank) that contains comma separated values representing the board. There should be one line (containing the x coordinate, a
comma, and then the y coordinate) for each occupied cell at the end of the last
iteration.
Sample output files are available:
TIME: Min: 25.389 s Avg: 27.452 s Max: 41.672 s
where Min, Avg and Max time (in seconds) are calculated using MPI reduction operations over the individual time measurements of the "main" loop (over generations) on different processes for the sample final.500x500.data input file.
Figure out how you will decompose the problem for parallel execution. Remember that MPI (at least the OpenMPI implementation) does not always have great communication performance and so you will want to make message passing infrequent. Also, you will need to be concerned about static load balancing during data distribution/domain decomposition. To learn about decomposing the problem in different ways, you must generate two parallel versions of the program, one that uses a 1D decomposition (rows or columns) and one that uses a 2D decomposition (both rows and columns).
You must submit the following files and no other files:
life-1d.<ext>
: parallel version with 1D decomposition, where <ext> depends on the language used for implementation.
life-2d.<ext>
: parallel version with 2D decomposition
Makefile
that will compile your code successfully on deepthought2 when using mpicc or mpicxx. You can see a sample Makefile here. Make sure that the executable names are life1d and life2d and do not include the executables in the tarball.
--ntasks-per-node=8
and 16
)
to see the performance effects. In total, you will be running each program 10
times for 5 process counts X 2 cores/node settings. In the report, you should mention:
LastName-assign1
), compress it to .tar.gz (LastName-assign1.tar.gz
) and upload that to ELMS.
If you want to try a bigger board, to see if you can get better speedups with more processes, try running on the input file life.1000x1000.data.
The project will be graded as follows:
Component | Percentage |
---|---|
Runs correctly with 4 processes | 20 (10% each decomposition) |
Runs correctly with 16 processes | 30 (15% each decomposition) |
Performance with 4 processes | 20 (10% each decomposition) |
Speedup with 16 processes | 20 (10% each decomposition) |
Writeup | 10 |