CSCI 3366 (Introduction to Parallel and Distributed Processing), Spring 2011:
Homework 3

Credit:
40 points.

Overview

Your mission for this assignment is write a parallel version of mathematician John Conway's ``Game of Life'', as described briefly in class. (You can also find more information on the Web. The Wikipedia article seems good.)

The Game of Life is not so much a game in the usual sense as a set of rules for a cellular automaton -- there are no players, and once the initial configuration is established, everything that happens is determined by the game's rules. The game is ``played'' on a rectangular grid of cells. Some cells are ``live'' (contain a simulated organism); others are ``dead'' (empty). At each time step, a new configuration is computed from the old configuration according to the following rules:

Details

Sequential starter program

To help you get started, I wrote a sequential C program with a simple text interface. Here it is, with the part of the program that actually does the calculations removed (but all the tedious stuff to get input and print output left in):

You might find it useful to start by filling in the parts of the code I left out and running the result a few times, to test that you understand how to do the computational part of the game. Comments in the code explain the command-line parameters and input file format, which let you choose between completely specifying the initial board configuration (reasonable for small problems) and having one generated at random (more useful for testing whether multiple UEs actually help). There is no really good way to represent 2D arrays in straight C (in my opinion); my code uses a struct and an array of arrays, which I think is the least-bad approach for this program.

Parallel programs

Your mission is to write two parallel versions of this application, one for distributed memory (using MPI) and one for shared memory (using OpenMP) Both parallel programs should produce exactly the same results as the original sequential program (except for timing information).

Performance of parallel programs

Once you have working parallel code, experiment with input values until you get a problem size/configuration big enough to make it reasonable to hope for good speedups with multiple UEs. (Think a little about what will affect this most -- size of board, number of steps, interval between printing results.) Then time your two parallel programs for this problem size/configuration and different numbers of UEs and plot the results, as in Homework 2.

What to turn in and how

Turn in the following:

Submit source code and other files by sending mail to bmassing@cs.trinity.edu, with each file as an attachment. Please use a subject line that mentions the course number and the assignment (e.g., ``csci 3366 homework 3''). If there's any question of which file(s) correspond to which problems, explain in the body of the mail message. You can develop your programs on any system that provides the needed functionality, but I will test them on one of the department's Fedora Linux machines, so you should probably make sure they work in that environment before turning them in.



Berna Massingill
2011-03-22