************************************************************************************************
I checked whether this example was run collectly or not in Windows XP(32bit) only !
************************************************************************************************
In R language, the members at Revolution R provide foreach and doSNOW packages for parallel computation. these packages allow us to compute things in parallel. So, we start to install these packages.
In foreach package, you can write the codes which are run not only in parallel but also in sequence. And, these are as following.
Next, we make clusters by doSNOW package for the purpose of parallel computation.
Because I have dual core machine, I specify two as the number of clusters.
Now, We are ready to compute things in parallel. It is easy for us to do that by foreach package. You only have to change "%do%" into "%dopar%". I compared the performance of parallel comutation to single computation as following.
(I'm sorry that some terms are written in Japanese!)
You can understand the result of parallel computation is about twice as fast as single computation do !!!
Reference(including PDF)
-http://cran.r-project.org/web/packages/foreach/foreach.pdf
-http://cran.r-project.org/web/packages/foreach/vignettes/foreach.pdf
-http://cran.r-project.org/web/packages/foreach/vignettes/nested.pdf
Great post :)
返信削除BTW, I wrote a similar post for windows users (using doSMP)
http://www.r-statistics.com/2010/04/parallel-multicore-processing-with-r-on-windows/
Cheers,
Tal
Thank you for your post!
返信削除Your article is very helpful to me.
thanks!
このコメントは投稿者によって削除されました。
返信削除Dose the code work on windows?
返信削除I tried the code in my Win 7 64bit system. But it can not work.
It stopped on this step:
registerDoSNOW(makeCluster(2, type = "SOCK"))
thanks.