The pair mpi.send and mpi.recv are two most used blocking 
  calls for point-to-point communications. An int, double or char vector 
  can be transmitted from any source to any destination.
The pair mpi.isend and mpi.irecv are the same except that 
  they are nonblocking calls.
Blocking and nonblocking calls are interchangeable, e.g., nonblocking sends can be matched with blocking receives, and vice-versa.
mpi.send(x, type, dest, tag,  comm = 1)
mpi.isend(x, type, dest, tag,  comm = 1, request=0)
mpi.recv(x, type, source, tag,  comm = 1, status = 0)
mpi.irecv(x, type, source, tag,  comm = 1, request = 0)mpi.send and mpi.isend return no value. mpi.recv
returns the int, double or char vector sent from source. However, 
mpi.irecv returns no value. See details for explanation.
data to be sent or received. Must be the same type for source and destination. The receive buffer must be as large as the send buffer.
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.
a communicator number.
a request number.
a status number.
Hao Yu
The pair mpi.send (or mpi.isend) and mpi.recv 
(or mpi.irecv) must be used together, i.e., if there is a sender, 
then there must be a receiver. Any mismatch will result a deadlock 
situation, i.e., programs stop responding. The receive buffer must be 
large enough to contain an incoming message otherwise programs will be 
crashed. One can use mpi.probe (or mpi.iprobe) and 
mpi.get.count to find the length of an incoming message 
before calling mpi.recv. If mpi.any.source or  
mpi.any.tag is used in mpi.recv, one can use  
mpi.get.sourcetag to find out the source or tag of the  
received message. To send/receive an R object rather than an int, double  
or char vector, please use the pair mpi.send.Robj and  
mpi.recv.Robj.
Since mpi.irecv is a nonblocking call, x with enough buffer 
must be created before using it. Then use nonblocking completion calls 
such as mpi.wait or mpi.test to test if 
x contains data from sender.
If multiple nonblocking sends or receives are used, please use request 
number consecutively from 0. For example, to receive two messages from two 
slaves, try 
mpi.irecv(x,1,source=1,tag=0,comm=1,request=0)
mpi.irecv(y,1,source=2,tag=0,comm=1,request=1)
Then mpi.waitany, mpi.waitsome or mpi.waitall can be 
used to complete the operations.
mpi.send.Robj,
  mpi.recv.Robj,
  mpi.probe,  
  mpi.wait,  
  mpi.get.count, 
  mpi.get.sourcetag.
# \donttest{
#on a slave
#mpi.send(1:10,1,0,0)
#on master
#x <- integer(10)
#mpi.irecv(x,1,1,0)
#x	
#mpi.wait()
#x
# }
Run the code above in your browser using DataLab