Grokbase Groups R r-help June 2012
FAQ
I'm noticing a huge performance hit when using foreach with doSNOW.? Any ideas on why the parallel loop runs ~8 times slower than?the same foreach run sequentially?
?
require(doSNOW)
Loading required package: doSNOW
Loading required package: foreach
foreach: simple, scalable parallel programming from Revolution Analytics
Use Revolution R for scalability, fault tolerance and more.
http://www.revolutionanalytics.com
Loading required package: iterators
Loading required package: snow
cl = makeSOCKcluster(rep("localhost",3))
registerDoSNOW(cl)

system.time((
+ x = foreach(i=seq(1,5000)) %dopar% {
+???? arima.sim(n = 250, list(ar=c(0.8897, -0.4858), ma=c(-0.2279, 0.2488)),
+???????? rand.gen = function(n, ...) sqrt(0.1796) * rt(n, df = 5))
+ }
+ ))
?? user? system elapsed
?? 4.46??? 0.22?? 50.27
system.time((
+ y= foreach(i=seq(1,5000)) %do% {
+???? arima.sim(n = 250, list(ar=c(0.8897, -0.4858), ma=c(-0.2279, 0.2488)),
+???????? rand.gen = function(n, ...) sqrt(0.1796) * rt(n, df = 5))
+ }
+ ))
?? user? system elapsed
?? 6.25??? 0.01??? 6.27
system.time((
+ for (i in seq(1,5000)) {
+ x = arima.sim(n = 250, list(ar=c(0.8897, -0.4858), ma=c(-0.2279, 0.2488)),
+???????? rand.gen = function(n, ...) sqrt(0.1796) * rt(n, df = 5))
+ }
+ ))
?? user? system elapsed
?? 2.76??? 0.00??? 2.76


Dominic J. Pazzula
+-+-+-+-+-+-+-+-+-+-+-
dompazz at yahoo.com

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupr-help @
categoriesr
postedJun 12, '12 at 11:35p
activeJun 12, '12 at 11:35p
posts1
users1
websiter-project.org
irc#r

1 user in discussion

Dom Pazzula: 1 post

People

Translate

site design / logo © 2022 Grokbase