Community
cancel
Showing results for 
Search instead for 
Did you mean: 
arnaud_g_1
Beginner
47 Views

Build R from source with Inetl MKL and ICC

 

OS: Fedora 22
parallel_studio_xe_2016
Hardware : 8 Thread(s) per core: 2 Vendor ID: GenuineIntel Model name:
Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz - Sandybridge
R-3.2.2

Here is my build configuration:

-------------------------------------------------------

source /opt/intel/compilers_and_libraries_2016/linux/mkl/bin/mklvars.sh intel64
source /opt/intel/bin/compilervars.sh intel64
_mkllibpath=$MKLROOT/lib/intel64
_openmplibpath=${PROD_DIR}/compiler/lib/intel64
export LD_LIBRARY_PATH=${_mkllibpath}:${_openmplibpath}
export MKL="-L${_mkllibpath} -L${_openmplibpath} -lmkl_intel_lp64 -lkml_intel_thread -lkml_core -liomp5 -lpthread"
export CC="icc"
export F77="ifort"
export CXX="icpc"
export AR="xiar"
export LD="xild"
export CFLAGS="-O3 -ipo -openmp -parallel -xAVX"
export CXXFLAGS="-O3 -ipo -openmp -parallel -xAVX"
export FFLAGS="-O3 -ipo -openmp -parallel -xAVX"
export MAIN_LDFLAGS='-openmp'
./configure --with-lapack --with-blas="$MKL" --enable-R-shlib
--enable-memory-profiling --enable-openmp --enable-BLAS-shlib
--enable-lto F77=${F77} FC=${F77}


------------------------------------------------------------

After I run ./configure, it seems from config.log everything is fine:

checking for dgemm_ in
result: yes

checking whether double complex BLAS can be used
result: yes

checking whether the BLAS is complete
result: yes

The only error I can see is ld complaining about not finding -lRblas
----------------------------------------------------------------------------

Then run

$ make

with no errors.
Now, with no make install, I get this:

--------------------------------------------------------------------

$ ldd bin/exec/R
linux-vdso.so.1 (0x00007ffe073f3000)
libR.so => /usr/lib64/R/lib/libR.so (0x00007f43939e6000)
libRblas.so => not found
libm.so.6 => /lib64/libm.so.6 (0x00007f43936de000)
libiomp5.so => /opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64/libiomp5.so
(0x00007f439339c000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f4393185000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4392f69000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4392ba8000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f43929a4000)
libblas.so.3 => /lib64/libblas.so.3 (0x00007f439274b000)
libgfortran.so.3 => /lib64/libgfortran.so.3 (0x00007f439241f000)
libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007f43921e0000)
libreadline.so.6 => /lib64/libreadline.so.6 (0x00007f4391f96000)
libtre.so.5 => /lib64/libtre.so.5 (0x00007f4391d85000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f4391b15000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f43918ef000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f43916de000)
libz.so.1 => /lib64/libz.so.1 (0x00007f43914c8000)
librt.so.1 => /lib64/librt.so.1 (0x00007f43912c0000)
libicuuc.so.54 => /lib64/libicuuc.so.54 (0x00007f4390f2e000)
libicui18n.so.54 => /lib64/libicui18n.so.54 (0x00007f4390ad7000)
libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f43908b5000)
/lib64/ld-linux-x86-64.so.2 (0x00005557e2243000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f439068a000)
libicudata.so.54 => /lib64/libicudata.so.54 (0x00007f438ec5f000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f438e8dc000)


-----------------------------------------------------------------------------------------------


Now a few questions:

1- am I not supposed to see something like this in the ldd command return?
 

ibmkl_intel_lp64.so =>
libmkl_intel_thread.so =>
libmkl_core.so => 

Or do I need to run $make install before ldd?

2- when visiting https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor here is what I get as
linking and compiler options:
 

Linking options:

-L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_core
-lmkl_intel_thread -lpthread -lm


Compiler options:

 -DMKL_ILP64 -qopenmp -I${MKLROOT}/include

What is the difference between -openmp and -qopenmp? Shall I use
indeed the above compiler and linking  options indeed?

Thank you for help in this difficult topic for me.

0 Kudos
3 Replies
TimP
Black Belt
47 Views

-qopenmp is a spelling change introduced in intel 15.0 compilers .  If you fail to match the spelling to your compiler version, your build is likely not to produce intended results. The error message, if any, may not be clear.

Your list of ldd dependencies indicates that gfortran is in use.  Possibly, if your flags spellings aren't right for your intel compilers, your build scripting could fall back to gnu compilers. There should be a configure log bearing on this. 

arnaud_g_1
Beginner
47 Views

I understand very well I have to use -qopenmp. I already did a built with this option. 

Now you don't answer one of my question: why don't I have libmkl_intel_lp64.so, libmkl_intel_thread.so and
libmkl_core.so  when running ldd ?

Thank you.
 

 

Ying_H_Intel
Employee
47 Views

Hi Amaud,

You may try   ldd ./R-3.2.2/lib/libR.so to see the MKL library.

Best Regards,

Ying