Last data update: 2014.03.03

R: doFuture: Foreach Parallel Adaptor using Futures
doFutureR Documentation

doFuture: Foreach Parallel Adaptor using Futures

Description

The doFuture package provides a %dopar% adaptor for the foreach package such that 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.

Details

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, BatchJobs futures are implemented by the future.BatchJobs package, which expands the support for asynchronous processing to anything that the BatchJobs package supports.

To use futures with the foreach package, load doFuture, use registerDoFuture() to register it to be used as a %dopar% adaptor, and select the type of future you wish to use via plan().

Examples


library("doFuture")
registerDoFuture()
plan(multiprocess)

mu <- 1.0
sigma <- 2.0
foreach(i=1:3) %dopar% {
  rnorm(i, mean=mu, sd=sigma)
}

Results