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. In the CS lab we use mpicc for compiling, and mpirun, both from openmpi, for running MPI programs.
Download and untar the provided mess.tar file. To be clear there are 3 distinct tasks:
Make sure you have openmpi in your path and library load path, when running on CS (state-capital) machines:
echo $path ... /usr/lib64/openmpi/bin . echo $LD_LIBRARY_PATH ...:/usr/lib64/openmpi/lib To update the environment variables for Bash terminals, edit the .bashrc file in your home directory and update PATH and LD_LIBRARY_PATH variables. NOTE: Exporting these varibles only in the local machine terminal will not work when you run your program in multiple machines. export PATH=/usr/lib64/openmpi/bin:$PATH export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib
You may also configure ssh to login without entering password each time. See the FAQ
mpirun -np 2 satTo run on multiple machines
mpirun -np 2 -hostfile host2 --mca btl_tcp_if_include eno1 satRuns the sat program on two machines. Each host executes one process.
-hostfilepoint to the list of hostnames and the
--mcaoption set the network interface of the hosts.
cat host2 denver.cs.colostate.edu slots=1 augusta.cs.colostate.edu slots=1
slotsspecify the number of processes to run on a host. You may have to change it as you want to increase the number of total processes.