
Last chance! 50% off unlimited learning
Sale ends in
This method lets a rank broadcast an object to every rank in the same communicator. The default return is the object.
bcast(x, rank.source = .pbd_env$SPMD.CT$rank.source,
comm = .pbd_env$SPMD.CT$comm)
Every rank has x
returned.
an object to be broadcast from all ranks.
a rank of source where x
broadcast from.
a communicator number.
Wei-Chen Chen wccsnow@gmail.com, George Ostrouchov, Drew Schmidt, Pragneshkumar Patel, and Hao Yu.
The same copy of x
is sent to all ranks.
See methods{"bcast"}
for S4 dispatch cases and the source code for
further details.
Programming with Big Data in R Website: https://pbdr.org/
scatter()
.
### Save code in a file "demo.r" and run with 2 processors by
### SHELL> mpiexec -np 2 Rscript demo.r
spmd.code <- "
### Initialize
suppressMessages(library(pbdMPI, quietly = TRUE))
### Examples.
x <- matrix(1:5, nrow = 1)
y <- bcast(x)
comm.print(y)
### Finish.
finalize()
"
pbdMPI::execmpi(spmd.code, nranks = 2L)
Run the code above in your browser using DataLab