bcast(x, rank.source = .SPMD.CT$rank.source, comm = .SPMD.CT$comm)
x
broadcast from.x
returned.x
is sent to all ranks.scatter()
.### Save code in a file "demo.r" and run with 2 processors by
### SHELL> mpiexec -np 2 Rscript demo.r
### Initial.
library(pbdMPI, quietly = TRUE)
init()
### Examples.
x <- matrix(1:5, nrow = 1)
y <- bcast(x)
comm.print(y)
### Finish.
finalize()
Run the code above in your browser using DataLab