[R-sig-hpc] Choosing Intel MKL BLAS when compiling R

Dirk Eddelbuettel edd at debian.org
Tue Nov 1 23:12:17 CET 2011

On 1 November 2011 at 14:36, Jonathan Greenberg wrote:
| r-sig-hpc'ers:
| I am compiling R 2.14 from scratch on a cluster computer (I can't use
| any package managers for the install, unfortunately), and they have
| the Intel MKL libraries available for BLAS/LAPACK.  I have not
| successfully gotten a configure/make/make install combo yet that uses
| multiple CPUs to do, say:
| a = matrix(rnorm(5000*5000), 5000, 5000)
| b = matrix(rnorm(5000*5000), 5000, 5000)
| # This following line, minimally, should be getting distributed.
| c = a%*%b
| First off, I've tried compiling it with the configure flags:
| ./configure --prefix=/myprefix/ --enable-BLAS-shlib
| How do I then select the Intel MKL libraries to be used as the BLAS?
| They are located in /usr/local/intel-11.1/mkl/lib/em64t

BLAS is an interface so you do not have to configure for a given BLAS. You
just build for the generic BLAS, and the drop better ones in.

This is demonstrated in a little package / vignette / paper I have at 


and you may want to hit the pdf directly at 


This uses the package manager on Debian/Ubuntu to drop the basic Blas, Atlas,
Goto and MKL in and out in a fully automatable (and hence scripted) manner so
that benchmarks can be run.   Besides the fact that is uses the dpkg package
manager --- and of course the fact that the respective package maintainer
have done the hard work of conforming to the Debian standard for pluggable
Blas --- nothing is really distro specific.  So you could use this as
'proof-of-concept' and try to make your cluster machines conform.  

In essence, this means trying to configure R to any external Blas and then
plugging the MKL in.

Some other details are in the 'R Installation and Administration' manual.

Good luck,  Dirk

"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx

More information about the R-sig-hpc mailing list