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
.
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)
Returns the int, double or char vector sent from the send buffers.
data to be sent or recieved. Must be the same type for source and destination.
data to be sent. May have different datatypes and lengths
data to be recieved. May have different datatypes and lengths
type of the data to be sent or recieved. 1 for integer, 2 for double, and 3 for character. Others are not supported.
type of the data to be sent. 1 for integer, 2 for double, and 3 for character. Others are not supported.
type of the data to be recieved. 1 for integer, 2 for double, and 3 for character. Others are not supported.
the destination rank. Use mpi.proc.null
for a
fake destination.
the source rank. Use mpi.any.source
for any source.
Use mpi.proc.null
for a fake source.
non-negative integer. Use mpi.any.tag
for any tag flag.
non-negative integer. Use mpi.any.tag
for any tag flag.
a communicator number.
a status number.
Kris Chen
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.
mpi.send.Robj
,
mpi.recv.Robj
,
mpi.probe
.
mpi.get.sourcetag
.
# \donttest{
#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)
# }
Run the code above in your browser using DataLab