CS475 Lab 5, MPI Start

This lab is intended to introduce you to MPI. For your enjoyment, you are provided with a version of the SAT code discussed in class.

Also, you will edit skeleton code to pass messages around in a circle, and to exchange messages between consecutive processes. This exercise is not about speed up, it is just about learning to write message passing code. Still, there is timing code provided, so you can see how to time in MPI. In the CS lab we use openmpi. Download and untar the provided mess.tar file.

sat

This is a complete code provided to you. It shows collective communication and timing.

cycle

This programs sends messages of a certain size a certain number of times around a circle of processes. The message passing is initiated by process 0: it sends to process 1, and receives from process p-1. The other processes receive from their left neighbor and send to their right neighbor. Notice that (p-1)-s right neighbor is 0.

exchange

This programs exchanges messages of a certain size a certain number of times between processes. Process 0 only communicates with process 1, process p-1 only communicates with process p-2. All other processes communicate with their right and left neighbor.

Make sure you have openmpi in your path and library load path, when running on CS machines:

echo $path
...  /usr/lib64/openmpi/bin .

echo $LD_LIBRARY_PATH
...:/usr/lib64/openmpi/lib

To set the environment variable in Bash terminals, use the following commands

export PATH=/usr/lib64/openmpi/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib

Run your programs with mpirun in CS machines, example:
mpirun -np 4 exchange 5 100 v
To compile your programs in CRAY
	Change Makefile: CC = cc (instead of CC = mpicc)

To run your programs in CRAY
	Copy the executables in to "lustrefs" directory
	To run the program "sat" with 4 processes
		aprun -n4 sat