[R-sig-hpc] Question on foreach package

Megh Dal megh700004 at yahoo.com
Mon Jul 18 21:43:37 CEST 2011


Actually when I run "%dopar%" 1st time, I got a warning:

Warning message:
executing %dopar% sequentially: no parallel backend registered 

However I was studying "http://cran.r-project.org/web/packages/foreach/vignettes/foreach.pdf" and there is no mention this word "parallel backend registered". What should I do with this? What actually I need to register?

Please forgive me as my question gives very stupid expression. However I just have started exploring foreach package. 
Thanks,


>________________________________
>From: Zachary Mayer <zach.mayer at gmail.com>
>To: Megh Dal <megh700004 at yahoo.com>
>Sent: Tuesday, July 19, 2011 12:57 AM
>Subject: Re: [R-sig-hpc] Question on foreach package
>
>
>Make sure you have a parallel backend enabled and properly configured.
>
>
>Open task manager while you run the computation and see if both cores are being used.
>
>
>On Mon, Jul 18, 2011 at 3:25 PM, Megh Dal <megh700004 at yahoo.com> wrote:
>
>As per the documentation of foreach package, if I use "%dopar%" then computation happens parallaly and on the contrary for %do%", it happens sequentially. Here, I tried both "%dopar%" and "%do%" for one of the examples given in the help page of ?foreach:
>>
>>> a <- matrix(1:1600, 40, 40)
>>> b <- t(a)
>>> system.time(foreach(b=iter(b, by='col'), .combine=cbind) %dopar%   (a %*% b))
>>   user  system elapsed 
>>   0.04    0.00    0.05 
>>> a <- matrix(1:1600, 40, 40)
>>> b <- t(a)
>>> system.time(foreach(b=iter(b, by='col'), .combine=cbind) %do%   (a %*% b))
>>   user  system elapsed 
>>   0.05    0.00    0.05 
>>
>>However surprisingly, I did not see any improvement in the computation time. I am using windows vista with dual core CPU (I think it is dual core as when I open Task manager -> Performance, I see there are 2 windows for CPU Usage History......... I am correct that it is dual core, right?) Therefore as it is dual core, shouldn't the computation time with "%dopar%" will be half of "%do%"?
>>
>>Am I missing something?
>>
>>Your help will be highly appreciated.
>>
>>Thanks
>>
>>_______________________________________________
>>R-sig-hpc mailing list
>>R-sig-hpc at r-project.org
>>https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>>
>
>
>



More information about the R-sig-hpc mailing list