I Message body Think of the buffer as an array; the dimension is given by count, and the type of the array elements is given by datatype ■■檵■■■誾」 (count=7) An MPl message is an array of elements of a particular MPI datatype Using datatypes and counts, rather than bytes and bytecounts, allows structured data and noncontiguous data to be handled smoothly
Message body • Think of the buffer as an array; the dimension is given by count, and the type of the array elements is given by datatype. • Using datatypes and counts, rather than bytes and bytecounts, allows structured data and noncontiguous data to be handled smoothly. An MPI message is an array of elements of a particular MPI datatype. (count=7)
I Message Envelope Message envelope of an MPI message provides information on how to match sends to receives it consists of 3 parts Source or destination This argument is set to a rank in a communicator Destination is specified by the sending process and source is specified by the receiving process. Only messages coming from that source can be accepted by the receive call, but the receive can set source to MP/ ANY SOURCE to indicate that any source is acceptable Communicator The communicator specifies a group of processes to which both source and destination belong Tag The tag is an arbitrary number to help distinguish among messages. The tags specified by the sender and receiver must match, but the receiver can specify MPI_ ANY_ TAG to indicate that any tag is acceptable. For example, one tag value can be used for messages containing data and another tag value for messages containing status information
Message Envelope • Message envelope of an MPI message provides information on how to match sends to receives. it consists of 3 parts: – Source or destination This argument is set to a rank in a communicator. Destination is specified by the sending process and source is specified by the receiving process. Only messages coming from that source can be accepted by the receive call, but the receive can set source to MPI_ANY_SOURCE to indicate that any source is acceptable. – Communicator The communicator specifies a group of processes to which both source and destination belong. – Tag The tag is an arbitrary number to help distinguish among messages. The tags specified by the sender and receiver must match, but the receiver can specify MPI_ANY_TAG to indicate that any tag is acceptable. For example, one tag value can be used for messages containing data and another tag value for messages containing status information
I Sending and Receiving Messages Sending messages is straightforward. The source( the identity of the sender) is determined implicitly, but the rest of the message (envelope and body) is given explicitly by the sending process Receiving messages is not quite so simple. As a process may have several pending messages To receive a message, a process specifies a message envelope that MPI compares to the envelopes of pending messages. If there is a match, a message is received otherwise, the receive operation cannot be completed until a matching message is sent In addition, the process receiving a message must provide storage into which the body of the message can be copied. The receiving process must be careful to provide enough storage for the entire message
Sending and Receiving Messages • Sending messages is straightforward. The source (the identity of the sender) is determined implicitly, but the rest of the message (envelope and body) is given explicitly by the sending process. • Receiving messages is not quite so simple. As a process may have several pending messages. • To receive a message, a process specifies a message envelope that MPI compares to the envelopes of pending messages. If there is a match, a message is received. Otherwise, the receive operation cannot be completed until a matching message is sent. • In addition, the process receiving a message must provide storage into which the body of the message can be copied. The receiving process must be careful to provide enough storage for the entire message
Blocking Send and Receive Reference:http://foxtrot.ncsa.uiuc.edu.8900/publicmmpl
Reference: http://foxtrot.ncsa.uiuc.edu:8900/public/MPI/ Blocking Send and Receive
I Blocking Send and Receive The two functions. MP/ Send and MP/ Recv, are the basic point-to-point communication routines in MPl. Their calling sequences are presented and discussed in the following sections. Both functions block the calling process until the communication operation is completed Blocking creates the possibility of deadlock, a key issue that is explored by way of simple examples. In addition, the meaning of completion is discussed The nonblocking analogues of MPl Send and MPI Recv are presented in next section
Blocking Send and Receive • The two functions, MPI_Send and MPI_Recv, are the basic point-to-point communication routines in MPI. Their calling sequences are presented and discussed in the following sections. Both functions block the calling process until the communication operation is completed. • Blocking creates the possibility of deadlock, a key issue that is explored by way of simple examples. In addition, the meaning of completion is discussed. • The nonblocking analogues of MPI_Send and MPI_Recv are presented in next section