There's plenty of slides on the benefits of doing parallel computing and
just when it becomes cost effective. I've flipped through Dirk's slides (
here <http://dirk.eddelbuettel.com/papers/useR2010hpcTutorial.pdf>) and he
seems to mention Amdahl's law.

Cheers,
Roman



On Mon, Jul 18, 2011 at 9:25 PM, Megh Dal <megh700004@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@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>



-- 
In God we trust, all others bring data.

	[[alternative HTML version deleted]]

