From nakama at ki.rim.or.jp  Tue Mar 17 04:12:15 2009
From: nakama at ki.rim.or.jp (Ei-ji Nakama)
Date: Tue, 17 Mar 2009 12:12:15 +0900
Subject: [Rd] [R] R with MKL
In-Reply-To: <fb1538e20903161533u599d8c00mef61f71bf2427a39@mail.gmail.com>
References: <fb1538e20903161533u599d8c00mef61f71bf2427a39@mail.gmail.com>
Message-ID: <dc41e1260903162012y2d3d2414o41fbe5082945b7ae@mail.gmail.com>

Hi

> I have seen a lot of problems from people trying to compile R with
> MKL. So I am writing my experience in case it helps and to ask one
> question. I installed R-2.8.1.patched in Ubuntu 9.04 (gcc 4.3.3) using
> MKL 10.1.1.019.

Do you use gcc and gfortran?

> I configured correctly (following MKL userguide) with :
>
> sudo ./configure --with-blas="-I/opt/intel/mkl/10.1.1.019/include
> -L/opt/intel/mkl/10.1.1.019/lib/em64t -lmkl_intel_lp64
> -lmkl_intel_thread -lmkl_core -liomp5 -lpthread"
> --with-lapack="-I/opt/intel/mkl/10.1.1.019/include
> -L/opt/intel/mkl/10.1.1.019/lib/em64t -lmkl_intel_lp64
> -lmkl_intel_thread -lmkl_core -liomp5 -lpthread"

cited reference https://svn.r-project.org/R/trunk/doc/manual/R-admin.texi
| You are strongly encouraged to read the MKL User's Guide
| <snip>
| @example
| 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 -lpthread"
| @end example

However, It is a little different.( -lgomp and configure line)

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                                 \
        -lgomp -lpthread"
./configure --with-blas="$MKL" --with-lapack="$MKL"

> But in order to compile had to edit src/modules/lapack/vecLibg95c.c
> and comment out the include. Weird, since I am not building for Mac.

Please note the thing that ABI of fortran is different with Intel compiler
and GNU compiler.
difficult to detect the mistake.
-- 
EI-JI Nakama  <nakama (a) ki.rim.or.jp>
"\u4e2d\u9593\u6804\u6cbb"  <nakama (a) ki.rim.or.jp>



[Rd] [R] R with MKL
Ei-ji Nakama