Project 10: Counting on MPI
In this project, you will be writing straight-forward MPI (message passing interface) code and running it on NSCC. The goal of the project is to become comfortable with the new environment. Note: MPI runs on nodes n3-n6 on NSCC, but will not work from the head node.
- Read the first three section of Ch. 6 in Introduction to Parallel Computing (that is, read up through the MPI section).
- Using MPI, write count_3s: Allocate an array of randomly generated integers between 0 and 9 in the root process, scatter it to the rest of the processors, then count the number of 3's in the array in each process, and reduce the counts from the different processes. The root process should print the result. To compile your code, use mpicc:
/usr/lib64/openmpi/bin/mpicc count_3s.c -o count_3s
- To test your code, you should use 16 processors on nodes n3 and n5. E.g.
/usr/lib64/openmpi/bin/mpirun -np 16 -host n3,n5 counts3s
- Time the different sections of the code using MPI_Wtime. Which parts take the longest? Be sure to vary your problem size so that you can detect any trends.
- For the final project, you will be comparing timings for all four versions of your fish-schooling code (sequential, pthreads, GPU, and MPI). Why don't you take the time now to make sure the first three versions are all using the same fishStep code? You will be building your MPI version on your sequential version. Make sure you will be able time the code for all four.
Write an MPI program to compute the dot product of two vectors. What is the N at which it becomes faster to use MPI than to do it sequentially?
Writeup and Handin
To hand in your project, you will gather all of the necessary files into a proj10 directory.
- Create a file named README.docx for your project write-up. Include a description of the process you used to determine that your code produces correct results. Also include the analysis outlined earlier. The more thorough the analysis, the higher your grade will be.
- You should hand in all code necessary to run your solutions. Place all necessary .h, .c, and Makefile files in the proj10 directory. Stephanie will probably want to compile and run the code. It should be possible to do so without looking for any more files. Zip up the directory and mail it to Stephanie.