Cornell Theory Center

Presentation:
MPI Point to Point Communication

10/98

This is the presentation layer of a two-part module. For an explanation of the layers and how to navigate within and between them, return to the top page of this module.


Table of Contents

  1. Overview
  2. Blocking Behavior
  3. Non-Blocking Behavior
  4. Programming Recommendations

References Lab Exercises Quiz Evaluation

[Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [More Detail]


  1. Overview
  2. Point to point is sending a message from one process to another

    Most message passing libraries define one system behavior

    MPI defines four communication modes

    Communication mode is selected with send routine

    Calls are also blocking or nonblocking.


    [Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [More Detail]


  3. Blocking Behavior
  4. Syntax review for a blocking send and receive:

    2.1 Communication Modes

    Communication ModeBlocking Routines Non-Blocking Routines
    SynchronousMPI_SSENDMPI_ISSEND
    ReadyMPI_RSENDMPI_IRSEND
    BufferedMPI_BSENDMPI_IBSEND
    StandardMPI_SENDMPI_ISEND
    MPI_RECVMPI_IRECV
    MPI_SENDRECV
    MPI_SENDRECV_REPLACE

    2.1.1 Blocking Synchronous Send

    Most of wait on sending end is eliminated if MPI_Recv comes before MPI_Ssend.

    [Try This] Animated version.


    2.1.2 Blocking Ready Send

    By default, the program exits if MPI_Rsend is called before notification arrives

    [Try This] Animated version.


    2.1.3 Blocking Buffered Send

    Timing of MPI_Recv is irrelevant. MPI_Bsend returns as soon as data are copied from source to a buffer.

    [Try This] Animated version.


    2.1.4 Blocking Standard Send

    Behavior depends on message size

    Number of Tasks Eager Limit (bytes)
    = threshold
    1 - 16 4096
    17 - 32 2048
    33 - 64 1024
    65 - 128 512

    Message size less than threshold


    Exceeding system buffer space causes communication to stall until space is freed

    [Try This] Animated version.

    Message size greater than threshold

    [Try This] Experiment with this simulation program to better understand the comparison of synchronization and system overheads for different modes, relative orders of calls, and message sizes.


    2.1.5 Blocking Send and Receive

    Send and Receive can be combined into one call

    MPI_SENDRECV

    blocking send and receive
    different buffers for send and receive

    MPI_SENDRECV_REPLACE

    blocking send and receive
    only one buffer; the received message overwrites the sent one


    2.2 Conclusions: Modes

    AdvantagesDisadvantages
    Synchronous Safest, and therefore most portable
    SEND/RECV order not critical
    Amount of buffer space irrelevant
    Can incur substantial syncronization overhead
    Ready Lowest total overhead
    SEND/RECV handshake not required
    RECV must precede SEND
    Buffered Decouples SEND from RECV
    No sync overhead on SEND
    Order of SEND/RECV irrelevant
    Programmer can control size of buffer space
    Additional system overhead incurred by copy to buffer
    Standard Good for many cases Your program may not be suitable

    [Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [More Detail]


  5. Non-Blocking Behavior
  6. 3.1 Syntax of Non-Blocking Calls


    3.2 Example: Non-blocking standard send

    Non-blocking standard send, message size <= threshold
    Non-blocking receive


    3.3 Example: Non-blocking standard send, large message

    Non-blocking standard send, message size > threshold
    Non-blocking receive


    3.4 Conclusions: Non-blocking Calls

    [Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [More Detail]


    4. Programming Recommendations

      In general: start with non-blocking calls, standard mode

      Blocking calls

      • use if you want tasks to synchronize
      • use if wait immediately follows communication call
      • start with synchronous, then switch to standard mode

      Evaluate performance and analyze code

      • if non-blocking receives are posted early, might consider ready mode
      • if there is too much synchronization overhead on sends, could switch to buffered mode

    [Table of Contents] [Section 1] [Section 2] [Section 3] [Section 4] [More Detail]


    References

    CTC's MPI Documentation
    http://www.tc.cornell.edu/UserDoc/Software/PTools/mpi/

    Extensive materials written at CTC, as well as links to postscript versions of the following papers:

    Franke, H. (1995) MPI-F, An MPI Implementation for IBM SP-1/SP-2. Version 1.41 5/2/95.

    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.

    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/

    Locally written test programs that examine message-passing behavior


    [Quiz] Take a multiple-choice quiz on this material, and submit it for grading.

    [Exercise] Lab exercises for MPI Point to Point Communication

    [Evaluation] Please complete this short evaluation form. Thank you!


    [CTC Home Page] [Search] [Education]
    [Copyright Statement] [Feedback] [Resources]

    URL http://www.tc.cornell.edu/Edu/Talks/MPI/Pt2pt/less.html