HPC Project 2: The Master-Worker & Message-Passing Patterns

This week's assignment is a fairly simple project to give you practice using the master-worker and message-passing patterns. The assignment is to write a program that sends a message around a ring of processes, using the master-worker and message-passing patterns. More precisely:

If all is well, the master process should receive and display a message consisting of the ranks of all the processes in the computation. For example, with 8 processes, the master should receive and display something like this:
      0 1 2 3 4 5 6 7
      time: 0.15324 secs

In the Unix Lab:

  1. Write the program and test it using different arguments for the -np switch, so that you are confident it works correctly before continuing.
  2. This program may run too fast for the time program to provide useful data, so we will instead use the timing capabilities that MPI provides.

    Using the MPI_Wtime() function (see Section 2.6.4 of our Pacheco textbook), add code that causes the master process to calculate how long it takes the message to circulate around the "ring". Have the master output this time, along with the message it receives.

  3. Since you are competing for network bandwidth and CPU cycles with others in the lab, this time will vary from execution to execution.

    To compensate for this variance, run your program 3 times for a given number of processes. In a spreadsheet, record these times and compute the average of the 3 trips around the ring. Use this procedure to test, record, and average the times for rings of 4, 8, 16, 32, 64, 128, and 256 processes.

    Be careful to only compute the time it takes the message to traverse the ring -- your master should only time the interval between sending its message and receiving its message.

On The Cluster:

  1. Transfer your program to the cluster (dahl.calvin.edu).
  2. Repeat the timing experiments you did in the Unix lab by measuring the average of 3 trips around the ring.
  3. Record the 3 times and averages for rings of 4, 8, 16, 32, 64, 128, and 256 processes.

Hand In

Hard copies of:
  1. A line-chart that plots the average times you computed for the Unix Lab and on the cluster. The X-axis should have the number of processes; the Y-axis should be the time. Be sure you label your axes, give your chart a title, and clearly indicate the system each line represents. Your X-axis markers should be the values you used (4, 8, 16, 32, 64, 128, and 256 processes).
  2. A 1-2 paragraph written analysis in which you interpret your line-chart and spreadsheet data. If this week's and last week's results differ, try to identify what lies behind those differences.
  3. Your spreadsheet.
  4. A script file in which you cat your program, show that it compiles correctly, and then show it executing with 8 processes in the U-lab.
  5. The .o file produced by one of your 8-process runs on the cluster.
Please staple these pages together and make certain that your name is on each page.

CS > 374 > Exercises > 02 > Homework Project

This page maintained by Joel Adams.