[R-pkgs] Parallel programming packages iterators, foreach and doMC released
David M Smith
david at revolution-computing.com
Wed Jul 1 18:45:08 CEST 2009
REvolution Computing has just released three new packages for R to
CRAN (under the open-source Apache 2.0 license): foreach, iterators,
and doMC. Together, they provide a simple, scalable parallel computing
framework for R that lets you take advantage of your multicore or
multiprocessor workstation to program loops that run faster than
traditional loops in R.
The three packages build on each other to implement a new loop
construct for R -- foreach -- where iterations may run in parallel on
separate cores or processors.
"iterators" implements the iterator object familiar to users of
languages like Java, C# and Python to make it easy to program useful
sequences - from all the prime numbers to the columns of a matrix or
the rows of an external database. Iterators objects are used as the
index variable for the parallel loops.
"foreach" builds on the "iterators" package to introduce a new way of
programming loops in R. Unlike the traditional for loop, a foreach
loop can run multiple iterations simultaneously, in parallel. If you
only have a single-processor machine, foreach runs iterations
sequentially. But with a multiprocessor workstation and a connection
to a parallel programming backend, multiple iterations of the loop
will run in parallel. This means that without any changes to your
code, the loop will run faster (and with a speedup scaled by the
number of available cores or processors, potentially much faster).
"doMC" provides such a link between "foreach" and a parallel
programming backend -- in this case, the multicore package (from Simon
Urbanek). With this connection, foreach loops on MacOS and Unix/Linux
systems will make use of all the available cores/processors on the
local workstation to run iterations in parallel.
More information at blog.revolution-computing.com:
David M Smith <david at revolution-computing.com>
Director of Community, REvolution Computing www.revolution-computing.com
Tel: +1 (206) 577-4778 x3203 (San Francisco, USA)
Check out our upcoming events schedule at www.revolution-computing.com/events
More information about the R-packages