CSCI 3366 (Parallel and Distributed Programming), Fall 2021:
Homework 4

Credit:
30 points.

Reading

Be sure you have read, or at least skimmed, chapters 1 through 5 of the textbook.

What to turn in and how

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:

This problem clearly(?) fits our Geometric Decomposition pattern and is fairly straightforward to parallelize. However, it's unlikely that parallelization will improve performance unless the board size is large, and for large boards inputting and displaying (or printing) board configurations gets unwieldy. But it might be interesting to experiment with randomly-generated board configurations and observe how the number of live cells changes over time (does it settle down to a stable number? what and how soon?), so we'll do that.

Details

Sequential program

(5 points)

To help you get started, I wrote a sequential C program with a simple text interface, with command-line arguments that specify:

The program prints (to standard output) only counts of “live” cells at each step; if an output file is specified, it also writes initial and updated board configurations to it.

The starter code defines data structures, gets input, sets up the board, and writes output, but omits the code that implements the actual algorithm. (Comments with the word “FIXME” show you where you need to make changes/additions.)

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. Note that this program is almost identical to one of the CSCI 1120 homeworks, so you probably have the basic logic. What's different:

Parallel programs

(20 points)

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

OpenMP program

This one should be fairly straightforward. As with the OpenMP programs for previous homeworks, have the program get the number of threads to use from environment variable OMP_NUM_THREADS and print with the timing information the number of threads used.

MPI program

This one is less straightforward, but doable. As with the MPI programs for previous homeworks, have the program print with the timing information the number of processes used. Suggestions:

Performance of parallel programs

(5 points)

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 your program source code, plots, and input data by putting them in your “turn-in” folder.

Essay and pledge

Include with your assignment the following information.

For programming assignments, please put it a separate file. (I strongly prefer plain text, but if you insist you can put it in a PDF -- just no word-processor documents or Google Drive links please.) For written assignments, please put it in your main document.

Pledge

This should include the Honor Code pledge, or just the word “pledged”, plus at least one of the following about collaboration and help (as many as apply). Text in italics is explanatory or something for you to fill in; you don't need to repeat it!

Essay

This should be a brief essay (a sentence or two is fine, though you can write as much as you like) telling me what if anything you think you learned from the assignment, and what if anything you found interesting, difficult, or otherwise noteworthy.




2021-12-04