Project 9: Counting on MPI (due Friday Apr 27th at midnight)

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.

  1. Read the first three section of Ch. 6 in Introduction to Parallel Computing (that is, read up through the MPI section).
  2. 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
    
  3. To test your code, you should use 16 processors on nodes n20..n25. E.g.
    /usr/lib64/openmpi/bin/mpirun -np 16 --hostfile ~/hostfile.txt counts_3s
    
  4. 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.
  5. For the final project, you will be comparing timings for all four versions of your circadian simulation 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 key assumptions (e.g. all of them use all-to-all coupling or all of them use an explicit network)? You will be building your MPI version on your sequential version. Make sure you will be able time the code for all four.

Extensions

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?

Vary the number of processes you begin and determine how much of a speed-up we achieve by adding additional processes.

Writeup and Handin

To hand in your project, you will gather all of the necessary files into a proj09 directory:

  1. Create a file named README.txt and use it to describe your code organization (e.g. info about how to make and run it).
  2. Create a second file for you project report. This file should be in a format that allows you to include charts or images (such as .docx or .pdf). In this write-up, summarize the project, include any results and your analysis, in addition to the answers to any questions asked in the project instructions.
  3. You should hand in all code necessary to run your solutions. Place all necessary .h, .c, and Makefile files in the proj09 directory. Stephanie may 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 put it in your Private folder on Courses/CS336.