The default is to use synchronous futures, but this default can be overridden via R options, system environment variables and command-line options as explained below as well as in
help("future.options", package = "future").
The default strategy for resolving futures can be controlled via R option
future.plan. For instance, if we add
options(future.plan = "multisession")
~/.Rprofile startup script, the future package will resolve futures in parallel (asynchronously using all available cores), i.e.
$ Rscript -e "class(future::plan())"  "multisession" "future" "function"
future.plan is ignored if command-line option
-p) is specified.
An alternative to using
options() for setting option
future.plan is to specify system environment variable
R_FUTURE_PLAN. If set, then the future package will set
future.plan accordingly when loaded. For example,
$ export R_FUTURE_PLAN=multisession $ Rscript -e "class(future::plan())"  "multisession" "future" "function"
R_FUTURE_PLAN is ignored if either option
future.plan or command-line option
-p) is specified.
When loaded, the future package checks for the command-line option
-p ncores) and sets the future strategy (via option
future.plan) and the number of available cores (via option
mc.cores) accordingly. This provides a convenient mechanism for specifying parallel future processing from the command line. For example, if we start R with
$ R --quiet --args --parallel=2
then future will interpret this as we wish to resolve futures in parallel using 2 cores. More specifically, we get that
> future::availableCores() mc.cores 2 > class(future::plan())  "tweaked" "multisession" "future" "function"
We can use this command-line option also with
Rscript, which provides a convenient mechanism for launching future-enhanced R scripts such that they run in parallel, e.g.
$ Rscript analysis.R --parallel=4
This does, of course, require that the script uses futures and the future package.
--parallel=1 is specified, or equivalently
-p 1, then futures are resolved using a single process.
Specifying these command-line options override any other startup settings.
Copyright Henrik Bengtsson, 2015-2020