Compile R with ATLAS

June 17, 2010 by · Leave a Comment
Filed under: Notes 

First, install yum-utils so you can run yum-builddeps:

yum install yum-utils

Then build all R dependencies with:
yum-builddep R

Add EPEL to your code repositories list, yum install atlas and wget the latest R code
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install atlas-devel.x86_64
wget http://cran.r-project.org/src/base/R-2/R-2.11.1.tar.gz

Gunzip and tar into /usr/local/lib64, then compile R from inside R-version/

./configure --with-blas="-L/usr/lib64/atlas -lptf77blas -lpthread -latlas" --enable-R-shlib --enable-BLAS-shlib
make
make check
make install

And test:
set.seed(10)
x <- matrix(runif(1000000), 1000,1000)
y <- matrix(runif(1000000), 1000,1000)
system.time(z <- x %*% y)
#base
# user system elapsed
# 4.036 0.008 4.039
#atlas
# user system elapsed
# 0.428 0.020 0.457
set.seed(10)
x <- matrix(runif(10000000), 1000,10000)
y <- matrix(runif(10000000), 10000,1000)
system.time(z <- x %*% y)
#base
# user system elapsed
# 39.302 0.016 39.309
#atlas
# user system elapsed
# 2.840 0.028 2.873