Hi, I have an R script which is time consuming because it has two nested loops in it of at least 5000 iterations each, I have tried to use the multicore package but id doesn't seem to improve the elapsed time of the script(a shorter script for example) and I can't use the mcapply because of technical reasons. I was wondering how can I make my script use more cores and memory because I am running it on a server and it is a shame that it uses only one core. Thanks! Moriah -- View this message in context: http://r.789695.n4.nabble.com/Using-multicores-in-R-tp4651808.html Sent from the R help mailing list archive at Nabble.com.
On 03.12.2012 11:14, moriah wrote:> Hi, > > I have an R script which is time consuming because it has two nested loops > in it of at least 5000 iterations each, I have tried to use the multicore > package but id doesn't seem to improve the elapsed time of the script(a > shorter script for example) and I can't use the mcapply because of technical > reasons.Errr, but otherwise multicore does not have an effect ... See package "parallel" that offers various functions for parallel computations. We cannot help much more if you do not tell us what the technical reasons are why mcapply() does not work. Best, Uwe Ligges> > I was wondering how can I make my script use more cores and memory because I > am running it on a server and it is a shame that it uses only one core.> > Thanks! > Moriah > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Using-multicores-in-R-tp4651808.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Moriah, Since you are doing nested loops, Rcpp may be an easy speed-up. Follow all the links here http://blog.revolutionanalytics.com/2012/11/hadleys-guide-to-high-performance-r-with-rcpp.html for details. HTH, Jim Porzak Minted.com San Francisco, CA www.linkedin.com/in/jimporzak use R! Group SF: www.meetup.com/R-Users/ On Mon, Dec 3, 2012 at 2:14 AM, moriah <moriahcohen at gmail.com> wrote:> Hi, > > I have an R script which is time consuming because it has two nested loops > in it of at least 5000 iterations each, I have tried to use the multicore > package but id doesn't seem to improve the elapsed time of the script(a > shorter script for example) and I can't use the mcapply because of technical > reasons. > > I was wondering how can I make my script use more cores and memory because I > am running it on a server and it is a shame that it uses only one core. > > Thanks! > Moriah > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Using-multicores-in-R-tp4651808.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.