mpi.iapplyLB {Rmpi} | R Documentation |
(Load balancing) parallellapply
and related functions.
mpi.iapplyLB(x, fun, ..., apply.seq=NULL, comm=1, sleep=0.001) mpi.iparApply(x, MARGIN, fun, ..., job.num = mpi.comm.size(comm)-1, apply.seq=NULL, comm=1, sleep=0.001) mpi.iparLapply(x, fun, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1,sleep=0.001) mpi.iparSapply(x, fun, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify=TRUE, USE.NAMES = TRUE, comm=1, sleep=0.001) mpi.iparRapply(x, fun, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1, sleep=0.001) mpi.iparCapply(x, fun, ..., job.num=mpi.comm.size(comm)-1, apply.seq=NULL, comm=1,sleep=0.001) mpi.iparReplicate(n, expr, job.num=mpi.comm.size(comm)-1, apply.seq=NULL, simplify = TRUE, comm=1,sleep=0.001)
x |
an array or matrix. |
MARGIN |
vector specifying the dimensions to use. |
fun |
a function. |
simplify |
logical; should the result be simplified to a vector or matrix if possible? |
USE.NAMES |
logical; if TRUE and if x is character, use x as
names for the result unless it had names already. |
n |
number of replications. |
expr |
expression to evaluate repeatedly. |
job.num |
Total job numbers. If job numbers is bigger than total slave numbers (default value), a load balancing approach is used. |
apply.seq |
if reproducing the same computation (simulation) is desirable, set it to the integer vector .mpi.applyLB generated in previous computation (simulation). |
... |
optional arguments to fun |
comm |
a communicator number |
sleep |
a sleep interval on master node (in sec) |
mpi.iparApply
, mpi.iparLapply
, mpi.iparSapply
, mpi.iparRapply
,
mpi.iparCapply
, mpi.iparSapply
, and mi.iparReplicate
are nonblocking
versions of mpi.parApply
, mpi.parLapply
, mpi.parSapply
, mpi.parRapply
,
mpi.parCapply
, mpi.parSapply
, and mpi.parReplicate
, respectively.
The main difference is that mpi.iprobe
and Sys.sleep
are used so that master node
consumes almost no CPU cycles while waiting for slaves results. However, due to frequent wake/sleep
cycles on master, those functions are not suitable for running small jobs on slave nodes. If
anticipated computing time for each job is relatively long, e.g., minutes or hours, setting sleep
to be 1 second or longer will further reduce load on master (only slightly).