Worksheet 6

1. Write a C program using MPI that uses two processes - one client and one server.  This program should send seven messages from the server and receive seven messages in the client.  Any additional processes that are created should print a statement indicating that they are inactive.  Additionally, write a SLURM batch script for this program, and run the program on Stampede.

2. Write a program that sends data in a ring of processes (from process 0 to 1 to 2 . . . to process n-1 and back to process 0) using C and MPI.  Part of the data sent from one process to the next must include an identifier (such as the rank) from the sending process.

3. Write a program that performs an MPI reduction on an array of 3D points. Assume that the x coordinates of the points are stored in an array called x, the y coordinates of the points are stored in an array called y, and the z coordinates of the points are stored in an array called z. Write this code in two different ways: once using MPI_Reduce and once using MPI_Gather. If you finish these, try to write a hybrid MPI/OpenMP program to perform these operations.