- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello there,
An attempt to dynamically link R to threaded MKL on a Linux workstation leads to a 'double complex BLAS...' error:
>/usr/lib/R$ export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64
>/usr/lib/R$ sudo /home/XXXX/Documents/R-2.15.1/configure --enable-R-shlib --enable-threads=posix --with-lapack --with-blas="-I/opt/intel/mkl/include -L/opt/intel/mkl/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -fopenmp -lpthread"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
the following error message seems to be not infrequently cited by R users attempting to link against MKL on R forums:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
checking for cblas_cdotu_sub in vecLib framework... no
checking for dgemm_ in -I/opt/intel/mkl/include -L/opt/intel/mkl/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -fopenmp -lpthread -lm... yes
checking whether double complex BLAS can be used... no
checking iconv.h usability... yes
checking iconv.h presence... yes
>>>>>>>>> some additional diagnostic messages .... <<<<<<<<<<<<<<
R is now configured for x86_64-unknown-linux-gnu
Source directory: /home/XXXX/Documents/R-2.15.1
Installation directory: /usr/local
C compiler: gcc -std=gnu99 -g -O2
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11
External libraries: readline
Additional capabilities: PNG, JPEG, NLS
Options enabled: shared R library, shared BLAS, R profiling, Java
Recommended packages: yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#################################
Alternatively, using syntax suggested in R installation manual (which cites Intel engineer):
>/usr/lib/R$ export MKL_LIB_PATH=/opt/intel/mkl/lib/intel64
>/usr/lib/R$ MKL="-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_lapack -lmkl_core -fopenmp -lpthread"
>/usr/lib/R$ sudo /home/XXXX/Documents/R-2.15.1/configure --enable-R-shlib --enable-threads=posix --with-blas="$MKL"
~~~~~~~~~~~~~~~
checking whether ctanh exists and is declared... yes
checking for cblas_cdotu_sub in vecLib framework... no
checking for dgemm_ in -L/opt/intel/mkl/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_lapack -lmkl_core -fopenmp -lpthread... no
checking for dgemm_... no
checking for ATL_xerbla in -latlas... no
checking for dgemm_ in -lblas... yes
checking for dgemm_ in -ldgemm... no
checking for dgemm_ in -lblas... (cached) yes
checking for dgemm_ in -lessl... no
checking for dgemm_ in -lblas... (cached) yes
checking whether double complex BLAS can be used... yes
checking whether the BLAS is complete... yes
>>>>>>>>> some additional diagnostic messages .... <<<<<<<<<<<<<<
R is now configured for x86_64-unknown-linux-gnu
Source directory: /home/XXXX/Documents/R-2.15.1
Installation directory: /usr/local
C compiler: gcc -std=gnu99 -g -O2
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11
External libraries: readline, BLAS(generic)
Additional capabilities: PNG, JPEG, NLS
Options enabled: shared R library, R profiling, Java
Recommended packages: yes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thank you,
Constantine
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having a similar issue.
When I compile R with intel compilers, everything works great.
================================
R is now configured for x86_64-unknown-linux-gnu
Source directory: .
Installation directory: /usr/local
C compiler: icc -std=c99 -g -O3 -wd188 -ip
Fortran 77 compiler: ifort -g -O3
C++ compiler: icpc -g -O3
Fortran 90/95 compiler: ifort -g -O3
Obj-C compiler:
Interfaces supported: X11
External libraries: readline, BLAS(generic), LAPACK(in blas)
Additional capabilities: PNG, JPEG, NLS
Options enabled: shared R library, R profiling
================================
When I configure, I use the following options in "config.site"
================================
CC='icc -std=c99'
CFLAGS='-g -O3 -wd188 -ip '
F77='ifort'
FFLAGS='-g -O3 '
CXX='icpc'
CXXFLAGS='-g -O3 '
FC='ifort'
FCFLAGS='-g -O3 '
MKL_LIB_PATH=/opt/intel/mkl/lib/intel64
MKL=" -L${MKL_LIB_PATH} \
-Wl,--start-group \
-lmkl_intel_lp64 \
-lmkl_intel_thread \
-lmkl_core \
-Wl,--end-group \
-liomp5 -lpthread"
BLAS_LIBS="$MKL"
================================
However, if I try to use gcc as the compiler, I run into problems. Following is the "config.site"
================================
CFLAGS='-g -O2 '
FFLAGS='-g -O2 '
CXXFLAGS='-g -O2 '
FCFLAGS='-g -O2 '
MKL_LIB_PATH=/opt/intel/mkl/lib/intel64
MKL=" -L${MKL_LIB_PATH} \
-Wl,--start-group \
-lmkl_gf_ilp64 \
-lmkl_intel_thread \
-lmkl_core \
-Wl,--end-group \
-liomp5 -lpthread"
BLAS_LIBS="$MKL"
================================
The output indicate that dgemm_ in mkl_gf_lp64.so is not found:
~/Downloads/R-3.0.0$ nm -D /opt/intel/mkl/lib/intel64/libmkl_gf_lp64.so | grep dgemm_
00000000003309f0 T dgemm_
This is also reflected in the summary of the configure command:
================================
R is now configured for x86_64-unknown-linux-gnu
Source directory: .
Installation directory: /usr/local
C compiler: gcc -std=gnu99 -g -O2
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11
External libraries: readline, BLAS(generic), LAPACK(generic)
Additional capabilities: PNG, JPEG, NLS
Options enabled: shared R library, R profiling
Recommended packages: yes
================================
Any help would be appreciated
================================ truncated
checking for cblas_cdotu_sub in vecLib framework... no
checking for dgemm_ in -l -L -Wl,--start-group -lmkl_gf_ilp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp\
5 -lpthread... no
checking for dgemm_... no
checking for ATL_xerbla in -latlas... no
checking for dgemm_ in -lblas... yes
checking for dgemm_ in -ldgemm... no
checking for dgemm_ in -lblas... (cached) yes
checking for dgemm_ in -lessl... no
checking for dgemm_ in -lblas... (cached) yes
checking whether double complex BLAS can be used... yes
checking whether the BLAS is complete... yes
checking for dpstrf_... no
checking for dpstrf_ in -llapack... yes
================================ truncated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sang O. wrote:
However, if I try to use gcc as the compiler, I run into problems.
If you use gcc then you need "-lmkl_gnu_thread", instead of "-lmkl_intel_thread". Please check and let us know if this solves your problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suppose mkl_gnu_thread uses libgomp, while mkl_intel_thread uses libiomp5. libiomp5 has support for all gcc/gfortran linux OpenMP syntax. libgomp would not work with mkl_intel_thread, nor would the application work if both libgomp and libiomp5 are linked in. ldd would be a good check to assure that you don't have both OpenMP .so linked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I did some check recently about mkl and R article recently,
http://software.intel.com/en-us/articles/build-r-301-with-intel-c-compiler-and-intel-mkl-on-linux
http://software.intel.com/en-us/articles/using-intel-mkl-with-r
I run into bunch of building problem (include sangs). most of them was tracked to environment finally.
So I'd like add notes here again as Zhang mentioned,
properly (carefully) set MKL related env-variables (MKLROOT,LIBRARY_PATH and LD_LIBRARY_PATH, etc.).
Or please use mkl varsetting bash for safe
source /opt/intel/mkl/bin/mklvars.sh intel64.
@ Constantine, i try your command line exactly with lastest MKL composer_xe_2013.4.183 and R version R-3.0.1. They works fine and double complex blas works too. you may try again.
Other thing,You mentioned using syntax suggested in R installation manual (which cites Intel engineer):and get
checking for dgemm_ in -L/opt/intel/mkl/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_lapack -lmkl_core -fopenmp -lpthread... no
Actually, the MKL library isn't work here. Please check config.log to see the exact error message for this.
@Sang
When you try to use GCC and you call mkl_ilp64 interface,
MKL=" -L${MKL_LIB_PATH} \
-Wl,--start-group \
-lmkl_gf_ilp64 \
-lmkl_intel_thread \
-lmkl_core \
-Wl,--end-group \
-liomp5 -lpthread"
But you check the library of mkl_lp64. nm -D /opt/intel/mkl/lib/intel64/libmkl_gf_lp64.so | grep dgemm_
Despite this, it should be ok to use ILP64 interface, but take care of the integer type.
The ILP64 interface provides for the following:
•Support large data arrays (with more than 231-1 elements)
•Enable compiling your Fortran code with the -i8 compiler option .
Please check if you have libmkl_gf_ilp64.so under the opt/intel/mkl/lib/intel64.
( I prefer to use the exact path like opt/intel/composer_xe_2013.4.183/mkl/lib/intel64 , instead the quick link)
Second, regarding the gcc build fails, you have
checking for dgemm_ in -l -L -Wl,--start-group -lmkl_gf_ilp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -liomp\
5 -lpthread... no
as you see -L is blank, MKL_LIB_PATH is even not there. So please check.
Third, you may run into next problem : can't found -liomp5. (please open config.log to check)
when using icc, you may set right environment for icc, thus the default path /opt/intel/composer_xe_2013.4.183/compiler/lib/intel64/ of libiomp5.so is ready.
but when using gcc, the path is not there.
So you may try
for example,
MKL_LIB_PATH=/opt/intel/composer_xe_2013.4.183/mkl/lib/intel64
OMP_LIB_PATH=/opt/intel/composer_xe_2013.4.183/compiler/lib/intel64/
export LD_LIBRARY_PATH=${MKL_LIB_PATH}:${OMP_LIB_PATH}
MKL=" -L${MKL_LIB_PATH} -L${OMP_LIB_PATH} \
-Wl,--start-group \
-lmkl_gf_lp64 \
-lmkl_intel_thread \
-lmkl_core \
-Wl,--end-group \
-liomp5 -lpthread"
./configure --with-blas="$MKL" --with-lapack ( I prefer to the exact path, instead the quick link).
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link another topic, where checking whether double complex BLAS can be used... no is resolved by linking libmkl_intel_lp64.so.
http://software.intel.com/en-us/forums/topic/397399
Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am not able to compile the MKL into R. I am using gcc 4.6.3 and fgortran 4.6.3 compilers with MKL 11.1.0.080.
I use the following to configure as advised above for gnu though do not use shared libraries:
source /opt/intel/mkl/bin/mklvars.sh intel64
./configure --enable-threads=posix --with-lapack --with-blas="-fopenmp -m64 -I$MKLROOT/include -L$MKLROOT/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lm" --with-x=no
R is now configured for x86_64-unknown-linux-gnu
Source directory: .
Installation directory: /usr/local
C compiler: gcc -std=gnu99 -g -O2
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported:
External libraries: readline
Additional capabilities: NLS
Options enabled: shared BLAS, R profiling
Recommended packages: yes
After make, make install I run a benchmark.
The benchmark test described in http://software.intel.com/en-us/articles/using-intel-mkl-with-r shows it is only running with 1 core. top shows the same
root@Ubuntu-1204-precise-64-minimal ~ # time R CMD BATCH R-benchmark-25.R --no-save
real 2m9.587s
user 2m8.124s
sys 0m1.052s
Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would be concerned that you have linked against the default linux lapack for gfortran and that it may not use the MKL functions. The MKL libraries you need have support for both lapack and blas. The intel reference you cited states specifically that it won't work in the order you give.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Michael S.
Have you checked whether the MKL_NUM_THREADS or OMP_SET_NUM_THREADS or MKL_DYNAMIC env variables are set correctly?
--Vipin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, OMP_NUM_THREADS env. variable.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page