This assignment makes use of the files contained in this zip file. This assignment is due Tuesday, March 30.
In this assignment you will solve a synchronization problem using message passing and MPI. The synchronization problem is a combination of ideas from the MPI-message-ring.c and MPI-message-rendezvous.c programs that are from March 11.
Write an MPI program that takes its p processes and organizes them into k groups of p/k processes. The number k should be a command line parameter to the MPI program and you can assume that k divides p evenly without any remainder.
The k groups should form a "ring" of groups. The p/k processes within a group should work in parallel.
Suppose that the k groups are numbered 0 through k-1. Consider the group numbered i . The processes in that group should run in parallel, and then rendezvous when each of them has finished its work. After the processes in group i rendezvous, they should send a signal to the processes in group i+1 to start running in parallel. Then the processes in group i should wait for a signal from group i-1 . Meanwhile, the processes in group i+1 should run in parallel, then rendezvous, then send a signal to the processes in group i+2 to start together, and then they wait for (another) signal from group i , etc.
There are several ways to solve this problem. You can solve it using only point-to-point communication (i.e., using just MPI_Send() and MPI_Recv() ) or you can use collective communication (e.g., MPI_Barrier() or MPI_Bcast() ) with group communicators, or you can use inter-communicators. For information about group communicators, see pages 216-218 of our textbook. Figure 7.4 on page 217 is not too helpful. In the zip file there is a program Figure74.c which is a more detailed example of using group communicators. In addition, in hw3.zip there is a document Tutorial on MPI - Collective communication.pdf with more information about collective communication and group communicators.
I think the wisest approach to this problem is to first solve it using only point-to-point communication, and then, if you want to, try to solve it again with one of the more advanced communication techniques.
When you solve this problem, make sure that you document the idea behind your solution (for example, how you make use of any or all of point-to-point communication, collective communication, group communicators, inter-communicators, etc.). Also, make sure that when your solution runs, it is clear to the user that the processes are properly synchronized. Each process will run in its own console window. Try to make each process's output in its console window animate the progress of the program.
Turn in a zip file containing your solution to the problem.
This assignment is due Tuesday, March 30.
|