mpi.bcast | R Documentation |
mpi.bcast
is a collective call among all members in a comm. It
broadcasts a message from the specified rank to all members.
mpi.bcast(x, type, rank = 0, comm = 1, buffunit=100)
x |
data to be sent or received. Must be the same type among all members. |
type |
1 for integer, 2 for double, and 3 for character. Others are not supported. |
rank |
the sender. |
comm |
a communicator number. |
buffunit |
a buffer unit number. |
mpi.bcast
is a blocking call among all members in a comm, i.e,
all members have to wait until everyone calls it. All members have to
prepare the same type of messages (buffers). Hence it is relatively
difficult to use in R environment since the receivers may not know what
types of data to receive, not mention the length of data. Users should
use various extensions of mpi.bcast
in R. They are
mpi.bcast.Robj
, mpi.bcast.cmd
, and
mpi.bcast.Robj2slave
.
When type=5, MPI continuous datatype (double) is defined with unit given by
buffunit
. It is used to transfer huge data where a double vector or matrix
is divided into many chunks with unit buffunit
. Total
ceiling(length(obj)/buffunit) units are transferred. Due to MPI specification, both
buffunit
and total units transferred cannot be over 2^31-1. Notice that the last
chunk may not have full length of data due to rounding. Special care is needed.
mpi.bcast
returns the message broadcasted by the sender
(specified by the rank).
mpi.bcast.Robj
,
mpi.bcast.cmd
,
mpi.bcast.Robj2slave
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.