[R] multicore - no parallel
David M Smith
david at revolution-computing.com
Mon Oct 5 01:51:43 CEST 2009
On Sat, Oct 3, 2009 at 7:13 PM, dunno87 <benparker1987 at hotmail.com> wrote:
> Thanks for the help in advance. I just want to know if there is absolutely
> any way of using multicore if my loop can't run in parallel as each
> iteration depends on the previous iteration. I have Windows R 2.9.2 and
> REvolution R Enterprise 2.0 for Windows 64 bit. I also have if necessary R
> on Ubuntu. 8gb of ram and a core 2 duo processor but I could use a quad core
> as well.
Without more details about your particular problem, it's hard to tell
if it's possible to parallelize the problem using foreach. If one
iteration does depend on the value of the previous one, it's not
immediately parallelizable. Sometimes you can refactor the problem (or
part of it) to remove the dependence, but not always.
If each iteration makes heavy use of matrix operations (multiply,
invert, decompose) you may already be making use of your multiple
cores. REvolution R Enterprise is linked to multi-threaded math
libraries which use multiple cores in parallel for such operations.
Make sure getMKLthreads() is returning the number cores you have (and
if not, use setMKLthreads).
While your loop is running, use the Task Manager to take a look at
your CPU usage -- if all cores are already being utilized there's no
real need to parallelize the for loop.
By the way, since you have a support subscription with REvolution R
Enterprise you can always ask your questions directly of our support
team or via http://forums.revolution-computing.com.
# David Smith
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-help