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.
References
Lab Exercises
Quiz
Evaluation
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.
Syntax review for a blocking send and receive:
Most of wait on sending end is eliminated if
MPI_Recv
comes before
MPI_Ssend.
By default, the program exits if MPI_Rsend
is called before notification arrives
Timing of MPI_Recv is irrelevant.
MPI_Bsend returns as soon as
data are copied from source to a buffer.
Behavior depends on message size
Send and Receive can be combined into one call
MPI_SENDRECV
MPI_SENDRECV_REPLACE
MPI_Isend
(buf,count,dtype,dest,tag,comm,request)
MPI_Isend
(buf,count,dtype,dest,tag,comm,request,ierror)
Non-blocking standard send, message size <= threshold
Non-blocking standard send, message size > threshold
Blocking calls
Evaluate performance and analyze code
CTC's MPI Documentation
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
The parameters:
buf
is the beginning of the buffer containing
the data to be sent. For Fortran, this is often the
name of an array in your program. For C, it is an address.
count
is the number of elements to be sent (not bytes)
datatype
is the type of data
dest
is the rank of the process which is the destination for the message
tag
is an arbitrary number which can be used to distinguish among messages
comm
is the communicator
ierror
is a return error code
The parameters:
buf
is the beginning of the buffer where the incoming data are to be stored. For
Fortran, this is
often the name of an array in your program. For C, it is an address.
count
is the number of elements (not bytes) in your receive buffer
datatype
is the type of data
source
is the rank of the process from which data will be accepted
(This can be a wildcard, by specifying the parameter MPI_ANY_SOURCE.)
tag
is an arbitrary number which can be used to distinguish among messages
(This can be a wildcard, by specifying the parameter MPI_ANY_TAG.)
comm
is the communicator
status
is an array or structure of information that is returned. For example, if you
specify a
wildcard for source or tag, status will tell you the actual rank or tag for the
message received
ierror
is a return error code
2.1 Communication Modes
Communication Mode Blocking Routines
Non-Blocking Routines Synchronous MPI_SSEND MPI_ISSEND Ready MPI_RSEND MPI_IRSEND Buffered MPI_BSEND MPI_IBSEND Standard MPI_SEND MPI_ISEND MPI_RECV MPI_IRECV MPI_SENDRECV MPI_SENDRECV_REPLACE 2.1.1 Blocking Synchronous Send
2.1.2 Blocking Ready Send
2.1.3 Blocking Buffered Send
2.1.4 Blocking Standard Send
Number of Tasks
Eager Limit (bytes)
= threshold1 - 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
Message size greater than threshold
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
Advantages Disadvantages Synchronous
Safest, and therefore most portable
SEND/RECV order not critical
Amount of buffer space irrelevantCan incur substantial syncronization overhead Ready
Lowest total overhead
SEND/RECV handshake not requiredRECV must precede SEND Buffered
Decouples SEND from RECV
No sync overhead on SEND
Order of SEND/RECV irrelevant
Programmer can control size of buffer spaceAdditional system overhead incurred by copy to buffer Standard
Good for many cases
Your program may not be suitable 3.1 Syntax of Non-Blocking Calls
MPI_Wait
(request,status)
MPI_Wait
(request,status,ierror)
3.2 Example: Non-blocking standard send
Non-blocking receive
3.3 Example: Non-blocking standard send, large message
Non-blocking receive
3.4 Conclusions: Non-blocking Calls
4. Programming Recommendations
In general: start with non-blocking calls, standard mode
References
http://www.tc.cornell.edu/UserDoc/Software/PTools/mpi/
Take a multiple-choice quiz on this material, and submit it for grading.
Lab exercises for MPI Point to Point Communication
Please complete this short evaluation form. Thank you!