CMSC 818Z- High Performance Computing

Spring 1999 - Programming Assignment

Due (in class) Feb 23, 1999

The purpose of this programming assignment is to gain experience in parallel programming and PVM. For this assignment you are 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:

    1. death: cells with 0,1,4,5,6,7, or 8 neighbors die (0,1 of loneliness and 4-8 of over population)
    2. survival: cells with 2 or 3 neighbors survive to the next generation.
    3. birth: an unoccupied cell with 3 neighbors becomes occupied in the next generation.

For this project the game board has finite size. The x-axis starts at 0 and ends at X_limit-1 (supplied on the command line). Likewise, the y-axis start at 0 and ends at Y_limit-1 (supplied on the command line).

INPUT

Your program should read in a file containing the coordinates of the initial cells. A sample files are located in ~hollings/cmsc818z/prog/life.data.* on the junk food cluster. 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 five command line arguments: the name of the data file, the number of processes to invoke (including the initial one), the number of generations to iterate, X_limit, and Y_limit.

OUTPUT

Your program should print out one line (containing the x coordinate, a space, and then the y coordinate) for each occupied cell.

HINTS

The goal of is not to write the most efficient implementation of Life, but rather to learn parallel programs.

Figure out how you will decompose the problem for parallel execution. Remember that PVM does not have great communication performance and so you will want to make message passing infrequent. Also, you will need to be concerned about load balancing.

One you have decided how to decompose the problem, write the sequential version first.

WHAT TO TURN IN

You should submit your program and the times to run it on the input file ~hollings/818/final.data (for 1, 2, and 4 processes).

You also must submit a short report about the results (1-2 pages) that explains:

RUNNING PVM

To run PVM, you need to set a few environment variables:

# setup PVM environment

setenv PVM_ROOT $HOME/pvm3

setenv PVM_ARCH `$PVM_ROOT/lib/pvmgetarch`

setenv XPVM_ROOT $PVM_ROOT/xpvm

Also, you need to:

1) create the directory $home/pvm3.

2) create a subdirectory $home/pvm3/bin/SUN4.

3) ln -s /usr/imports/pvm/lib $home/pvm3/lib.

Finally, you need to add pvm to your path, I use:

set path = ($path $HOME/pvm3/lib/$PVM_ARCH)

A useful resource is the PVM programmers reference card available from:

http://www.netlib.org/pvm3/refcard.ps

By default PVM does not send the results of print statements by spawned processes to standard output. You can change this behavior by calling pvm_catchout(stdout) just before calling pvm_spawn. This will cause the output of each process to appear on standard output, and each line will be prefixed by the PVM task id that generated the output.