mpi.sendrecv {Rmpi}R Documentation

MPI_Sendrecv and MPI_Sendrecv_replace APIs

Description

mpi.sendrecv and mpi.sendrecv.replace execute blocking send and receive operations. Both of them combine the sending of one message to a destination and the receiving of another message from a source in one call. The source and destination are possibly the same. The send buffer and receive buffer are disjoint for mpi.sendrecv, while the buffers are not disjoint for mpi.sendrecv.replace.

Usage

mpi.sendrecv(senddata, sendtype, dest, sendtag, recvdata, recvtype, 
source, recvtag, comm = 1, status = 0)

mpi.sendrecv.replace(x, type, dest, sendtag, source, recvtag, 
comm = 1, status = 0)

Arguments

x data to be sent or recieved. Must be the same type for source and destination.
senddata data to be sent. May have different datatypes and lengths
recvdata data to be recieved. May have different datatypes and lengths
type type of the data to be sent or recieved. 1 for integer, 2 for double, and 3 for character. Others are not supported.
sendtype type of the data to be sent. 1 for integer, 2 for double, and 3 for character. Others are not supported.
recvtype type of the data to be recieved. 1 for integer, 2 for double, and 3 for character. Others are not supported.
dest the destination rank. Use mpi.proc.null for a fake destination.
source the source rank. Use mpi.any.source for any source. Use mpi.proc.null for a fake source.
sendtag non-negative integer. Use mpi.any.tag for any tag flag.
recvtag non-negative integer. Use mpi.any.tag for any tag flag.
comm a communicator number.
status a status number.

Details

The receive buffer must be large enough to contain an incoming message otherwise programs will be crashed. There is compatibility between send-receive and normal sends and receives. A message sent by a send-receive can be received by a regular receive and a send-receive can receive a message sent by a regular send.

Value

Returns the int, double or char vector sent from the send buffers.

Author(s)

Kris Chen

References

http://www.lam-mpi.org/, http://www-unix.mcs.anl.gov/mpi/www/www3/

See Also

mpi.send.Robj, mpi.recv.Robj, mpi.probe. mpi.get.sourcetag.

Examples

mpi.sendrecv(as.integer(11:20),1,0,33,integer(10),1,0,33,comm=0)
mpi.sendrecv.replace(seq(1,2,by=0.1),2,0,99,0,99,comm=0)

[Package Rmpi version 0.5-5 Index]