[R] R with multiple processors

Tony Long tdlong at uci.edu
Thu Feb 15 18:16:54 CET 2001


R is inefficient enough that if you need 12 processors you may 
consider writing your function in C.  Alternatively you can identify 
the part of your R code where most your CPU cycles are being used and 
make that a function in C.  Porting large chucks of R code or even 
small routines that are gobbling up CPU cycles can give your orders 
of magnitude speed changes!   Once you learn how to do it, letting R 
call external compiled function is really very easy.



At 8:26 AM -0800 2/15/01, Thomas Lumley wrote:
>On Wed, 14 Feb 2001, Isabel Canette wrote:
>
>>  Hello.
>>
>>  The laboratory where I work has the possibility to get a Sun machine with 12
>>  processors. My question is: can R be used to implememt parallel algorithms
>>  which take into account the several processors? Is there a way to 
>>run *threads*
>>  in R?
>>
>>  If this is possible, would somebody share his/her experiences?
>
>It is not possible to run threads in R.  However, it is possible to call
>other threaded code, as the R-Java and R-Tcl interfaces demonstrate.  You
>could probably call parallel C or Fortran code. Alternatively, for a
>problem with fairly low communication requirements you could control
>multiple R processes from one central program and feed them each  bits of
>computation.
>
>I usually want to run any given computation lots of times, so the solution
>is easy: instead of running it 1000 times on 1 processor, run it 80 times
>on each of 12 processors.
>
>	-thomas
>
>Thomas Lumley			Asst. Professor, Biostatistics
>tlumley at u.washington.edu	University of Washington, Seattle
>
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Tony Long
Ecology and Evolutionary Biology
Steinhaus Hall
University of California at Irvine
Irvine, CA
92697-2525

Tel:  (949) 824-2562   (office)
Tel:  (949) 824-5994   (lab)
Fax: (949) 824-2181

email:  tdlong at uci.edu
http://hjmuller.bio.uci.edu/~labhome/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list