[R] Ubuntu vs Mac OS X

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Apr 26 13:27:31 CEST 2008


Three comments, all from the 'R Installation and Adminstration' manual.

1) In general there is a small performance penalty for using a 64-bit 
version of R (larger pointers to move around).

2) For speed, bulld yourself a non-shared-library version of R.  Those 
binary maintainers are supplying an R-shlib version that suits their 
agendas but maybe not yours.  You may also want to increase the 
optimization level on the compiler.

3) If you are doing matrix algebra you want an optimized BLAS.  The CRAN 
build of R for Mac OS by default uses vecLib (which is optimized by 
Apple).  On other OSes R can be built to use optimized BLAS (see the 
manual) -- my understanding is that on Debian derivatives it is built to 
make use of the system libblas, and you can install versions of the latter 
based on ATLAS. Some optimized BLAS can make use of multiple CPUs.

You have not told us what chip your '3.2 GHz Dual-core' is -- it will 
matter for an optimized BLAS.  On Core 2 Duos I tend to use the (academic 
use only) BLAS by Dr Goto.  On my modest Intel E6600 Core 2 Duo I get

> system.time(coco2<-eigen(coco))
    user  system elapsed
  11.984   0.052  12.065
> system.time(coco3<-coco%*%coco)
    user  system elapsed
   1.694   0.000   1.694

with vanilla 64-bit R compiled at -O3 and

> system.time(coco2<-eigen(coco))
    user  system elapsed
   7.450   0.062   3.912
> system.time(coco3<-coco%*%coco)
    user  system elapsed
   0.249   0.007   0.132

with the Goto BLAS.  These are using both cores, as you see from the 
elapsed times.  It is the work of moments to swap the BLAS used, which is 
how I did that test.


On Fri, 25 Apr 2008, Guillaume Blanchet wrote:

> Hi !
>
> I have installed R-2.7.0 64-bits on a computer where the new Ubuntu
> version (8.04) was installed. This computer is a 3.2 GHz Dual-core with
> 2 Gb of RAM.
>
> To test how fast (I though !) this machine is, I compared two simple
> matrix manipulations between Ubuntu and my laptop (a MacBook Pro 2.2 GHz
> with also 2 Gb of RAM under Mac OS X 10.5.2). By the way, I install the
> normal version of R on my MacBook Pro (32-bits)
>
> I decided to use the following matrix manipulation because they are
> typical manipulation that I was planning to do repetitively and with
> much larger matrices for my PhD project.
>
> First matrix manipulation:
>
> coco<-matrix(rnorm(1000000),1000,1000)
> system.time(coco2<-eigen(coco))
>
> Results on the Mac:
> user     system      elapsed
> 7.301       0.974       7.376
>
> Results on Ubuntu:
> user     system      elapsed
> 20.573       0.088       20.766
>
> Second matrix manipulation:
>
> coco<-matrix(rnorm(1000000),1000,1000)
> system.time(coco3<-coco%*%coco)
>
> Results on the Mac:
> user     system      elapsed
> 0.360       0.024       0.224
>
> Results on Ubuntu:
> user     system      elapsed
> 2.756       0.000       2.758
>
> If I understand these results right, my MacBook Pro is far better than
> this Desk computer. I know Macs are good but that difference of
> performance is surprising me, did I do something wrong considering the
> large difference in processor?
>
> Thanks in advance
>
> Guillaume Blanchet
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list