From nakama at ki.rim.or.jp  Wed Jan 30 09:03:54 2008
From: nakama at ki.rim.or.jp (Ei-ji Nakama)
Date: Wed, 30 Jan 2008 17:03:54 +0900
Subject: [Rd] Problem building R with Intel MKL v10 BLAS
In-Reply-To: <47993905.9000206@mit.edu>
References: <47993905.9000206@mit.edu>
Message-ID: <dc41e1260801300003w58da8908k7b73e694f8fa76e1@mail.gmail.com>

Hi.

2008/1/25, Michael Braun <braunm at mit.edu>:
> 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 an AMD 64x2 Debian(etch)
$ gcc-4.2 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../gcc-4.2.2/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang
--prefix=/usr/local/gcc-4.2.2 --enable-shared --disable-multilib
--with-system-zlib --without-included-gettext --enable-threads=posix
--enable-nls --program-suffix=-4.2 --enable-__cxa_atexit
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr
--enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.2.2

MKL_LIB_PATH=/opt/intel/mkl/10.0.1.014/lib/em64t
MKL="   -L${MKL_LIB_PATH}                               \
        -Wl,--start-group                               \
                ${MKL_LIB_PATH}/libmkl_gf_lp64.a        \
                ${MKL_LIB_PATH}/libmkl_gnu_thread.a     \
                ${MKL_LIB_PATH}/libmkl_core.a           \
        -Wl,--end-group                                 \
        -liomp5 -lguide -lpthread -lgomp"

./configure CC=gcc-4.2\
        CXX=g++-4.2\
        F77=gfortran-4.2\
        FC=gfortran-4.2\
        --with-lapack="$MKL" --with-blas="$MKL"

mkl_core seemed to want to cause libiomp5. dgemm gave a funny result
in matrix of 1000x1000 if I did not link with real libiomp5.

-- 
EI-JI Nakama  <nakama at ki.rim.or.jp>
"\u4e2d\u9593\u6804\u6cbb"  <nakama at ki.rim.or.jp>



[Rd] Problem building R with Intel MKL v10 BLAS
Ei-ji Nakama