[R] Parallel programming.

2017-03-29 Thread Art U
Hello everyone, I have general question about parallel programming. I'm doing simulations that involves bootstrap. For now I'm using parLapply only for bootstrap part and then function "replicate" for simulations. It is very long function, so here is a short version: simfun=function(data,n,alpha

Re: [R] Parallel Programming

2012-09-21 Thread Bert Gunter
Inline below. On Fri, Sep 21, 2012 at 9:05 AM, R. Michael Weylandt wrote: > On Fri, Sep 21, 2012 at 5:43 AM, Tjun Kiat Teo wrote: >> I am trying to do parallel programming and I tried this >> >> library(doSNOW) >> library(foreach) >> >> testfunc<-function(x){ >> x<-x+1 >> x >> } >> >> noc<-2 >>

Re: [R] Parallel Programming

2012-09-21 Thread R. Michael Weylandt
On Fri, Sep 21, 2012 at 5:43 AM, Tjun Kiat Teo wrote: > I am trying to do parallel programming and I tried this > > library(doSNOW) > library(foreach) > > testfunc<-function(x){ > x<-x+1 > x > } > > noc<-2 > > cl <- makeCluster(do.call(rbind,rep(list("localhost"),noc)), type = "SOCK") > registerDo

Re: [R] Parallel Programming

2012-09-20 Thread Jeff Newmiller
Then don't do that. Use your script file to define functions. Source that file before the loop to load them into memory. Call those functions from within your loop. --- Jeff NewmillerThe .

[R] Parallel Programming

2012-09-20 Thread Tjun Kiat Teo
I am trying to do parallel programming and I tried this library(doSNOW) library(foreach) testfunc<-function(x){ x<-x+1 x } noc<-2 cl <- makeCluster(do.call(rbind,rep(list("localhost"),noc)), type = "SOCK") registerDoSNOW(cl) clusterExport(cl=cl,c("testfunc.r")) testl<-foreach(pp=1:2) %dopar%