Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Error compiling R with MKL - C compiler cannot create executables

Sen_Gupta__Indrajit
1,665 Views

Hi,

I am trying to compile R from source using MKL. I am doing this in an AWS EC2 instance and am following the instructions given as per this page:

https://software.intel.com/en-us/articles/build-r-301-with-intel-c-compiler-and-intel-mkl-on-linux

However, when I try to run the "make" command, I get the following:

checking for gcc...  icc
checking whether the C compiler works... no
configure: error: in `/home/ec2-user/R-3.4.3':
configure: error: C compiler cannot create executables
See `config.log' for more details

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

Please help.

Regards,

 

0 Kudos
8 Replies
Ying_H_Intel
Employee
1,665 Views

Hi

We update that article recently.  Do you installed intel composer XE , which include both Intel C/Compiler (icc)   and Intel MKL?  Could you attach your config.log file so we can see what is exact problem?

Best Regards,

Ying

0 Kudos
Sen_Gupta__Indrajit
1,665 Views

Hi Ying,

I have not used Intel Composer XE. I used just the Intel Math Kernel Library from this link:

https://software.intel.com/en-us/mkl

Regards,

 

0 Kudos
mecej4
Honored Contributor III
1,665 Views

Make sure that you can compile, link and run standard C programs on the AWS system before attempting to use the MKL libraries. That is, does the "provisioning" include a C compiler package?

0 Kudos
Ying_H_Intel
Employee
1,665 Views

 

Hi Sen Gupta,

Get it.  Then what c and fortran compiler are you using?  If no intel compiler (icc and ifort), then i may suppose you are use GNU gcc and gfortran,  please refer to the article for build R :

https://software.intel.com/en-us/articles/using-intel-mkl-with-r

and you may check your config.log file for attach it so we can see the.

Best Regards,
​Ying

0 Kudos
Sen_Gupta__Indrajit
1,665 Views

Hi,

I got the trial version of Parallel Studio XE 2018 Update 1. Was able to compile R from source. Now when I am running some generalized linear models and timing them, I don't see improvement. The reduction in time is only by 0.4 seconds. This is how I kickstarted the process:

source /opt/intel/bin/compilervars.sh intel64
export MKL_INTERFACE_LAYER=GNU,LP64
export MKL_THREADING_LAYER=SEQUENTIAL
nohup ~/R-3.4.3/bin/R CMD BATCH filename.R &

I had to use MKL_THREADING_LAYER=SEQUENTIAL instead of INTEL since my code has Genetic Algorithms running in a parallel mode, and causes a conflict.

Before I had run my program, I had done linking the BLAS and LAPACK libraries in this manner:

cd R-3.4.3/lib
mv libRblas.so libRblas.so.keep
ln -s /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_rt.so libRblas.so

mv libRlapack.so libRlapack.so.keep
ln -s /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64/libmkl_rt.so libRlapack.so

Just to check if the MKL was properly used, I did benchmarking as described in this page: https://software.intel.com/en-us/articles/quick-linking-intel-mkl-blas-lapack-to-r. The total time taken for all the 15 tests were around 5.6 seconds. 

Looking forward to any suggestions on what I can do to see any improvement in the GLM.

Regards,
Indrajit

0 Kudos
Ying_H_Intel
Employee
1,665 Views

Hi Indrajit

Nice to know you make the R worked.  You mentioned The total time taken for all the 15 tests were around 5.6 seconds,  how about with MKL  and without MKL?

Not sure how much your GLM depend on MKL functions in R. Could you please submit your question and sample code to  Intel Online Service:   https://supporttickets.intel.com/ so we may investigate in details. 

Best Regards,

Ying 

0 Kudos
Couceiro__Miguel
Beginner
1,665 Views

Hi.

I am also trying to compile R (3.4.3) with Intel (Composer XE 2016) and MKL (11.3), by following the procedure described in "Build R-3.4.2 with Intel® C++ and Fortran Compilers and Intel® MKL on Linux",  but without success. During the configure stage I get

checking whether mixed C/Fortran code can be run... configure: WARNING: cannot run mixed C/Fortran code
configure: error: Maybe check LDFLAGS for paths to Fortran libraries?

This happens even if do not try to use MKL, and let all the R configure options in their default values:

../R-3.4.3/configure --prefix=/usr/global/Scientific/R/3.4.3-with_Intel_2016.3.210

I am using the Intel Composer XE 2016 along with GCC 4.8.5, which was installed from source code. I have tried to set the LDFLAGS variable to point to the path containing the libgfortran.so.3 library (although it is in the LD_LIBRARY_PATH and in the LIBRARY_PATH), but without success. However, if I compile R with GCC 4.8.5, I get no errors.

Can someone please help me with this? I have attached the files with the config.log and the output of the configure stage.

 

Best regards,

Miguel

0 Kudos
Mitsuha
Beginner
1,562 Views

Hi Miguel,

  I encountered the same issue before, and I found a way to get around, you can also check this out:

First, you need to install intel-mkl library from the package manager, here we use Intel APT source because our operating system is Ubuntu, you can check it out here

Then, remember to source the environment variable shell, like this

 

source /opt/intel/mkl/bin/mklvars.sh intel64

 

From Arch Linux User Repository

 

export _intel_arch=intel64
export _intel_lib=mkl_intel_lp64
export MKL="-L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_rt -lpthread -lm -ldl"
export _intel_cc_opt="-O3 -fPIC -m64 -march=native -fp-model precise -fp-model source -I${MKLROOT}/include"
export LDFLAGS="-qopenmp"
export CFLAGS="${_intel_cc_opt}"
export CXXFLAGS="${_intel_cc_opt}"
export FFLAGS="${_intel_cc_opt}"
export FCFLAGS="${_intel_cc_opt}"
export CC="icc"
export CXX="icpc"
export F77="ifort"
export FC="ifort"
export AR="xiar"
export LD="xild"
export LD_LIBRARY_PATH={intel parallel studio install folder}/compilers_and_libraries_.{version}/linux/compiler/lib/intel64_lin/
source {intel parallel studio install folder}/bin/compilervars.sh ${_intel_arch}

 

Best regards,

Miyamizu

0 Kudos
Reply