You should be able to run MPI programs on any of the CS department's Linux machines, including those in HAS 228 (Janusxx, where xx ranges from 00 through 21), those in HAS 340 (Xenaxx, where xx ranges from 00 through 21), those in HAS 329 (Atlasxx, where xx ranges from 00 through 09), and a cluster of Linux-only machines (SnowWhite and Dwarfn, where n ranges from 1 through 7). Note that multiboot machines must be running Linux to be usable for this purpose.
In order for MPI to start processes on other machines, your account must be set up so that MPI can remotely log into the other machines without prompting for a password. The easiest way to accomplish this is to tell MPI to use rsh for the remote logins and create a file .rhosts in your home directory containing a list of machine/username combinations from which such logins should be allowed without prompting for a password. (There are various security risks associated with all of this, but the consensus of the local experts is that they're not a major concern in our environment.)
To check that MPI will use rsh, type the command echo $LAMRSH. If the output is /usr/bin/rsh, all is well. If it's not, you need to execute the following command, which you should probably put in the file .bash_profile in your home directory so you don't have to type it in every time:
export LAMRSH=/usr/bin/rsh
The .rhosts file should look something like this with yourUserName replaced by your username.
Warning: To avoid a serious security hole, BE SURE that the permissions on this file do not allow others to modify it! You can be sure this is the case with the following command:
chmod go= .rhosts
The MPI-related commands for the LAM implementation are installed in one of the standard system directories (/usr/bin), so if you simply type, for example, mpicc to invoke the MPI C compiler, you will get the compiler for the LAM implementation. You can use a Makefile and scripts to avoid actually having to type out the full pathname every time you compile or run a program. See the sample programs page for an example.
Use the command mpicc to compile C programs using MPI functions. Typical usage:
mpicc -o foo foo.c
See the sample programs page for a Makefile.
Before running an MPI program, use the command lamboot to start up the runtime environment. (You only need to do this once per login session. When you are finished running MPI programs, use the lamhalt command to shut things down again.) Typical usage:
lamboot -b -v MPIhosts
where MPIhosts specifies the hostnames of machines to be used; in its simplest form, it can just be a list of machine names, i.e., like this. All the machines in MPIhosts should be up (and running Linux) when this command is run, and the list of machine names should include the machine from which you run the lamboot command.
Use the command mpirun to run an MPI program. Typical usage:
mpirun -np 10 foobar
(Starts 10 processes, each running executable foobar.)
After running MPI programs, use the command lamhalt to shut down the processes started by lamboot. Typical usage:
lamhalt
If this command hangs or appears not to work (perhaps because something has gone wrong earlier), you can use the following command to shut things down less gracefully:
wipe -b -v MPIhosts
The LAM implementers warn of unpredictable and undesirable consequences if you log out without issuing this command. A way to ensure that it is called when you log out is to put the following lines in a file .bash_logout in your home directory:
if [ ! -z "`ps aux | grep lamd | grep $USER | grep -v grep`" ]
then
lamhalt
fi
Use the command man to display UNIX-style man pages for MPI-related commands and routines. Typical usage:
man MPI_Send