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

Simon Urbanek simon.urbanek at r-project.org
Wed Nov 2 02:09:02 CET 2011


On Nov 1, 2011, at 8:23 PM, Michael Braun wrote:

> Jonathan:
> 
> 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
> 
> http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/
> 
> 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.
> 

The issue is not relevant on OS X because OpenMP performance on OS X for vector parallelization is very bad, so it is typically disabled.

One comment to the earlier discussion - it's not always as simple as replacing the BLAS back-end due to ABI difference in the different implementations. You'll notice, for example, when complex BLAS calls start crashing (because R can work around such issues at configure time but not if you switch BLAS). On Debian I'm usually compiling ATLAS by hand which yields the best performance so I don't run into that problem.

Cheers,
Simon



> I hope this helps.
> 
> Michael
> 
> 
> 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
> 617-253-3436
> 
> 
> 
> 
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc



More information about the R-sig-hpc mailing list