The BiocParallel.FutureParam package provides FutureParam, a BiocParallel::BiocParallelParam class, for the BiocParallel package that works with any type of future. (that is supported by Future API of the future package) can be used for asynchronous (parallel/distributed) or synchronous (sequential) processing.


Futures themselves are provided by the future package, e.g. multicore, multisession, ad hoc cluster, and MPI cluster futures. Additional futures are provided by other packages. For example, batchtools futures are implemented by the future.batchtools package, which expands the support for asynchronous processing to anything that the batchtools package supports.

To use futures with the BiocParallel package, load BiocParallel.FutureParam, call register(FutureParam()), select the type of future you wish to use via future:plan().


library("BiocParallel.FutureParam") register(FutureParam()) plan(multisession) mu <- 1.0 sigma <- 2.0 x <- bplapply(1:3, mu = mu, sigma = sigma, function(i, mu, sigma) { rnorm(i, mean = mu, sd = sigma) }) print(x)
#> [[1]] #> [1] 2.483216 #> #> [[2]] #> [1] -1.729922 2.200157 #> #> [[3]] #> [1] 1.997783 1.653568 3.274135 #>
## WORKAROUND: For some reason, 'R CMD check' on Windows will give an ## error when running this example with plan(multisession), unless we ## reset the future plan at the end. plan(sequential)