global range, max, and min {pbdMPI} | R Documentation |
These functions are global range, max and min applying on distributed data for all ranks.
comm.range(..., na.rm = FALSE, comm = .pbd_env$SPMD.CT$comm) comm.max(..., na.rm = FALSE, comm = .pbd_env$SPMD.CT$comm) comm.min(..., na.rm = FALSE, comm = .pbd_env$SPMD.CT$comm)
... |
an 'numeric' objects. |
na.rm |
if |
comm |
a communicator number. |
These functions will apply range()
, max()
and min()
locally, and apply allgather to get all local results from other ranks,
then apply range()
, max()
and min()
on all local
results.
The global values (range, max, or min) are returned to all ranks.
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/
## 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() if(comm.size() != 2){ comm.cat("2 processors are requried.\n", quiet = TRUE) finalize() } ### Examples. a <- 1:(comm.rank() + 1) b <- comm.range(a) comm.print(b) b <- comm.max(a) comm.print(b) b <- comm.min(a) comm.print(b) ### Finish. finalize() ## End(Not run)