View source: R/050_ExecutionConfig.R
| setup_FutureExecution | R Documentation |
FutureExecutionConfigParallel execution through future. A plan is required, and is filled in
from getOption("future.plan", "mirai_multisession") when not given.
setup_FutureExecution(
n_workers = NULL,
n_workers_outer = NULL,
n_workers_tuning = NULL,
n_workers_algorithm = NULL,
device = NULL,
future_plan = getOption("future.plan", "mirai_multisession"),
on_error = c("continue", "stop", "stop_outer"),
seed = NULL,
shared_memory = c("auto", "none", "always")
)
n_workers |
Integer [1, Inf): Number of parallel workers. Left |
n_workers_outer |
Optional Integer [1, Inf): Workers for outer resampling, overriding the automatic assignment. |
n_workers_tuning |
Optional Integer [1, Inf): Workers for tuning, overriding the automatic assignment. |
n_workers_algorithm |
Optional Integer [1, Inf): Threads for a self-parallelizing algorithm, overriding the automatic assignment. |
device |
Optional |
future_plan |
Character: Future plan to use. Defaults to
|
on_error |
Character {"continue", "stop", "stop_outer"}: Failure policy.
|
seed |
Optional Integer [0, Inf): Master seed for the run's computation RNG,
from which one independent substream per parallel task is derived. Left |
shared_memory |
Character {"none", "auto", "always"}: Whether to hand workers
the training data through OS shared memory instead of serializing a copy to each.
|
Worker levels
There are three levels that can absorb workers: a self-parallelizing algorithm,
tuning, and outer resampling. Left alone, n_workers is assigned to exactly one of
them, in that order of priority, so no two levels compete for the same cores.
Naming any of n_workers_outer, n_workers_tuning or n_workers_algorithm takes
over that assignment: the automatic one is switched off entirely and any level not
named gets 1, so a run never mixes a hand-picked level with an inferred one.
Outer resampling and tuning dispatch to worker processes, and an outer fold runs
inside one of those processes, so only one of the two can be parallel – setting both
above 1 is an error. n_workers_algorithm is threads within a worker, so it combines
with either.
Reproducibility
Substreams are assigned by task index, so a run gives the same answer under every backend and worker count, and the parallel result matches the sequential one exactly.
Shared memory needs mori, whose minimum R version (4.3) is above
rtemis's own (4.1), so "auto" is the portable setting for a script that may
run anywhere. It is local RAM: workers on another machine cannot map it.
FutureExecutionConfig object.
EDG
setup_FutureExecution(n_workers = 4L, future_plan = "multisession")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.