doLapply() iterates over all subjobs (using the non-parallel
lapply()). Similarly, but in parallel, for
doForeach (based on CRAN package foreach()),
doRmpi (based on mpi.apply()),
doMclapply (based on mclapply()), and
doClusterApply (based on 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="" 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" )="" detectcores(),="" doclusterapply(vlist,="" cluster="makeCluster(detectCores()," type="PSOCK" ),="" initexpr,="" ...)<="" p="">doRes.equal(x, y, tol = 1e-15, ...)
=>list of variable specifications. Each
variable spec is itself a named list which must contain a
"value" component.makeCluster(). For doForeach(), this can
be NULL as well, see Details below.doForeach(), this can
be NULL as well, see Details below.doRmpi, passed
to package mpi.spawn.Rslaves when no
running workers are found.logical indicating whether
load balancing is used:
[object Object],[object Object],[object Object]subjob().saveSim().function for computing one
row of the (physical) grid.character vector of packages to be made
available on the nodes.character vector of functions (for
doForeach() and doClusterApply()) or
objects (for subjob() (typically
further passed on to doOne()), or, for doRes.equal(), to
all.equal(*).doLapply() which should be
compared where sensible, i.e., the first three components
"value","error","warning", using
all.equalall.equal(*).subjob() to all subjobs, converted with
saveSim().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
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.
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, ...
}Run the code above in your browser using DataLab