Assignment
Assignment 10: Two-dimensional Game of Life with OpenMP
Completion requirements
Opened: Monday, 8 April 2024, 12:00 AM
Due: Monday, 15 April 2024, 11:59 PM
In this assignment, you will parallelize a given serial code that computes the two-dimensional game of life, of which we used a 1d version in assignments 2 and 3. Your assignment is as follows:
- First, git clone /scinet/course/phy1610/gameoflife. Then
'cd gameoflife', 'source teachsetup' and 'make' will create 'gameoflife'. An example can be run with "make run". The code comes with unit tests as well, which you can run with 'make test'. - The code will accept five command line arguments corresponding to the vertical and horizontal dimensions of the grid, the number of time steps to take and the approximate fraction of alive cells. The final argument, when set to "1", will change the output format from showing a 2d representation to a list of the index of alive cells, which is more efficient.
- Before starting parallelizing the code, create an integrated test.
- Parallelize the functions update_all_cells and output_alive_cells with OpenMP; check with the unit tests and the integrated test that the results remain unchanged.
- Write a single jobs script for the teach cluster that will run the parallelized code with arguments "1000 1000 1000 0.183 1", from 1 to 16 threads. The script (or the code itself) should time these calculations and store them in a table of thread numbers and corresponding runtimes in a file.
- Submit the job to the Teach cluster's scheduler and collect the timing output.
- Add the job script and the timing results to your repo.
As before, we expect you to use git and have several meaningful commits.
Submit your work by April 15, 23:59 PM. The usual late penalty applies.