doFuture

:rocket: R package: doFuture - Use Foreach to Parallelize via Future Framework

https://github.com/futureverse/doFuture

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary

Keywords

batchjobs batchtools biocparallel cran distributed-computing foreach hpc hpc-clusters package parallel plyr r
Last synced: 6 months ago · JSON representation

Repository

:rocket: R package: doFuture - Use Foreach to Parallelize via Future Framework

Basic Info
Statistics
  • Stars: 84
  • Watchers: 4
  • Forks: 7
  • Open Issues: 6
  • Releases: 0
Topics
batchjobs batchtools biocparallel cran distributed-computing foreach hpc hpc-clusters package parallel plyr r
Created almost 10 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing

README.md

CRAN check status R CMD check status Coverage Status

doFuture: Use Foreach to Parallelize via the Future Framework

Introduction

The future package provides a generic API for using futures in R. A future is a simple yet powerful mechanism to evaluate an R expression and retrieve its value at some point in time. Futures can be resolved in many different ways depending on which strategy is used. There are various types of synchronous and asynchronous futures to choose from in the future package. Additional future backends are implemented in other packages. For instance, the future.batchtools package provides futures for any type of backend that the batchtools package supports. For an introduction to futures in R, please consult the vignettes of the future package.

The foreach package implements a map-reduce API with functions foreach() and times() that provides us with powerful methods for iterating over one or more sets of elements with the option to do it in parallel.

Two alternatives

The doFuture package provides two alternatives for using futures with foreach:

  1. y <- foreach(...) %dofuture% { ... }

  2. registerDoFuture() + y <- foreach(...) %dopar% { ... }.

Alternative 1: %dofuture%

The first alternative (recommended), which uses %dofuture%, avoids having to use registerDoFuture(). The %dofuture% operator provides a more consistent behavior than %dopar%, e.g. there is a unique set of foreach arguments instead of one per possible adapter. Identification of globals, random number generation (RNG), and error handling is handled by the future ecosystem, just like with other map-reduce solutions such as future.apply and furrr. An example is:

```r library(doFuture) plan(multisession)

y <- foreach(x = 1:4, y = 1:10) %dofuture% { z <- x + y slow_sqrt(z) } ```

This alternative is the recommended way to let foreach() parallelize via the future framework, especially if you start out from scratch.

See help("%dofuture%", package = "doFuture") for more details and examples on this approach.

Alternative 2: registerDoFuture() + %dopar%

The second alternative is based on the traditional foreach approach where one registers a foreach adapter to be used by %dopar%. A popular adapter is doParallel::registerDoParallel(), which parallelizes on the local machine using the parallel package. This package provides registerDoFuture(), which parallelizes using the future package, meaning any future-compliant parallel backend can be used.

An example is:

```r library(doFuture) registerDoFuture() plan(multisession)

y <- foreach(x = 1:4, y = 1:10) %dopar% { z <- x + y slow_sqrt(z) } ```

This alternative is useful if you already have a lot of R code that uses %dopar% and you just want to switch to using the future framework for parallelization. Using registerDoFuture() is also useful when you wish to use the future framework with packages and functions that uses foreach() and %dopar% internally, e.g. caret, plyr, NMF, and glmnet. It can also be used to configure the Bioconductor BiocParallel package, and any package that rely on it, to parallelize via the future framework.

See help("registerDoFuture", package = "doFuture") for more details and examples on this approach.

Installation

R package doFuture is available on CRAN and can be installed in R as: r install.packages("doFuture")

Pre-release version

To install the pre-release version that is available in Git branch develop on GitHub, use: r remotes::install_github("futureverse/doFuture", ref="develop") This will install the package from source.

Contributing

To contribute to this package, please see CONTRIBUTING.md.

Owner

  • Name: Futureverse
  • Login: futureverse
  • Kind: organization

A Unifying Parallelization Framework in R for Everyone

GitHub Events

Total
  • Issues event: 4
  • Issue comment event: 7
  • Pull request event: 1
Last Year
  • Issues event: 4
  • Issue comment event: 7
  • Pull request event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 727
  • Total Committers: 3
  • Avg Commits per committer: 242.333
  • Development Distribution Score (DDS): 0.011
Past Year
  • Commits: 85
  • Committers: 1
  • Avg Commits per committer: 85.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
hb hb@a****g 719
BHGC Website GHA Workflow Runner b****h@b****g 7
Florian Kohrt f****t@a****o 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 127
  • Total pull requests: 4
  • Average time to close issues: 4 months
  • Average time to close pull requests: 2 days
  • Total issue authors: 27
  • Total pull request authors: 3
  • Average comments per issue: 2.5
  • Average comments per pull request: 1.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 1
  • Average time to close issues: 7 days
  • Average time to close pull requests: 7 days
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 2.83
  • Average comments per pull request: 2.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • HenrikBengtsson (44)
  • statquant (3)
  • instantkaffee (3)
  • rimorob (3)
  • jonnybaik (2)
  • koenniem (2)
  • jakejh (2)
  • pat-s (2)
  • zhengchencai (2)
  • gunthergl (1)
  • ignacio82 (1)
  • ShixiangWang (1)
  • saraemoore (1)
  • chhtwhc (1)
  • cegbuna (1)
Pull Request Authors
  • jdblischak (2)
  • fkohrt (1)
  • HenrikBengtsson (1)
Top Labels
Issue Labels
question (13) enhancement (10) bug (10) Feature request (6) RNG (5) documentation (5) invalid (3) annoyancy (1) for-future-pkg (1) wontfix (1) duplicate (1) for-globals-pkg (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 39,784 last-month
  • Total docker downloads: 73,263
  • Total dependent packages: 45
  • Total dependent repositories: 83
  • Total versions: 23
  • Total maintainers: 1
cran.r-project.org: doFuture

Use Foreach to Parallelize via the Future Framework

  • Versions: 23
  • Dependent Packages: 45
  • Dependent Repositories: 83
  • Downloads: 39,784 Last month
  • Docker Downloads: 73,263
Rankings
Dependent packages count: 2.1%
Dependent repos count: 2.5%
Stargazers count: 4.6%
Downloads: 6.2%
Average: 9.0%
Forks count: 10.8%
Docker downloads count: 27.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • foreach >= 1.5.0 depends
  • future >= 1.28.0 depends
  • globals * imports
  • iterators * imports
  • parallel * imports
  • utils * imports
  • R.rsp * suggests
  • doRNG >= 1.8.2 suggests
  • markdown * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/covr.yaml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/doFuture.tests.extra.yaml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite