0

I try to use parApply() in parallel package in R.

 cl <- makeCluster(16)
 cl.boot <-makeCluster(8)

In my programme, I call t(parApply(cl,rv,1,sim.one.test)) first. In function sim.one.test,a call a function boot(). And in boot(), I use

 bs.resample <- t(parApply(cl.boot,rv.boot,1,function(x) bs.mle(n1,n2,x,s,t1,t2,m,theta)))

Simply, the outer function is sim.one.test() and inner one is bs.mle(). The error information is invalid connection. I guess this is because nested parallel is not supported. From another questions on stackoverflow, it is suggested I should use mcapply() which only can be applied on Linux but I run the programme on Windows platform. Is there any solution for nested parallel computing on Windows platform? Thanks.

Community
  • 1
  • 1
Sun Dayu
  • 1
  • 1

1 Answers1

1

Why do you think you need nested parallelization? That will just increase your parallelization overhead (if it works at all, which I doubt). Conceptually, it's by far better to only parallelize the outer loop (provided it contains enough iterations and is more or less load-balanced).

However, you could use nested foreach loops with a parallel backend. That would convert your nested loops into one loop before sending it to the workers.

Roland
  • 127,288
  • 10
  • 191
  • 288