| regsen_cores | R Documentation |
Sets or reads the number of cores that regsen_bounds(),
regsen_breakdown(), regsen_multi() and regsen_boot() use by
default. Each of those also takes an ncores argument for a single
call; this sets the session-wide default those arguments fall back to,
held in options(regsensitivity.ncores).
regsen_cores(n = NULL)
n |
One of:
Whatever is set, at most 2 are used while |
Parallel runs return exactly what serial runs return. The identified set and the breakdown frontiers draw no random numbers, and the bootstrap seeds each replicate from a vector drawn once up front, so nothing depends on how the work was divided.
On macOS and Linux the work is forked with parallel::mclapply(), so the
data and model need no copying. Windows has no fork; it gets a PSOCK
cluster, which is slower to start and pays to ship the data once, so
there the gain is only worth having for long jobs (a bootstrap, or a
finite-rybar sweep with many grid points).
What is parallel: the grid points of a regsen_bounds() sweep (only the
finite-rybar regime costs anything; the closed forms are cheap either
way), the values of a regsen_breakdown() frontier, the treatments of
regsen_multi(), and the replicates and jackknife of regsen_boot().
Work inside a replicate or a treatment is run serially, so cores are
never oversubscribed by nesting.
The number of cores in effect after the call, invisibly when
n is given.
old <- getOption("regsensitivity.ncores")
regsen_cores() # the current setting, 1 unless changed
regsen_cores(2) # run the sweeps on two cores
regsen_cores(1) # back to serial
options(regsensitivity.ncores = old)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.