doFuture
:rocket: R package: doFuture - Use Foreach to Parallelize via Future Framework
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
Repository
:rocket: R package: doFuture - Use Foreach to Parallelize via Future Framework
Basic Info
- Host: GitHub
- Owner: futureverse
- Language: R
- Default Branch: develop
- Homepage: https://doFuture.futureverse.org
- Size: 2.11 MB
Statistics
- Stars: 84
- Watchers: 4
- Forks: 7
- Open Issues: 6
- Releases: 0
Topics
Metadata Files
README.md
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:
y <- foreach(...) %dofuture% { ... }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
- Website: https://www.futureverse.org
- Repositories: 21
- Profile: https://github.com/futureverse
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
Top Committers
| Name | 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
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
- Homepage: https://doFuture.futureverse.org
- Documentation: http://cran.r-project.org/web/packages/doFuture/doFuture.pdf
- License: LGPL-2.1 | LGPL-3 [expanded from: LGPL (≥ 2.1)]
-
Latest release: 1.1.2
published 7 months ago
Rankings
Maintainers (1)
Dependencies
- 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
- 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
- actions/cache v3 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- 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