mpi.apply {Rmpi} | R Documentation |
An array (length <= total number of slaves) is scattered to slaves so that the first
slave calls fun
with arguments x[[1]]
and ...
, the second one
calls with arguments x[[2]]
and ...
, and so on.
mpi.apply(x, fun, ..., comm=1)
x |
an array |
fun |
a function |
... |
optional arguments to fun |
comm |
a communicator number |
A list of the results is returned. Its length is the same as that of x
. In
case the call fun
with arguments x[[i]]
and ...
fails on ith
slave, corresponding error message will be returned in the returning list.
Hao Yu
## Not run: #Assume that there are at least 5 slaves running #Otherwise run mpi.spawn.Rslaves(nslaves=5) x=c(10,20) mpi.apply(x,runif) meanx=1:5 mpi.apply(meanx,rnorm,n=2,sd=4) ## End(Not run)