[Rd] [R] R with MKL

Ei-ji Nakama nakama at ki.rim.or.jp
Thu Mar 19 02:08:21 CET 2009


bug of MKL 11.0...

_gfortran_internal_malloc64 and _gfortran_internal_free is needed by [cz]labrad
in libmkl_gnu_thread.
There is it in libgfortran of gfortran-4.1 as an outside symbol, but
there is not it for
gfortran-4.2 or latter.
Many people pushed forward old gfortran, but there was not the problem
in gfortran-4.2
or latter.
if I did it as follows in my environment because the contents were
malloc and free either.

  # my copy for editing
  MKL_LIB_PATH=/usr/local/mkl
  ORIG_MKL_LIB_PATH=/opt/intel/Compiler/11.0/*/mkl/lib/em64t/
  mkdir $MKL_LIB_PATH
  cp $ORIG_MKL_LIB_PATH/{libmkl_gf_lp64,libmkl_core}.a $MKL_LIB_PATH
  cp $ORIG_MKL_LIB_PATH/libmkl_gnu_thread.a $MKL_LIB_PATH

  # add of _gfortran_internal_malloc64 and _gfortran_internal_free to
libmkl_gnu_thread.a
  wget http://prs.ism.ac.jp/~nakama/mkl/mkl_gf.c
  gcc -O3 -fPIC -g -c mkl_gf.c
  ar r $MKL_LIB_PATH/libmkl_gnu_thread.a mkl_gf.o

Because I may be recovered in the newer version, this work is unnecessary for
outside symbol if _gfortran_internal_free disappears.

 $ nm -A libmkl_gnu_thread.a |grep _gfortran_internal   # MKL11.0 now
libmkl_gnu_thread.a:zlabrd_omp.o:                 U _gfortran_internal_free
libmkl_gnu_thread.a:zlabrd_omp.o:                 U _gfortran_internal_malloc64
libmkl_gnu_thread.a:clabrd_omp.o:                 U _gfortran_internal_free
libmkl_gnu_thread.a:clabrd_omp.o:                 U _gfortran_internal_malloc64

Welcome to Hell of MKL.;-)

2009/3/18 Ei-ji Nakama <nakama at ki.rim.or.jp>:
> Hi Cristián.
>
>>> 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"
>>>
>> ...
>>
>> Thanks for all your answers. I read carefully the userguide and the
>> admin guide. I now understand that with gfortran I need to use
>> libmkl_gf_lp64 and libmkl_gnu_thread, either shared or static.
>> Unfortunately for MKL version 10.1.1.019, libmkl_gnu_thread links
>> against the symbol "_gfortran_internal_malloc64" which was present in
>> gcc-4.1 and is not present anymore in gcc-4.3.
>
> However, the support  of openmp is gcc-4.2 or latter.
>
>> So my alternatives are installing an older compiler, waiting for a
>> newer MKL version, building R with Intel compiler or switching away
>> from MKL.
>
> Please download the following files, and test the procedure to which
> the file is written first.
>
>      http://prs.ism.ac.jp/~nakama/mkl/mkl_gf.c
>

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



More information about the R-devel mailing list