[R-sig-Debian] Compiling R-2.11.0 with ATLAS-tuned BLAS and LAPACK

Dirk Eddelbuettel edd at debian.org
Wed Jun 2 05:56:47 CEST 2010


On 1 June 2010 at 22:27, Paul Johnson wrote:
| On Fri, May 28, 2010 at 1:35 PM, Avraham Adler <avraham.adler at gmail.com> wrote:
| > Thank you both very much for the advice. It is obviously significantly
| > more complicated than I first thought (although I /did/ manage to
| > compile both ATLAS and R under windows following the instructions, go
| > figure :). ) so I'll stop trying to bite off more than I can chew.
| >
| > Thank you again,
| >
| > --Avraham
| 
| This question reminded me I never understood BLAS linkage with R when
| I asked about it 2 months ago and I forgot to follow up.  I am looking
| at
| 
| http://127.0.0.1:11224/doc/manual/R-admin.html#Shared-BLAS
| 
| It seems (to my untrained eye) to say that default R is  built with a
| shared library based on a nonoptimized version of BLAS that is
| distributed with R itself.  It says the recommended R
| 
| If one has a different BLAS shared library on my system, one does not
| recompile. Rather move R's libRblas.so and then make a symlink from
| the new shared BLAS to where the old one was.

Ignore the 'move' part -- the manual is written for a generic Unix system
without apt-get et al.

Do the following, as per the old /usr/share/doc/r-base-core/README.Atlas.gz:

    > mm <- matrix(rnorm(10^6), ncol = 10^3)
    > system.time(crossprod(mm))
    [1] 2.38 0.04 2.84 0.00 0.00

(but these days use a bigger size than 10^6 and 10^3)

Then uninstall all your libatlas packages and make do with refblas3 and
liblapack3gf.  Rerun the matrix multiplation. Note the time.

Now install a libatlas* for you architecture, or just libatlas3gf-base and
re-run the same matrix multiplication. You will see a speed up.

And you didn't have to recompile R.  

All this brought to you by the wizardry of the former (Camm) and current
(Sylvestre) Atlas maintainers in Debian.  We owe them a drink. Or two.

| The doc has this example:
| 
| ln -s /opt/acml4.4.0/gfortran64_mp/lib/libacml_mp.so R_HOME/lib/libRblas.so
| 
| So I'd just have to figure out which shared library is the right one
| and put it where libRblas used to be.
| 
| Here's what I don't understand about the current R packaging.
| 
| In the deb packages,  I download from CRAN, there is no file
| libRblas.so, so I don't see how to make that new link to test  a

Who says you need libRblas.so?  We no longer do.

| different BLAS.
| 
| 
| Oh, and while I'm asking, in the source for the R package, I find a
| comment from Doug Bates (README.Debian) about stripping the R binary
| and possible adverse effect on --debugger. That comment is pretty old,
| perhaps it is before the day when there used to be a separate package
| of debugging symbols?
| 
| pj
| 
| -- 
| Paul E. Johnson
| Professor, Political Science
| 1541 Lilac Lane, Room 504
| University of Kansas
| 
| _______________________________________________
| R-SIG-Debian mailing list
| R-SIG-Debian at r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-debian

-- 
  Regards, Dirk



More information about the R-SIG-Debian mailing list