10. MPI Ants
The ants return! But this time, they are crawling on a one-dimensional 'ruler' instead of a table. Start from the antsonruler code:
git clone /scinet/course/phy1610/antsonrulerThis modularized serial version is very similar to the 2d version antsonatable that you modularlized in assignment 2. However, note that the current code uses guard cells to take into account that ants falls off on the ends of the ruler. It also produces binary output.
Your assignment is to find the concurrency in this program and parallelize it using MPI. Use a domain decomposition approach as outlined in class. For I/O, for simplicity, just output one binary file per processor with its section of the problem.
We'd suggest doing the parallelization in steps:
- Include mpi.h and add MPI_Comm_size/MPI_Comm_rank where necessary; make sure the code still compiles and runs;
- Calculate the local number of points in each process' local domain from the total number of points and the size (and possibly rank). If this helps, you may assume that the number of grid points on the ruler is a multiple of the number of mpi processes.
- Only allocate arrays of the local domain size plus 2 (for the guard cells).
- The initialization is deterministic in this application, and can be parallelized.
- Solve the random number parallelization by using the rank as the seed of the random number generator for each process.
- Use reductions for the min, max and total_ants calculations.
- Fix the "old" periodic boundary condition setting for guard cells by, as in our example in class, sending messages around to neighbouring processes.
- As you're developing and testing, start with only 2-4 processors.
Do meaningful git commits in between all steps.
Once the code is parallelized, perform a strong scaling plot of the speed-up for 1,2,4,8,16, 24 and 32 cores (the last two will need 2 teach cluster nodes). Use job submission script(s) for this scaling test. Discuss the scaling.
Submit the git2zip'ed git repo (do not add results, binary or object files) with the submission script(s), the scaling plot, and a text file with the scaling data and a discussion of your findings before 23:55 on April 14th, 2021. The usual late submission penalty applies.
- 14 August 2023, 4:32 PM