[R] (performance) time in Windows vs Linux

Gavin Simpson gavin.simpson at ucl.ac.uk
Mon Jun 29 10:09:59 CEST 2009


On Mon, 2009-06-29 at 19:21 +1200, Patrick Connolly wrote:
> On Mon, 29-Jun-2009 at 09:05AM +0200, Zeljko Vrba wrote:
> 
> |> On Mon, Jun 29, 2009 at 06:56:55PM +1200, Patrick Connolly wrote:
> |> > On Mon, 29-Jun-2009 at 02:13AM -0400, milton ruser wrote:
> |> > 
> |> > |> Really?
> |> > |> 
> |> > |> In fact I have a quadcore. But how can I know if Linux are really
> |> > |> using only one core, and how can I setup it to use the 4cores?
> |> > 
> |> > I use GKrellM (install with "aptitude install gkrellm" if you don't
> |> > have it already).  It shows a trace of the % activity for each CPU
> |> > where it's very clear if only one is being used.  I've never had
> |> > occasion to change such a setting, but someone more skilled in such
> |> > things could say how to make it use more than one.
> |> > 
> |> How do you know that it is *R* that uses all 4 CPUs, and not other
> |> applications on the system?  What does running "top" in the
> |> terminal say?  If R uses more than one CPU, it's CPU usage will be
> |> > 100%.
> 
> There are undoubtedly more scientific ways, but if the machine is idling
> with both krells showing a very low number like 2% BEFORE running the
> R script, and then we see only one suddenly become 99 or 100%, it's a
> fairly safe bet that it was R that made the difference -- particularly
> if it drops back once the R code finishes.
> 
> I think top adds the two usages together, so values over 100% would be
> possible.  The numbers shown by GKrellM could be thought of as more
> sensible where you have the choice of composite, real or both.

Hmm, R is a single threaded application - you might be able to call
functions that use multi-threaded compiled code that will use the extra
cores, but R itself won't, whether it is running on Linux or Windows.

On my 4 core workstation, top reports load averages up to (and a bit
exceeding sometimes) 4 when I'm utilising all 4 cores for processing
jobs - but that is only when I initiate 4 separate R processes; each of
the 4 processes only ever has 100% maximum usage.

I think you are being misled by krellms; on my 4 core workstation the
cpu throttling application you can stick in the panel (cpufreq or
cpuspeed) reports that pairs of cores hit full speed when required, say
when running a single R process. But that R process is only using 100%
of one core - if you have top or system monitor running, you'll see
this. I think this is because the 4 cores are on two chips and if you
need to run one core up to full speed, the other core on that chip also
gets sped up, but it isn't crunching anything.

G

> 
> HTH
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list