MPI Reference

 

Message Passing

PreliminariesMPI ReferenceMessage Passing Non-blocking

int MPI_Bcast( void *buf, int count, MPI_Datatype datatype,

int srcPid, MPI_Comm comm )

int MPI_Send( void *buf, int count, MPI_Datatype datatype,

int destPid, int tag, MPI_Comm comm )

int MPI_Recv( void *buf, int count, MPI_Datatype datatype,

int srcPid, int tag, MPI_Comm comm, MPI_Status *status )
srcPid
The id of the process from whom you want to receive a message. This can be set to MPI_ANY_SOURCE to receive a message from any process within the give communications group.
tag
A code indicating the type of message to be received. This can be set to MPI_ANY_TAG to receive a message with any type of tag associated with it.

int MPI_Reduce( void *sendbuf, void *recvbuf, int count,

MPI_Datatype datatype, MPI_Op op, int destPid, MPI_Comm comm )

int MPI_Probe( int srcPid, int tag, MPI_Comm comm, MPI_Status *status );

Blocks and waits for a message with the given data tag from the indicated process. The function does not actually receive the message. It can be used in conjunction with MPI_Get_count().

srcPid
the id of the process from which you are waiting for a message.
tag
the tag associated with the type of message for which you are waiting.
comm
the communications group being probed.
status
address of a struct into which information related to the message can be stored.

int MPI_Get_count( MPI_Status *status, MPI_Datatype datatype, int *count )

Determines the number of data items contained in a message just received or the next message to be received. This function is used with either MPI_Recv() or MPI_Probe().

status
the address of the MPI_Status struct filled in by either the MPI_Recv() or MPI_Probe() function.
datatype
the type of data items being received.
count
the address of an integer variable into which the number of items received is stored.

The following code segment illustrates the use of this function

MPI_Status msgStatus;
int numItems;

MPI_Probe( ROOT_PROC, DATA_TAG, MPI_COMM_WORLD, &msgStatus );
MPI_Get_count( &msgStatus, MPI_DOUBLE, &numItems );



PreliminariesMPI ReferenceMessage Passing Non-blocking
Print -- Recent Changes
Page last modified on May 07, 2007, at 01:45 PM