Computer Science 335
Parallel Processing and High Performance Computing

Fall 2021, Siena College

Lab 7: Collective Communication
Due: 1:20 PM, Friday, October 15, 2021

In this lab, you will learn about collective communication using MPI. Until now, we have used only point-to-point communication, i.e., sends and receives.

You may work alone or with a partner on this lab.

Learning goals:

  1. To learn about more efficient communication patterns.
  2. To learn the basics of collective communication in MPI.

Getting Set Up

You can find the link to follow to set up your GitHub repository coll-lab-yourgitname for this Lab in Canvas. One member of the group should follow the link to set up the repository on GitHub, then that person should email the instructor with the other group members' GitHub usernames so they can be granted access. This will allow all members of the group to clone the repository and commit and push changes to the origin on GitHub. At least one group member should make a clone of the repository to begin work.

You may choose to answer the lab questions in the README.md file in the top-level directory of your repository, or upload a document with your responses to your repository, or add a link to a shared document containing your responses to the README.md file.

Reading

Read Pacheco Ch. 3, Section 4, to learn about MPI's collective communication capabilities.

Improving RDS

Section 3.4.1 of Pacheco shows how we can improve the gathering of values from the processes at all ranks back to the rank 0 process for operations such as a global sum. Such a mechanism can be used to improve the speed of the communication at end of the RDS program from the earlier lab.

Practice Program: Copy your RDS program to the tree directory of your repository and rename it as mpirds-tree.c. Replace the (p-1)-step computation of the global sums with one a the tree structured global sum, but using only point-to-point communication. You may use a structure like that in either Figure 3.6 or Figure 3.7, or one of your own design, as long as it has the same efficiency. You may assume that the total number of processes is a power of 2 (but do error checking on this if you make this assumption). No collective communication functions yet! (10 points)

For the questions below, assume you are running your original or improved programs with 512 processes. You don't need to run it, just base your answers on your code.

Question 1: How many total messages are sent and received in your original program to compute the global sum? (1 point)

Question 2: How many "communication phases" are needed by your original program to compute the global sum? That is, what is the longest sequence of consecutive sends or receives by any one process? (1 point)

Question 3: How many addition operations are needed by your original program in the computation of the global sum? (1 point)

Question 4: How many total messages are sent and received in your improved program to compute the global sum? (1 point)

Question 5: How many "communication phases" are needed by your improved program to compute the global sum? That is, what is the longest sequence of consecutive sends or receives by any one process? (1 point)

Question 6: How many addition operations are needed by your improved program in the computation of the global sum? (1 point)

Perhaps you have continued reading in Section 3.4.2 and realized that this communication can be done with one of MPI's higher-level collective communication routines: an MPI_Reduce.

Practice Program: Copy your RDS program to the reduce directory of your repository and rename it as mpirds-reduce.c, replace the computation of the global sums with an appropriate function call to do the entire reduction. (5 points)

More Collective Communication Examples

In addition to the examples in the text chapter, there are two examples to consider in the repository for this lab: mpicoll and mpiscatgath.

Question 7: For each of the collective communication MPI calls in these examples, briefly describe its effect, both in general terms (what the function does) and what it is doing specifically in each case. What data exists on each process before and after each call? (15 points)

Question 8: Other than the fact that it simplifies your code and reduces the chance of programming errors, what other advantages are there to using these higher-level collective communication functions rather than programming your own using basic point-to-point communication functions? (4 points)

Submission

Commit and push!

Grading

This assignment will be graded out of 40 points.

Feature

Value Score
mpirds-tree.c 10
Question 1 1
Question 2 1
Question 3 1
Question 4 1
Question 5 1
Question 6 1
mpirds-reduce.c 5
Question 7 15
Question 8 4
Total 40