MPI - Message Passing Interface Examples

MPI is a message passing interface used for parallel processing in distributed memory systems. There are language specific bindings that allow programs written in C, C++ and FORTRAN to execute in parallel by calling the appropriate library routines.

A single user program is prepared, but is run on multiple processors, one of which is the master, the others being slaves. Each processor has its own copy of the data, with the master processor in charge of directing how important results are to be moved from processor to processor.

Because the data is distributed, it is likely that a computation on one processor will require that a data value be copied from another processor. Thus, if processor A needs the value of data item X that is stored in the memory of processor B, then the program must include lines that say something like:

        if ( I am processor A ) then
          call mpi_send ( X )
        else if ( I am processor B ) then
          call mpi_receive ( X )
        end
      

It should be clear that a program using MPI to execute in parallel will look much different from a corresponding sequential version. The user must divide the problem data among the different processors, rewrite the algorithm to divide up work among the processors, and add explicit calls to transfer values as needed from the processor where a data item "lives" to a processor that needs that value.

Reference 1:
Gropp, Lusk, Skjellum,
Using MPI,
Portable Parallel Programming with the Message-Passing Interface,
MIT Press, 1997.
Reference 2:
Snir, Otto, Huss-Lederman, Walker, Dongarra,
MPI - The Complete Reference,
Volume 1, The MPI Core,
second edition,
MIT Press, 1998.
Reference 3:
The Argonne National Laboratory MPI site
Reference 4:
The Local Area Multicomputer/MPI site

Files you may copy include:

Return to the FORTRAN software page.


Last revised on 02 April 2002.