From redmond at stat.wisc.edu  Mon Feb  4 23:34:00 2008
From: redmond at stat.wisc.edu (M Redmond)
Date: Mon, 4 Feb 2008 22:34:00 +0000 (UTC)
Subject: [Rd] Problem building R with Intel MKL v10 BLAS
References: <47993905.9000206@mit.edu>
Message-ID: <loom.20080204T222206-746@post.gmane.org>

Michael Braun <braunm <at> MIT.EDU> writes:

> 
> NO
> 
> Hi.  I'm not sure if this is an R-help or R-devel problem, so I'm 
> starting here in the hope that someone can help (and willing to go to 
> the other list if it's more appropriate).  I think I am following all of 
> the instructions in the various manuals, but clearly I am missing something.
> 
> I have an Intel EM64T Dell with 2 dual-core Xeon processors running Red 
> Hat EL5.  I would like to build R 2.6.1 with lots of debugging and 
> profiling options, and link it to the processor-specific Intel MKL blas. 
> The problem is that after I compile R, and do R CMD config BLAS_LIBS, 
> the response is
> -L/usr/local/lib64/R/lib -lRblas.
> 
> This tells me that R is not linked to the Intel BLAS at all.
> 
> My config.site file for R is:
> 
> #! /bin/sh
> 
> R_PAPERSIZE=letter
> CFLAGS="-g -O2 -p -pg"
> CPPFLAGS="-I/opt/intel/mkl/10.0.1.014/include -I/usr/include 
> -I/usr/local/include"
> LIBnn=lib64
> BLAS_LIBS="-L/opt/intel/mkl/10.0.1.014/lib/em64t -Wl,--start-group 
> -lmkl_gf_lp64.so -lmkl_gnu_thread.so -lmkl_core.so -l -l -l -Wl, 
> --end-group -lguide -lpthread -lm"
> 
> I have set the CONFIG_SITE environment variable to the location of the 
> config.site.file.
> I am doing everything as superuser.
> 
> The command I am using for configure is
> 
> ./configure --disable-R-profiling --with-blas=no
> 
> following the instructions in the R-admin file regarding enabling 
> C-level profiling and linking to the external BLAS libraries referenced 
> in the config.site file.
> 
> The BLAS_LIBS files are different than in the R-admin manual because of 
> changes in the Intel MKL for version 10.  These libraries, in this 
> order, were taken from the Intel MKL for Linux User's Guide, chapter 5.
> 
> So, still no luck linking to the optimized BLAS.  I'd appreciate any 
> suggestions.
> 
> Thanks,
> 
> Michael
> 
---
I now recall a similar problem with my install of MKL V10. Here is the info:

I got the 10.X, layered library version of MKL 10.X working on R-2.6.1a. I 
set the full path information for the R configuration blas and lapack
option:

--with-blas="-L/.../intel/mkl/10.0.011/lib/em64t -lRblas -lmkl_sequential
-lmkl_lapack -lmkl_core -lpthread"
--with-lapack="-L/.../intel/mkl/10.0.011/lib/em64t -lRlapack -lmkl_sequential
-lmkl_lapack -lmkl_core -lpthread"

In this case, libRblas.so and libRlapack.so are both linked to 
libmkl_gf_lp64.so in the em64t directory. There must be some internal error
in the R configuration and make processing, because it would not pick up the
primary path specification for the mkl libraries location. Instead, I was 
able to define:

*******critical step to get around a possible R bug*******
sh-3.00$ export LD_RUN_PATH=/.../intel/mkl/10.0.011/lib/em64t

After that, I was able to perform the R configure with no errors. Then the
make also worked with no errors. The BLAS_LIBS and LAPACK_LIBS variables
were properly defined, and the path to the MKL libraries was properly
defined in ldpaths:

sh-3.00$ /.../R-2.6.1a/bin/R CMD config BLAS_LIBS
-L/.../intel/mkl/10.0.011/lib/em64t -lRblas -lmkl_sequential -lmkl_lapack
-lmkl_core -lpthread
sh-3.00$ /.../R-2.6.1a/bin/R CMD config LAPACK_LIBS
-L/.../R-2.6.1a/intel/mkl/10.0.011/lib/em64t -lRlapack -lmkl_sequential
-lmkl_lapack -lmkl_core -lpthread
sh-3.00$

power02(43)% more ldpaths
...
${R_LD_LIBRARY_PATH=${R_HOME}/lib:/s/gcc-4.2.1/lib64:
/.../intel/mkl/10.0.011/lib/em64t:/usr/X11R6/lib64:
/.../tcl-8.4.2/i386_rh72/lib:/.../XFree86-4.2.1/i386_rh72/lib}

(... are the various local paths to the objects of interest)

Hope that helps (maybe more than my other post)
MJR



[Rd] Problem building R with Intel MKL v10 BLAS
M Redmond