(The Uniform Resource Locator for this World Wide Web page is
"http://scv.bu.edu/documentation/tutorials/MPI/")

Multiprocessing by Message Passing MPI

Course 3085

Introduction

Preliminaries of MPI Message Passing

Basic MPI Routines Through Examples

There are essentially two different paradigms in MPI programming, SPMD (Single Program Multiple Data) and MPMD (Multiple Programs Multiple Data). The example programs shown below employ the SPMD paradigm, i.e., an identical copy of the same program is used for each of the processes. Examples for the less frequently used MPMD paradigm (in which more than one program are used among the processes) are demonstrated in a separate page.

Compilation and Execution

On the IBM p655 and p690, we currently support IBM's implementation of standard MPI. To see the compilation and job execution procedure for IBM's MPI, Click here.

At Boston University, we use LSF for batch processing. Through LSF, the batch submission script, bsub, permits user to enter the number of processors via the switch "-n". Do not use this option. Rather, specify the number processors through mpirun (for SGI machines) or poe (for the IBM pSeries) as shown in the above example.

machine-name% bqueues to find out what queues are available.

machine-name% bqueues -l p4short to find out specifics of the queue "mpshort".
Alternatively, if you prefer x-window displays, use machine-name% xlsbatch to find out the status of your (and others) job(s).

For more detail on batch queues, consult the Scientific Computing Facilities Technical Summary Page

Debugging MPI code with SGI's Case Vision Debugger (CVD)

To debug your code using SGI's Case Vision Debugger (cvd): (you will need x-window for cvd to work)

  1. To use cvd for MPI, it is far easier to use the MPICH MPI. Please refer to the above section on how to compile and execute MPI code using MPICH.
  2. For debugging, make sure you compile with "-g" instead of any optimization flag, such as -O3.
  3. At prompt, type "cvd executable-name" (e.g., % cvd a.out)
  4. You should now see a couple of windows pop up. The main window should display the source file (it is easier to do this in the directory where all the files live).
  5. At the top, there is a dialogue box with "command:" on the left. You should see the executable name, along with path in this box. Complete the command line with the number of procs you want to use. (e.g. command: /usr/mypath/a.out -np 4) Please see above on how to run jobs under MPICH.
  6. Set traps by clicking at the left of the program source statements
  7. At the top left of the main window, there is a "Admin" heading. Click and select "multiprocess view". A new window pops.
  8. In the multiprocess view window, click "config/preferences". Check "Attach to forked processes" and "Copy traps to forked processes" if they are not already checked. Click save and apply. This way, next time you won't have to do this step again.
  9. you can now click "run" which you can find at the top right of main window. The execution will stop at the first trap.
  10. You can go to Multiprocess View window to select a specific process. Clicking on "run" in main window will cause that process to continue execution to next stop (trap). Alternatively, you can click "continue all" or "step into all" or "step over all" to allow all processes to march on.
  11. Finally, the "expression view" window permits inquiries of the values of variables in source code. Just type in the names.

CVD can also be used for performance analyses.

IBM pSeries Debugger

There are several parallel debuggers on the IBM pSeries. Refer to the IBM pSeries section for more details.

Communicators and Virtual Topology (this section under development)

In addition to the basic MPI routines demonstrated above, there are many other routines for various applications. Some of the more frequently used routines, grouped according to their functionalities, are discussed below:

Application of communicators and cartesian topology is demonstrated through a matrix transpose example

References

There are a number of MPI references available.
From book publishers :
  1. Parallel Programming with MPI by P. S. Pacheco, Morgan Kaufmann, 1997
  2. MPI: The Complete Reference by M. Snir, et. al., The MIT Press, 1996
  3. Using MPI by W. Gropp, E. Lusk and A. Skjellum, The MIT Press, 1994

Online via the SGI Power Challege Array or Origin2000 machines:
  1. There are man pages for MPI
  2. MPI and PVM User's Guide
  3. MPI: A Message-Passing Interface Standard

On the Internet:
  1. Users' Guide to mpich, a Portable Implementation of MPI by P. Bridges et. al.
  2. MPI: A Message-Passing Interface Standard. The postscript file of this document, /pub/mpi/mpi-report.ps, can be down-loaded via anonymous FTP from info.mcs.anl.gov
  3. A User's Guide to MPI by Peter S. Pacheco. (This is a postscript file)
  4. MPI chapter in Designing and Building Parallel Programs by Ian Foster
  5. MPI Tutorial by EPCC, University of Edinburgh
  6. MPI Tutorial by Cornell University
  7. MPI Tutorial by the National Computational Science Alliance

Other Tutorials on the WEB:
  1. AHPCC, University of New Mexico

ACKNOWLEDGEMENTS
The glossary as well as detailed descriptions of all MPI routines are drawn from the Argonne National Laboratory.
Your suggestions and comments are welcomed, please send them to the course coordinator and instructor, Kadin Tseng (Email: kadin@bu.edu).
(Last updated: )