Supercomputing Applications

Lab 15 Report Form

Conway's Game of Life in Parallel

or Sharks and Fishes as a variant

Your name: __________________________________, Period: _____, Date __________

Paste in your completed code for golife and checkneighbors functions (a variation of these can be done for Sharks and Fishes):

void checkneighbors(struct individual board[ROWS][COLS], int rows,

int cols)

{

int row, col;

// Check the 1st and last rows, the 1st and last columns

// and the internal cells of the matrix (those not on the borders)

}

void golife(struct individual board[ROWS][COLS], int rows, int cols)

{

int row, col;

int count;

for(row=0; row<rows; row++) {

for(col=0; col<cols; col++) {

checkneighbors(board, rows, cols);

//Count the number of neighbors for each cell

}

}

for(row=0; row<rows; row++) {

for(col=0; col<cols; col++) {

// A dead cell with exactly three live neighbors becomes a live cell (birth).

// A live cell with two or three live neighbors stays alive (survival).

// In all other cases, a cell dies or remains dead (overcrowding

or loneliness).

}

}

}

Verify that your serial (non-parallel) version works using several of Life test patterns.

Parallel version 1 (without overlapping boundary effects). Test and verify a parallel version in which each processor is responsible for a fraction of the board. Pick patterns that stay in one location, so that a processor's effects for its fraction of the board does not depend upon the border(s) of another processor's fraction of the board.

Parallel version 2 (EXTRA). Test and verify a parallel version that works like a normal Life board. A particular processor's fraction of the board will need to communicate its border cells to other processor(s).

2006-02-08T14:15:41