Click here to go to the TACC Home Page

TACC

Preface

This document is a primer for those who wish to learn the basics of using the Message-Passing Interface (MPI) library through simple examples of FORTRAN code. It covers the basics of message-passing in a parallel application but does not deal with the more fundamental concept of educing the parallelism within a problem. A complete description of MPI can be found in "MPI: A Message-Passing Interface Standard" and "MPI-2: Extensions to the Message-Passing Interface" from the Argonne National Laboratory. The complete descriptions of the proposed MPI standard are available as compressed Postscript files that you can download from the ANL site using your browser and print on a Postscript printer.

   Message-Passing Interface

Certain words in this document are defined and used with only one meaning. Be advised: the use and definition may vary in other sources. For instance, the word "buffer" in the MPI standard can refer to the data the user manipulates [e.g. DIMENSION a(10); ... call mpi_send(A...)] or to a copy of the data that mpi_send uses to store (buffer) the data before returning control back to the calling program. In this document, only the latter definition is used. Furthermore, the word "blocking" in the standard is used generically in the description of the operation of the mpi_send routine, yet it also means that a subroutine waits for some condition to occur before returning. This condition might be any one of:

  • freedom to write in a data location, or
  • the posting of a corresponding receive for a sent message, or
  • the completion of another subroutine (such as a receive).

Some people might be inclined to believe that blocking should refer to a more symmetric meaning: that a paired send/receive has completed. To minimize confusion, use of the word "block" is avoided and the more descriptive phrase "wait for an impending action or condition" is used here.

In the examples, all variables which begin with characters I-N are integers, all others are real*8.

Exception: character and logical variables begin with ch and lo, respectively.

MPI parameter types are declared in the mpif.h header file, and all data arguments are typed according to the type argument. Subroutine arguments labeled [OUT] return a value in the variable while those labeled [IN] must have an input value specified for them.

It is best to read this introduction to MPI from start to finish. Each section builds on information from the previous section, and guides you through a logical progression of information needed to use MPI. Work as you read by opening a window to a system that has MPI installed and use CPR (Copy, Paste, Run) on the examples to see how each one works.


Author: Kent Milfeld, TACC Research Associate