Point to point = sending a message from one process to another
Point to point communication involves transmission of a message between a pair of processes, as opposed to collective communication, which involves a group of processes. MPI features a broader range of point to point communication calls than most other message passing schemes.
Most message passing libraries define just one point to point method
In many message-passing libraries, such as PVM, the library developer selects the method by which the system handles messages. That pre-chosen method gives acceptable reliability and performance for all possible communication scenarios, even though it may hide possible programming problems, or it may not give the best performance in specialized circumstances. For MPI, the equivalent to this is standard mode communication, which will be introduced in this module.
But MPI gives the programmer much more control over how the system handles the message by providing a choice among communication modes for the send routine. In addition to standard mode, MPI provides synchronous, ready, and buffered modes. This module will look at the system behavior for the various modes and discuss their advantages and disadvantages. Briefly, they can be characterized as follows:
MPI defines four communication modes
- synchronous mode (safest in most cases)
- ready mode (lowest system overhead)
- buffered mode (decouples sender from receiver)
- standard mode (compromise)
Communication mode is selected with the send routine
In addition to specifying the communication mode, which is selected through the name of the send routine, the programmer must decide whether the send and receive calls are to be blocking or non-blocking. A blocking or non-blocking send can be paired to either a blocking or non-blocking receive.
Send and receive calls are also blocking or nonblocking
- Blocking: stop the program until the message buffer is safe to use
- Non-blocking: allow the computation to proceed separately from the communication
Blocking suspends execution until the message buffer is safe to use. On both the sending and receiving sides, the buffer that contains the message can be a frequently-used resource, and data may be corrupted if they are used before an ongoing transaction has completed. Blocking communications ensure that this never happens. When control returns from the blocking call, the buffer can safely be modified without any danger of corrupting some other part of the process.
Non-blocking calls allow the computation to proceed separately from communication. A non-blocking call effectively guarantees that an interrupt will be generated when the transaction is ready to proceed, thus allowing the original thread to get back to computationally-oriented processing until the communication actually takes place.