I Sending a Message: MPI SEND MP Send takes the following arguments Message Body Buffer Count Datatype Message Envelope(source-the sending process-is defined implicitly) Destination Tag Communicator The message body contains the data to be sent: count items of type datatype. The message envelope tells Where to send it. In addition . an error code is returned
Sending a Message: MPI_SEND • MPI_Send takes the following arguments: – Message Body • Buffer • Count • Datatype – Message Envelope (source – the sending process – is defined implicitly) • Destination • Tag • Communicator • The message body contains the data to be sent: count items of type datatype. The message envelope tells where to send it. In addition, an error code is returned
I Sending a Message: MPI SEND C binding is shown below int MPI Send(void *buf, int count, MPI Datatype dtype, int dest, int tag, MPI Comm comm) All arguments are input arguments An error code is returned by the function Example: MPI Send(a, 10, MPI INT,0, 10, MPI COMM WORLD)i MPI Send(&b, 1, MPI DOUBLE, 219, Comm1)
Sending a Message: MPI_SEND • C binding is shown below. int MPI_Send(void *buf, int count, MPI_Datatype dtype, int dest, int tag, MPI_Comm comm); – All arguments are input arguments. – An error code is returned by the function. Example: MPI_Send(a,10,MPI_INT,0,10,MPI_COMM_WORLD); MPI_Send(&b,1,MPI_DOUBLE,2,19,Comm1);
I Receiving a Message: MPl RECV MPI Recv takes a set of arguments similar to MPl Send, but several of the arguments are used in a different way Message Body · Buffer · Count Datatype Message Envelope (receiving process-is defined implicitly) Source Tag Communicator Status-information on the message that was received
Receiving a Message: MPI_RECV • MPI_Recv takes a set of arguments similar to MPI_Send, but several of the arguments are used in a different way. – Message Body • Buffer • Count • Datatype – Message Envelope (receiving process – is defined implicitly) • Source • Tag • Communicator – Status – information on the message that was received
I Receiving a Message: MPl RECV The message envelope arguments determine what messages can be received by the call. The source, tag, and communicator arguments must match those of a pending message in order for the message to be received Wildcard values may be used for the source(MP/ ANY SOURCE, accept a message from any process)and the tag(MP/ANY TAG, accept a message with any tag value). If wildcards are not used, the call can accept messages from only the specified sending process and with only the specified tag value Communicator wildcards are not available The message body arguments specify where the arriving data are to be stored, what type it is assumed to be and how much of it the receiving process is prepared to accept. If the received message has more data than the receiving process is prepared to accept, it is an error
Receiving a Message: MPI_RECV • The message envelope arguments determine what messages can be received by the call. The source, tag, and communicator arguments must match those of a pending message in order for the message to be received. • Wildcard values may be used for the source (MPI_ANY_SOURCE, accept a message from any process) and the tag (MPI_ANY_TAG, accept a message with any tag value). If wildcards are not used, the call can accept messages from only the specified sending process, and with only the specified tag value. Communicator wildcards are not available. • The message body arguments specify where the arriving data are to be stored, what type it is assumed to be, and how much of it the receiving process is prepared to accept. If the received message has more data than the receiving process is prepared to accept, it is an error
I Receiving a Message: MPl RECV In general, the sender and receiver must agree about the message datatype, and it is the programmer's responsibility to guarantee that agreement. If the sender and receiver use incompatible message datatypes, the results are undefined The status argument returns information about the message that was received. The source and tag of the received message are available this way(needed if wildcards were used); also available is the actual count of data received In addition an error code is returned
Receiving a Message: MPI_RECV • In general, the sender and receiver must agree about the message datatype, and it is the programmer's responsibility to guarantee that agreement. If the sender and receiver use incompatible message datatypes, the results are undefined. • The status argument returns information about the message that was received. The source and tag of the received message are available this way (needed if wildcards were used); also available is the actual count of data received. • In addition, an error code is returned