CSCI 3366 (Introduction to Parallel and Distributed Processing), Spring 2002:
Tips for Using MPI on the CS Linux Machines


Contents

Overview

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.

As of Spring 2002, the version of Linux installed on these machines includes two implementations of MPI, MPICH and LAM MPI. For completeness, this document describes how to use both. Preliminary investigation suggests that the LAM implementation is faster, but can be slightly more trouble to use.

Setting up your account

Setup for rsh

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 ensure this is by creating a file .rhosts in your home directory containing a list of machine/username combinations from which such logins should be allowed. The 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

Pathnames

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. The equivalent commands for the MPICH implementation are installed in /usr/local/mpich-1.2.1/bin. It is probably easiest to invoke them by specifying the full path name (e.g., /usr/local/mpich-1.2.1/bin/mpicc). 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 examples.

Compiling MPI programs

Compiling MPI-plus-C programs

Use the command mpicc to compile C programs using MPI functions.

Compiling MPI-plus-C++ programs

Use the command mpiCC to compile C++ programs using MPI functions.

Running MPI programs

Running programs

Use the command mpirun to run an MPI program.

Starting the runtime environment (LAM only)

Before running an MPI program using the LAM implementation, 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.)

Shutting down the runtime environment (LAM only)

After running MPI programs using the LAM implementation, use the command lamhalt to shut down the processes started by lamboot.

Online documentation

Use the command man to display UNIX-style man pages for MPI-related commands and routines.

The MPICH implementation also provides a command mpiman that allows Web-style browsing of documentation for all MPI-related commands and functions.



Berna Massingill
2002-01-30