Counting with 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.
- Read that handout from class. There is also an on-line resource: the first three section of Ch. 6 in Introduction to Parallel Computing> (that is, read up through the MPI section).
- Write count_3s using MPI. Allocate the array in the root process, scatter it to the rest of the processors, then reduce the counts from the different processes. The root process should print the result. To compile your code, use mpicc:
/usr/lib64/openmpi/1.4-gcc/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/1.4-gcc/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 under your turnin directory on nscc.
- Create a file named README.txt 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.
Email Stephanie to let her know your project is ready for grading.