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

Michael Braun braunm at mit.edu
Wed Nov 2 01:23:40 CET 2011


Compiling R, and linking to Intel MKL, is quite simple, as long as you are using a recent version of MKL.  Intel has a MKL Link Advisor at


Choose the linking model you want, and then use the --with-blas option on configure.  For example, on my Mac, to link dynamically with the parallel version (which can be controlled with environment variables), I use the following:

'--with-blas=-L$(MKLROOT)/lib -lmkl_rt -lpthread -liomp5'

I compiled R 2.14.0 this morning with this option, and it seems to work fine.  I'm not sure what Dirk was referencing about how MKL is no longer compatible with R.  If there is an issue, it would be good to know about it.  Perhaps he can point us to the page in the documentation where this is mentioned.

I hope this helps.


On Nov 1, 2011, at 7:59 PM, <r-sig-hpc-request at r-project.org> <r-sig-hpc-request at r-project.org> wrote:
> Message: 1
> Date: Tue, 1 Nov 2011 14:36:50 -0700
> From: Jonathan Greenberg <jgrn at illinois.edu>
> To: r-sig-hpc at r-project.org
> Subject: [R-sig-hpc] Choosing Intel MKL BLAS when compiling R
> Message-ID:
>        <CABG0rfvnoswR+Hi7peaTAPczT_4j6FTV-H0rDLwqJOw05HrLuw at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 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
> Thanks!
> --j
> --
> Jonathan A. Greenberg, PhD
> Assistant Professor
> Department of Geography
> University of Illinois at Urbana-Champaign
> 607 South Mathews Avenue, MC 150
> Urbana, IL 61801
> Phone: 415-763-5476
> AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
> http://www.geog.illinois.edu/people/JonathanGreenberg.html

Michael Braun
Associate Professor of Management Science (Marketing Group)
MIT Sloan School of Management
100 Main St.., E62-535
Cambridge, MA 02139
braunm at mit.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-hpc/attachments/20111101/8120ed31/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1844 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-hpc/attachments/20111101/8120ed31/attachment.bin>

More information about the R-sig-hpc mailing list