gather-method {pbdMPI} | R Documentation |
This method lets a rank gather objects from every rank in the same communicator. The default return is a list of length equal to ‘comm size’.
gather(x, x.buffer = NULL, x.count = NULL, displs = NULL, rank.dest = .pbd_env$SPMD.CT$rank.root, comm = .pbd_env$SPMD.CT$comm, unlist = .pbd_env$SPMD.CT$unlist)
x |
an object to be gathered from all ranks. |
x.buffer |
a buffer to hold the return object which probably has
'size of |
x.count |
a vector of length ‘comm size’ containing all object lengths. |
displs |
|
rank.dest |
a rank of destination where all |
comm |
a communicator number. |
unlist |
if unlist the return. |
All x
on all ranks are likely presumed to have the same size and type.
x.buffer
, x.count
, and displs
can be NULL
or
unspecified. If specified, the type should be one of integer, double, or
raw specified correctly according to the type of x
.
If x.count
is specified, then the spmd.gatherv.*()
is
called.
If rank.dest == comm.rank(comm)
, then a list of length ‘comm size’
is returned by default. Otherwise, NULL
is returned.
For calling spmd.gather.*()
:
signature(x = "ANY", x.buffer = "missing", x.count = "missing")
signature(x = "integer", x.buffer = "integer", x.count = "missing")
signature(x = "numeric", x.buffer = "numeric", x.count = "missing")
signature(x = "raw", x.buffer = "raw", x.count = "missing")
For calling spmd.gatherv.*()
:
signature(x = "ANY", x.buffer = "missing", x.count = "integer")
signature(x = "ANY", x.buffer = "ANY", x.count = "integer")
signature(x = "integer", x.buffer = "integer", x.count = "integer")
signature(x = "numeric", x.buffer = "numeric", x.count = "integer")
signature(x = "raw", x.buffer = "raw", x.count = "integer")
Wei-Chen Chen wccsnow@gmail.com, George Ostrouchov, Drew Schmidt, Pragneshkumar Patel, and Hao Yu.
Programming with Big Data in R Website: http://r-pbd.org/
gather()
, allreduce()
, reduce()
.
## Not run: ### Save code in a file "demo.r" and run with 2 processors by ### SHELL> mpiexec -np 2 Rscript demo.r ### Initial. suppressMessages(library(pbdMPI, quietly = TRUE)) init() .comm.size <- comm.size() .comm.rank <- comm.rank() ### Examples. N <- 5 x <- (1:N) + N * .comm.rank y <- gather(matrix(x, nrow = 1)) comm.print(y) y <- gather(x, double(N * .comm.size)) comm.print(y) ### Finish. finalize() ## End(Not run)