Make-up assignment: MPI histogram
Who this assignment is intended for:
The assignment below needs to be done by students who have missed one of the ten homework assignments for this course, as well as for students that want to improve one of the graded of their ten submitted assignments. For the latter, the grade of this assignment will replace their lowest grade of the ten assignments.
This assignment:
You are given a large (12 GB) binary data file
manyants.bin produced by the antsonruler application from the last assignment. This binary file contains
a number of time snapshots of the number of ants on each grid point on
the ruler. You don't need to use the the whole antsonruler application yourself in this assignment, but some of its modules will come in handy.
You will also need to use that the binary output format of antsontuler is as follows:
- Four bytes to store an integer nrows, which is the number of rows of the matrix to follow. Because antsonruler is a 1d problem, nrows will always be equal to 1 here, but still need to be read in.
- Four bytes to store an integer ncols, which is the number of columns of the matrix to follow. This is equal to the length of the ruler.
- nrows*ncols integers (each 4 bytes), which are the number of ants on the subsequent points of the ruler.
- The above is repeated for every time snap shot.
We want you to determine the histogram of the number of ants, i.e., which fraction of grid points has zero ants, which fraction has 1 ants, 2 ants, and so on, for each time snapshot separately.
Your assignment is to write an MPI application antshisto that computes the histograms and writes them to screen. The output to screen can be a simple table with one column being ant number and the second column being the number of grid points that have that number of ants, repeated for every time snapshot.
Start by copying, on the teach cluster:
cp -r /scinet/course/phy1610/antshisto $SCRATCH
This gets you the start of the code for antshisto.cpp the Makefile and the data. It includes the params.ini file with the parameters used to generate the data, as well as the parameters and ticktock modules from the previous assignments. You must complete the MPI code in antshisto.cpp to do the following:
- Read in the parameters from the params.ini file.
- For each time step:
- read the data in from the in parallel (ideally with MPI-IO, but standard file I/O will also work), such that every MPI process only reads part of the data.
- compute the per-time-step histogram (combining results of all MPI processes)
- one MPI process should write the histogram to screen.
- Time the complete process with ticktock.
Write a script to run the analysis with 1, 2, 4, 8, and 16 processes and determine the speedup. Produce a scaling plot of the speedup as a function of the number of processors. Include this script and the plot in your git repo.
Use git version control, comments, and other best practices.
Submit your code using git2zip.
The due date for this assignment is Monday April 26, 11:55 PM. No late submissions will be accepted for this make-up assignment.