mpi.scatter {Rmpi} | R Documentation |
mpi.scatter
and mpi.scatterv
are the inverse operations of
mpi.gather
and mpi.gatherv
respectively.
mpi.scatter(x, type, rdata, root = 0, comm = 1) mpi.scatterv(x, scounts, type, rdata, root = 0, comm = 1)
x |
data to be scattered. |
type |
1 for integer and 2 for double. Others are not supported. |
rdata |
the receive buffer. Must be the same type as the sender |
scounts |
int vector specifying the block length inside a message to be scattered to other members. |
root |
rank of the receiver |
comm |
a communicator number |
mpi.scatter
scatters the message x to all members. Each member receives
a portion of x with dim as length(x)/size in rank order, where size is the
total number of members in a comm. So the receive buffer can be prepared as
either integer(length(x)/size) or double(length(x)/size). For
mpi.scatterv
, scounts counts the portions (different dims) of x sent to
each member. Each member needs to prepare the receive buffer as either
integer(scounts[i]) or double(scounts[i]).
For non-root members, mpi.scatter
or scatterv
returns the
scattered message and ignores whatever is in x (or scounts). For the root
member, it returns the portion belonging to itself.
Hao Yu
http://www.lam-mpi.org/, http://www-unix.mcs.anl.gov/mpi/www/www3/