Point to Point Communications with MPI

  1. Overview
  2. Usage of Non-blocking Calls
  3. 2.1 Syntax of Non-blocking Calls

    The nonblocking calls have the same syntax (S) as the blocking ones, with two exceptions:

    1. Each call has an "I" immediately following the "_".
    2. The last argument is a handle to an opaque request object that contains information about the message, i.e., its status.

    For example, the standard non-blocking send and a corresponding non-blocking receive call look like this:

    and an example of a Wait, (MPI_WAIT), call will look like this:

    Note that the Wait and Test calls take one or more request handles as input and return one or more status arrays (or structure in C). The request handle lets the user identify communication operations and links the posting operation (eg. MPI_ISEND) with the completion operation (eg. MPI_WAIT). The status array (structure in C) has information about the success or failure of the communication and other miscellaneous information. Wait, Test, and status are discussed in detail later in this talk.

    2.2 Basic Deadlock

    2.3 Summary: Non-blocking Calls

  4. Determining Information about Messages
  5. 3.1 Wait, Test, and Probe

    Although it is often useful to decouple non-blocking communications from the computational thread, it is also useful to recouple them. By doing so, one can obtain information about the status of the communication transaction, and then take actions depending on this status. The three calls described here are among the most commonly useful for dealing with these kinds of situations.

  6. Special Parameters
  7. 4.1 Wildcards

    Wildcard is a concept lifted from certain card games relating to an entity's ability to take on any legal value; in this message passing context, that ability comes in most useful when dealing with how a receiver determines which messages will be accepted for delivery:

    4.2 Null Parameters

    Many times it is useful to specify "dummy" source or destination values for communication.

    MPI_PROC_NULL can be used instead of rank whenever source or destination is used in a communication call.

    A communication with MPI_PROC_NULL has no effect. A send returns as soon as possible. A receive returns with no change to the input buffer. The source is set to MPI_PROC_NULL, the tag is set to MPI_ANY_TAG, and count equals 0.

    MPI_PROC_NULL is most useful for taking boundary-tests out of user code. For instance, if the action desired in such situations is simply to not send the message, then the programmer can have this accomplished automatically by specifying one of these null values for such circumstances, and, when the send or receive call determines that a null parameter has been given to it, the operation immediately returns as if it had completed successfully. This has the same effect as saying "In general, pass this to your neighbor", while tacitly knowing that you really mean "...as long as you have a neighbor", but such is a well-understood case, and you don't feel the need to explicitly mention it.

  8. Programming Recommendations
  9. References
  10. This tutorial was strongly based on copyrighted material from the Cornell Theory Center and was used with their permission.

    Additional tutorials on point-to-point communications can be found by clicking here

    Franke, H. (1995) MPI-F, An MPI Implementation for IBM SP-1/SP-2. Version 1.41 5/2/95. Available in postscript, under http://www.tc.cornell.edu/UserDoc/Software/PTools/mpi/

    Franke, H., Wu, C.E., Riviere, M., Pattnaik, P. and Snir, M. (1995) MPI Programming Environment for IBM SP1/SP2. Proceedings of ICDCS 95, Vancouver, 1995. Available in postscript, under http://www.tc.cornell.edu/UserDoc/Software/PTools/mpi/

    Gropp, W., Lusk, E. and Skjellum, A. (1994) Using MPI. Portable Parallel Programming with the Message-Passing Interface. The MIT Press. Cambridge, Massachusetts.

    MPI: A Message-Passing Interface Standard June 1995

    Message Passing Interface Forum (1995) MPI: A Message Passing Interface Standard. June 12, 1995. Available in postscript from http://www.epm.ornl.gov/~walker/mpi/

    RS/6000 SP: Practical MPI Progr amming by Yukiya Aoyama and Jun Nakano.