On Tue, Sep 29, 2015 at 8:11 PM, Nathan Kurz <nate at verse.com>
wrote:> Hi Arnaud --
>
> I'm glad it's working for you. I'm not sure I understand your
final
> answer. Are you saying that the version I posted worked for you as
> given, or that you had to remove some of the other options?
I say it works perfectly when using the single dynamic library
(lmkl_rt): MKL=" -L${_mkllibpath} -lmkl_rt -lpthread -lm"
N.B: not sure the -lm is needed, and It builds without it. It seems it
may trigger some issues on. See[0]. Thus I removed it
> Perhaps you could post the full final recipe in a way that others can
> copy and paste if they find this thread in the future?
Here it is. The script is writen for Parallel studio 2016. Change path
accordingly if composerxe 2015.
libRlib and libRblas are build as shared librairies. It build with
static libraries too.
More options can be added to configure.
Best is to source mklvars and compilervars in a script so it won't
polluated your shell environment once the build is done.
---------------------------------------------------------------
#! /bin/sh
source /opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/bin/mklvars.sh
intel64
source /opt/intel/bin/compilervars.sh intel64
_icclibpath=/opt/intel/compilers_and_lbraries_2016.0.109/linux/compiler/lib/intel64/
_mkllibpath=${MKLROOT}/lib/intel64/
_omp_lib=/opt/intel/lib/intel64/
MKL=" -L${_mkllibpath} -lmkl_rt -lpthread"
export CC="icc"
export CXX="icpc"
export AR="xiar"
export LD="xild"
export F77="ifort"
export CFLAGS="-g -O3 -xHost -I${MKLROOT}/include"
export CXXFLAGS="-g -O3 -xHost -I${MKLROOT}/include"
export FFLAGS="-I${MKLROOT}/include"
export FCFLAGS="-I${MKLROOT}/include"
# shared libs
./configure --with-blas="${MKL}" --enable-R-shlib --enable-BLAS-shlib
# static libs
./configure --with-blas="${MKL}" --with-lapack
make -j4
----------------------------------------------------------------------------------------------
from inside the build folder:
-------------------------
$ldd bin/exec/R
linux-vdso.so.1 (0x00007ffc1e853000)
libR.so => /usr/lib64/R/lib/libR.so (0x00007f747091f000)
libRblas.so => not found !! is not yet installed in the machine !!
libm.so.6 => /lib64/libm.so.6 (0x00007f7470616000)
libiomp5.so => /opt/intel/lib/intel64_lin/libiomp5.so (0x00007f74702d5000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f74700be000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f746fea1000)
libc.so.6 => /lib64/libc.so.6 (0x00007f746fae1000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f746f8dd000)
libblas.so.3 => not found !! we don't need it !!
libgfortran.so.3 => /lib64/libgfortran.so.3 (0x00007f746f5b1000)
libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007f746f372000)
libreadline.so.6 => /lib64/libreadline.so.6 (0x00007f746f127000)
libtre.so.5 => /lib64/libtre.so.5 (0x00007f746ef17000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f746eca7000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f746ea80000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f746e870000)
libz.so.1 => /lib64/libz.so.1 (0x00007f746e65a000)
librt.so.1 => /lib64/librt.so.1 (0x00007f746e451000)
libicuuc.so.54 => /lib64/libicuuc.so.54 (0x00007f746e0c0000)
libicui18n.so.54 => /lib64/libicui18n.so.54 (0x00007f746dc69000)
libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f746da46000)
/lib64/ld-linux-x86-64.so.2 (0x000055fcb8058000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f746d81c000)
libicudata.so.54 => /lib64/libicudata.so.54 (0x00007f746bdf0000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f746ba6e000)
$ ldd lib/libRblas.so
linux-vdso.so.1 (0x00007ffc5f3da000)
libmkl_rt.so => /opt/intel/mkl/lib/intel64_lin/libmkl_rt.so
(0x00007f232203e000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2321e21000)
libm.so.6 => /lib64/libm.so.6 (0x00007f2321b19000)
libimf.so => /opt/intel/lib/intel64_lin/libimf.so (0x00007f2321621000)
libsvml.so => /opt/intel/lib/intel64_lin/libsvml.so (0x00007f2320762000)
libirng.so => /opt/intel/lib/intel64_lin/libirng.so (0x00007f2320559000)
libiomp5.so => /opt/intel/lib/intel64_lin/libiomp5.so (0x00007f2320218000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2320001000)
libintlc.so.5 => /opt/intel/lib/intel64_lin/libintlc.so.5
(0x00007f231fda1000)
libc.so.6 => /lib64/libc.so.6 (0x00007f231f9e1000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f231f7dd000)
/lib64/ld-linux-x86-64.so.2 (0x000055ce12e09000)
--------------------------------------------------------------------------
>
> Also, did you determine if the the same approach worked for linking to
> MKL worked when using a non-Intel compiler? That is, can you
> substitute the gcc or clang tool names and get the same result?
No. I was not enable to do it with gcc. More tries are needed with
some variations.>
> --nate
>
> On Tue, Sep 29, 2015 at 9:07 AM, arnaud gaboury
> <arnaud.gaboury at gmail.com> wrote:
>> On Wed, Sep 9, 2015 at 11:26 PM, Nathan Kurz <nate at verse.com>
wrote:
>>>
>>> As a short and simple approach, I just compiled the current R
release
>>> on Ubuntu with ICC and MKL using just this:
>>>
>>> $ tar -xzf R-3.2.2.tar.gz
>>> $ cd R-3.2.2
>>> $ CC=icc CXX=icpc AR=xiar LD=xild CFLAGS="-g -O3 -xHost"
CXXFLAGS="-g
>>> -O3 -xHost" ./configure --with-blas="-lmkl_rt
-lpthread" --with-lapack
>>> --enable-memory-profiling --enable-R-shlib
>>> $ make
>>> $ sudo make install
>>> $ R --version
>>> R version 3.2.2 (2015-08-14) -- "Fire Safety"
>>
>>
>> That is exactly the right combo: with-blas="-lmkl_rt
-lpthread"
>> Nothing more for $MKL
>>
>> now
>> $ ldd bin/exec/R
>> linux-vdso.so.1 (0x00007ffe305f9000)
>> libmkl_rt.so => /opt/intel/mkl/lib/intel64_lin/libmkl_rt.so
(0x00007f216c9e3000)
>> .................................
[0]https://software.intel.com/en-us/search/site/language/en?query=-lm
--
google.com/+arnaudgabourygabx