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:
0 1 2 3 4 5 6 7 time: 0.15324 secsNote that no process except the master should perform any I/O.
Using the MPI_Wtime() function, add code that causes the master process to calculate how long it takes the message to circulate around the "ring". Have the master output the message it receives and the time, but do not include any I/O operations in your timing -- your timing should just measure how long it takes to transmit the message around the ring.
To try to compensate for this variance, run your program 3 times for a given number of processes. In a spreadsheet, record these times; then use the spreadsheet to compute both the average and variance of the 3 trip-time measurements. Use this procedure to test, record, and determine the average and variance of the times for rings of 4, 8, 16, 32, 64, 128, and 256 processes. (Don't use a calculator--use the spreadsheet functions to calculate these averages and variance values!)
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.
In your spreadsheet, create a line-chart that plots the average times you computed for the CS Lab vs. on the cluster. The X-axis should be the number of processes; the Y-axis should be the time. Give your chart a descriptive title, be sure to label your axes (including any units), and include a legend that indicates which system each line represents in a way that will be clear on a gray-scale printer (e.g., use a solid line for one and a dashed line for the other). Your X-axis markers should be the actual values you used: 4, 8, 16, 32, 64, 128, and 256 processes.
Then create a second similar line-chart in which you plot the variances you computed for each ring-size, with the number of processes on the X-axis and the variance on the Y-axis.
Size both of these charts so that each will occupy an entire page when printed, so as to reveal as much detail as possible. If both lines are close together, experiment with using a log-scale for the Y-axis to see if that will increase the separation. If necessary, copy-paste these charts into a word-processing program for printing.
Compare the data you collected this week with what you collected last week. If you notice differences, quantify those differences and try to identify the reason for the difference.
If you used AI in completing this project, attach an additional page in which you document your use of it, as described in the course policies.
CS > 374 > Exercises > 02 > Homework Project