Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
By Andrie de Vries
Earlier this month Rich Calaway, programme manager at Microsoft and maintainer of the foreach package, published some updates to the foreach suite of packages, including:
Most of the changes were cosmetic, or to conform to CRAN policy. However, the last two packages (doParallel and doSNOW) had some functional changes.
doSnow
The doSNOW package is a foreach parallel adaptor for the ‘snow’ Package. Thus it provides a parallel backend for the %dopar% function using Luke Tierney’s snow package. (The snow package itself enables a “Simple Network of Workstations”, i.e. support for simple parallel computing in R.)
The functional changes to doSNOW were the addition of support for user-defined progress bars.
This means that you easily enable progress bars when setting up a parallel job with doSNOW.
You can try it out with this code:
You can get other examples here.
doParallel
The doParallel package provides a parallel backend for the %dopar% function using the parallel package (part of base R).
In doParallel, the most important change (change log) was a bug fix to stopImplicitCluster functionality, courtesy of Dan Tenenbaum.
Previous blog posts
We have previously written about the foreach package and parallel processing:
- Tutorial: Parallel programming with foreach
- Creating progress bars with foreach parallel processing
- Monitoring progress of a foreach parallel job
Resources
To get started with foreach, take a look at the vignette at https://cran.r-project.org/web/packages/foreach/vignettes/foreach.pdf
To get started with parallel programming with foreach and doParallel, the vignette is a great a resource: https://cran.r-project.org/web/packages/doParallel/vignettes/gettingstartedParallel.pdf
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.