The Futureverse is a unifying framework for parallelization and distributed processing in R. This package, futureverse, is a utility wrapper package that makes it easy to install most common Futureverse packages in one go.
TL;DR
Start by configuring Futureverse to parallelize on the current computer:
future::plan(future::multisession)After this, all it takes is a minor tweak to make your existing lapply(), map(), or foreach() code to run in parallel, e.g.
## future.apply: futurized version of base R apply
library(future.apply)
y <- lapply(X, slow_fcn)
y <- future_lapply(X, slow_fcn)
## furrr: futurized version of purrr
library(furrr)
y <- X |> map(slow_fcn)
y <- X |> future_map(slow_fcn)
## foreach: futurized version
library(foreach)
y <- foreach(x = X) %do% slow_fcn(x)
y <- foreach(x = X) %dofuture% slow_fcn(x)Installation
Call:
install.packages("futureverse")to install:
- future - the core Futureverse package
- future.apply - Futureverse variants of base-R apply functions
- furrr - Futureverse variants of purrr apply functions
- doFuture - Futureverse adaptors for the foreach package
- progressr - Near-live progress updates when using Futureverse
Call:
install.packages("futureverse", dependencies = TRUE)to install also additional parallel backends:
-
future.mirai - a modern alternative to built-in
plan(multisession) -
future.callr - a memory efficient alternative to built-in
plan(multisession) - future.batchtools - parallelize on HPC job schedulers; Load Sharing Facility (LSF), OpenLava, TORQUE/PBS, Sun/Son of/Oracle/Univa/Altair Grid Engine (SGE), Slurm
Want to learn more?
- Tutorials and Workshops: https://www.futureverse.org/tutorials.html
- Blog: https://www.futureverse.org/blog.html
- Publications: https://www.futureverse.org/publications.html
- Support: https://github.com/orgs/futureverse/discussions
