[R] Compiling R with multi-threaded BLAS math libraries - why not actually ?

Dirk Eddelbuettel edd at debian.org
Sat Jun 12 05:16:52 CEST 2010

On 11 June 2010 at 23:01, Matt Shotwell wrote:
| In the case of REvolution R, David mentioned using the Intel MKL,
| proprietary library which may not be distributed in the way R is
| distributed. Maybe REvolution has a license to redistribute the library.
| For the others, I suspect Gabor has the right idea, that the R-core team
| would rather not keep architecture dependent code in the sources,
| although there is a very small amount already (`grep -R __asm__`).
| However, I know using Linux (Debian in particular) it is fairly
| straightforward to build R with `enhanced' BLAS libraries. The R
| Administration and Installation manual has a pretty good section on
| linking with enhanced BLAS and LAPACK libs, including the Intel MKL, if
| you are willing cough up $399, or swear not to use the library
| commercially or academically.

BLAS is actually an interface standard, so there is no _rebuilding of R_
required.  BLAS allows you to simply drop in a better BLAS library.  The 
"R Inst + Admin" manual has the details.

| Maybe a short tutorial using free software, such as ATLAS would be
| suitable content for an r-bloggers post :) ?

Given the drop-in nature, on suitable platforms all it takes is

   sudo apt-get install libatlas3gf-base

which gets you there most of the way using 'base' Atlas (ie not cpu
tuned). On my platform I also see


but this list will differ for different hardware platforms. Whenever I looked
at this I found the different between 'base' and 'more tuned' atlas libraries
to be rather small so I tend to just stick with base.

Also, Atlas on Debian/Ubuntu is still single-threaded (as opposed to the
MKL).  But one can drop in the Goto BLAS from U Texas which are 'free' but

Lastly, as David's article said and as knowledgeable people often repeat:
unless you do _lots_ of linear algebra this will not noticeably affect
overall R performance as a lot of time is spent in other areas too.

  Regards, Dirk

More information about the R-help mailing list