doApply | R Documentation |
doLapply()
iterates over all subjobs (using the non-parallel
lapply()
). Similarly, but in parallel, for
doForeach
(based on CRAN package foreach's foreach()
),
doRmpi
(based on Rmpi's mpi.apply()
),
doMclapply
(based on parallel's mclapply()
), and
doClusterApply
(based on parallel's clusterApply()
).
doRes.equal()
is simple convenience wrapper for
all.equal()
, for comparing two results (from the same
varlist
and doOne
arguments) of the do*
lapply-like functions above.
doLapply(vList, seed="seq", repFirst=TRUE,
sfile=NULL, check=TRUE, doAL=TRUE, subjob.=subjob, monitor=FALSE,
doOne, ...)
doForeach(vList, cluster=makeCluster(detectCores(), type="PSOCK"),
cores=NULL, block.size = 1, seed="seq", repFirst=TRUE,
sfile=NULL, check=TRUE, doAL=TRUE, subjob.=subjob, monitor=FALSE,
doOne, extraPkgs=character(), exports=character(), ...)
doRmpi(vList,
nslaves = if((sz <- Rmpi::mpi.universe.size()) <= 1) detectCores() else sz,
load.balancing=TRUE, block.size = 1, seed="seq", repFirst=TRUE,
sfile=NULL, check=TRUE, doAL=TRUE, subjob.=subjob, monitor=FALSE,
doOne, exports=character(), ...)
doMclapply(vList, cores = if(.Platform$OS.type == "windows") 1 else detectCores(),
load.balancing=TRUE, block.size = 1, seed="seq", repFirst=TRUE,
sfile=NULL, check=TRUE, doAL=TRUE, subjob.=subjob, monitor=FALSE,
doOne, ...)
doClusterApply(vList, cluster=makeCluster(detectCores(), type="PSOCK"),
load.balancing=TRUE, block.size = 1, seed="seq", repFirst=TRUE,
sfile=NULL, check=TRUE, doAL=TRUE, subjob.=subjob, monitor=FALSE,
doOne, initExpr, exports=character(), ...)
doRes.equal(x, y, tol = 1e-15, ...)
vList |
a |
cluster |
cluster object, typically generated by
|
cores |
the number of cores. For |
nslaves |
the number of workers for |
load.balancing |
|
block.size |
size of blocks of rows in the virtual grid which are computed simultaneously (load-balancing). |
seed, repFirst |
see |
sfile, check, doAL |
see |
subjob. |
a |
doOne |
a user-supplied |
monitor |
a logical or a |
extraPkgs |
|
exports |
|
initExpr |
expression initially evaluated on the cluster (can be missing). |
... |
additional arguments passed to |
x,y |
each a result of, say |
tol |
passed to |
See the vignette or references in simsalapar-package
for
how to use these functions.
For reasons to choose "MPI"
as cluster type (if not on Windows),
see the discussion starting at
https://stat.ethz.ch/pipermail/r-sig-hpc/2013-April/001647.html.
For doForeach()
, precisely one of cluster
or
cores
has to be not NULL
. This will determine whether
the parallel computations are carried out on a cluster with multiple
nodes or on a multi-core processor.
The result of applying subjob()
to all subjobs, converted with
saveSim()
.
Marius Hofert and Martin Maechler.
subjob()
for computing a subjob. doCallWE()
for the return value of doOne()
. .Random.seed
for
information about random number generators and seeds.
if(simsalapar:::doExtras()) { ## needs some CPU
demo(robust.mean) # 512 simulations, differing block sizes, ...
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.