From deleeuw@stat.ucla.edu  Thu Dec 26 20:36:22 2002
From: deleeuw@stat.ucla.edu (Jan de Leeuw)
Date: Thu Dec 26 20:36:22 2002
Subject: [Rd] timings of BLAS/Lapack combos
Message-ID: <25C91A8E-1909-11D7-8DB8-000393BB6D36@stat.ucla.edu>

OS X 10.2.3, dual 1.25Ghz Tower, gcc/g77 3.1. Three versions
of BLAS/LAPACK on the included benchmark. First using
the BLAS and LAPACK that come with R (--without-blas flag
in configure), then using the ATLAS from fink and the Lapack
from R (no flag), then using the BLAS and ATLAS from the
vecLib framework. The first two use R-1.6.2beta, the third uses
R-devel.

Conclusions are clear. Obviously there is no difference for
the sort task. Using ATLAS does not do anything for eigen()
but vecLib SEEMS to make eigen() about 5 times faster. This
is just because eigen() in R-devel actually defaults to La.eigen().

Using ATLAS or vecLib makes La.eigen about 2.5 times faster,
compared to included BLAS. vecLib and ATLAS are comparable,
with possibly vecLib a few percentage points faster. In double
precision there does not seem to be much impact of the
optimized LAPACK in vecLib (but more comparisons are
needed).

Code

sink("timings.lis")
hilbert<-function(n) 1/(outer(seq(n),seq(n),"+")-1)
print("hilbert n=500")
print(system.time(eigen(hilbert(500))))
print(system.time(eigen(hilbert(500))))
print(system.time(eigen(hilbert(500))))
print("hilbert n=1000")
print(system.time(eigen(hilbert(1000))))
print(system.time(eigen(hilbert(1000))))
print(system.time(eigen(hilbert(1000))))
print("La.hilbert n=500")
print(system.time(La.eigen(hilbert(500))))
print(system.time(La.eigen(hilbert(500))))
print(system.time(La.eigen(hilbert(500))))
print("La.hilbert n=1000")
print(system.time(La.eigen(hilbert(1000))))
print(system.time(La.eigen(hilbert(1000))))
print(system.time(La.eigen(hilbert(1000))))
print("sort n=6")
print(system.time(sort(rnorm(10^6))))
print(system.time(sort(rnorm(10^6))))
print(system.time(sort(rnorm(10^6))))
print("sort n=7")
print(system.time(sort(rnorm(10^7))))
print(system.time(sort(rnorm(10^7))))
print(system.time(sort(rnorm(10^7))))

--without-blas

[1] "hilbert n=500"
[1] 4.75 0.00 4.84 0.00 0.00
[1] 4.01 0.00 3.99 0.00 0.00
[1] 4.09 0.00 4.06 0.00 0.00
[1] "hilbert n=1000"
[1] 44.19  0.00 44.24  0.00  0.00
[1] 42.03  0.00 42.15  0.00  0.00
[1] 41.80  0.00 43.41  0.00  0.00
[1] "La.hilbert n=500"
[1] 1.98 0.00 2.08 0.00 0.00
[1] 2.00 0.00 2.05 0.00 0.00
[1] 1.96 0.00 2.00 0.00 0.00
[1] "La.hilbert n=1000"
[1] 19.02  0.00 19.58  0.00  0.00
[1] 19.08  0.00 19.89  0.00  0.00
[1] 19.24  0.00 19.30  0.00  0.00
[1] "sort n=6"
[1] 2.04 0.00 2.04 0.00 0.00
[1] 1.92 0.00 1.95 0.00 0.00
[1] 1.88 0.00 2.04 0.00 0.00
[1] "sort n=7"
[1] 24.23  0.00 24.62  0.00  0.00
[1] 24.23  0.00 24.21  0.00  0.00
[1] 24.60  0.00 24.59  0.00  0.00

Using ATLAS

[1] "hilbert n=500"
[1] 4.52 0.00 4.54 0.00 0.00
[1] 4.24 0.00 4.25 0.00 0.00
[1] 4.28 0.00 4.37 0.00 0.00
[1] "hilbert n=1000"
[1] 44.24  0.00 45.32  0.00  0.00
[1] 44.28  0.00 46.84  0.00  0.00
[1] 45.58  0.00 46.69  0.00  0.00
[1] "La.hilbert n=500"
[1] 0.90 0.00 1.44 0.00 0.00
[1] 1.17 0.00 1.31 0.00 0.00
[1] 1.16 0.00 1.15 0.00 0.00
[1] "La.hilbert n=1000"
[1] 8.36 0.00 8.37 0.00 0.00
[1] 8.09 0.00 8.13 0.00 0.00
[1] 8.37 0.00 8.45 0.00 0.00
[1] "sort n=6"
[1] 1.91 0.00 2.46 0.00 0.00
[1] 2.04 0.00 2.12 0.00 0.00
[1] 2.16 0.00 2.08 0.00 0.00
[1] "sort n=7"
[1] 25.30  0.00 27.18  0.00  0.00
[1] 24.81  0.00 24.71  0.00  0.00
[1] 24.36  0.00 24.51  0.00  0.00

using vecLib

[1] "hilbert n=500"
[1] 1.71 0.00 1.68 0.00 0.00
[1] 1.41 0.00 1.31 0.00 0.00
[1] 1.25 0.00 1.16 0.00 0.00
[1] "hilbert n=1000"
[1] 8.59 0.00 7.86 0.00 0.00
[1] 7.68 0.00 7.21 0.00 0.00
[1] 7.85 0.00 7.18 0.00 0.00
[1] "La.hilbert n=500"
[1] 1.15 0.00 1.02 0.00 0.00
[1] 1.16 0.00 1.02 0.00 0.00
[1] 1.21 0.00 1.09 0.00 0.00
[1] "La.hilbert n=1000"
[1] 7.75 0.00 6.77 0.00 0.00
[1] 7.98 0.00 6.86 0.00 0.00
[1] 7.85 0.00 6.77 0.00 0.00
[1] "sort n=6"
[1] 2.06 0.00 2.10 0.00 0.00
[1] 2.08 0.00 2.06 0.00 0.00
[1] 2.04 0.00 2.05 0.00 0.00
[1] "sort n=7"
[1] 24.8  0.0 25.2  0.0  0.0
[1] 24.74  0.00 24.95  0.00  0.00
[1] 24.72  0.00 24.88  0.00  0.00

===
Jan de Leeuw; Professor and Chair, UCLA Department of Statistics;
Editor: Journal of Multivariate Analysis, Journal of Statistical  
Software
US mail: 9432 Boelter Hall, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550;  fax (310)-206-5658;  email: deleeuw@stat.ucla.edu
homepage: http://gifi.stat.ucla.edu
   
------------------------------------------------------------------------ 
-------------------------
           No matter where you go, there you are. --- Buckaroo Banzai
                    http://gifi.stat.ucla.edu/sounds/nomatter.au
   
------------------------------------------------------------------------ 
-------------------------



[Rd] timings of BLAS/Lapack combos
Jan de Leeuw