Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

fail to find MKL #17791

Closed
hubutui opened this issue Mar 9, 2020 · 17 comments · May be fixed by #17794
Closed

fail to find MKL #17791

hubutui opened this issue Mar 9, 2020 · 17 comments · May be fixed by #17794

Comments

@hubutui
Copy link

hubutui commented Mar 9, 2020

Description

could not find MKL from #17751

Error Message

-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_CROSSCOMPILING FALSE
-- CMAKE_HOST_SYSTEM_PROCESSOR x86_64
-- CMAKE_SYSTEM_PROCESSOR x86_64
-- CMAKE_SYSTEM_NAME Linux
-- CMake version '3.16.5' using generator 'Unix Makefiles'
-- Could not find CCache. Consider installing CCache to speed up compilation.
-- Performing Test SUPPORT_CXX11
-- Performing Test SUPPORT_CXX11 - Success
-- Performing Test SUPPORT_CXX0X
-- Performing Test SUPPORT_CXX0X - Success
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- MKL-DNN compat: set DNNL_BUILD_EXAMPLES to MKLDNN_BUILD_EXAMPLES with value `OFF`
-- MKL-DNN compat: set DNNL_BUILD_TESTS to MKLDNN_BUILD_TESTS with value `OFF`
-- MKL-DNN compat: set DNNL_ENABLE_JIT_PROFILING to MKLDNN_ENABLE_JIT_PROFILING with value `OFF`
-- MKL-DNN compat: set DNNL_LIBRARY_TYPE to MKLDNN_LIBRARY_TYPE with value `STATIC`
-- MKL-DNN compat: set DNNL_ARCH_OPT_FLAGS to MKLDNN_ARCH_OPT_FLAGS with value ``
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- GPU support is disabled
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.17") found components: doxygen dot 
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- Intel(R) VTune(TM) Amplifier JIT profiling disabled
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find MKL (missing: MKL_INTEL_LP64_LIBRARY
  MKL_INTEL_THREAD_LIBRARY MKL_CORE_LIBRARY IOMP_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/FindMKL.cmake:156 (find_package_handle_standard_args)
  cmake/ChooseBlas.cmake:49 (find_package)
  CMakeLists.txt:310 (include)


-- Configuring incomplete, errors occurred!
See also "/home/USER/Projects/archlinuxcn-repo/archlinuxcn/mxnet-git/src-mk/build/CMakeFiles/CMakeOutput.log".
See also "/home/USER/Projects/archlinuxcn-repo/archlinuxcn/mxnet-git/src-mk/build/CMakeFiles/CMakeError.log".

To Reproduce

git clone https://github.com/apache/incubator-mxnet.git
git checkout 636897718f8468be0dd5c4077258eb14c7416717 -b pkg
git submodule update --init --recursive
cd incubator-mxnet
mkdir build
cd build
cmake .. -DUSE_CUDA=0 -DUSE_MKLDNN=1 -DUSE_MKL_IF_AVAILABLE=1 -DUSE_BLAS=MKL

What have you tried to solve it?

  1. I try commit 5cffa74 with no errors.

Environment

I'm using ArchLinux with gcc 9, intel-mkl. intel-mkl is installed to /opt/intel.

@hubutui hubutui added the Bug label Mar 9, 2020
@pengzhao-intel
Copy link
Contributor

@wuxun-zhang could you take a look?

@pengzhao-intel pengzhao-intel added this to To do in CPU Performance and Quantization via automation Mar 9, 2020
@wuxun-zhang
Copy link
Contributor

Sure. I will look into this issue.

@TaoLv
Copy link
Member

TaoLv commented Mar 9, 2020

cc @leezu

@wuxun-zhang
Copy link
Contributor

Actually I cannot reproduce this issue with cmake 3.16/gcc 7.

 ~/softwares/cmake_3.16/bin/cmake .. -DUSE_CUDA=0 -DUSE_MKLDNN=1 -DUSE_MKL_IF_AVAILABLE=1 -DUSE_BLAS=MKL                                             [636897718] 
-- The C compiler identification is GNU 7.2.1
-- The CXX compiler identification is GNU 7.2.1
-- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_CROSSCOMPILING FALSE
-- CMAKE_HOST_SYSTEM_PROCESSOR x86_64
-- CMAKE_SYSTEM_PROCESSOR x86_64
-- CMAKE_SYSTEM_NAME Linux
-- CMake version '3.16.5' using generator 'Unix Makefiles'
-- Could not find CCache. Consider installing CCache to speed up compilation.
-- Performing Test SUPPORT_CXX11
-- Performing Test SUPPORT_CXX11 - Success
-- Performing Test SUPPORT_CXX0X
-- Performing Test SUPPORT_CXX0X - Success
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- MKL-DNN compat: set DNNL_BUILD_EXAMPLES to MKLDNN_BUILD_EXAMPLES with value `OFF`
-- MKL-DNN compat: set DNNL_BUILD_TESTS to MKLDNN_BUILD_TESTS with value `OFF`
-- MKL-DNN compat: set DNNL_ENABLE_JIT_PROFILING to MKLDNN_ENABLE_JIT_PROFILING with value `OFF`
-- MKL-DNN compat: set DNNL_LIBRARY_TYPE to MKLDNN_LIBRARY_TYPE with value `STATIC`
-- MKL-DNN compat: set DNNL_ARCH_OPT_FLAGS to MKLDNN_ARCH_OPT_FLAGS with value ``
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- GPU support is disabled
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.5") found components: doxygen dot 
-- Found Git: /home/wuxunzha/anaconda3/bin/git (found version "2.23.0") 
-- Intel(R) VTune(TM) Amplifier JIT profiling disabled
-- Found MKL: /opt/intel/mkl/include  
-- Found MKL (include: /opt/intel/mkl/include, lib: -Wl,--start-group;/opt/intel/mkl/lib/intel64/libmkl_intel_lp64.a;/opt/intel/mkl/lib/intel64/libmkl_intel_thread.a;/opt/intel/mkl/lib/intel64/libmkl_core.a;/opt/intel/lib/intel64/libiomp5.so;-Wl,--end-group
-- OpenCV 3.1.0 found (/home/wuxunzha/anaconda3/share/OpenCV)
--  OpenCV_LIBS=opencv_core;opencv_highgui;opencv_imgproc;opencv_imgcodecs
-- Found OpenMP_C: -fopenmp  
-- Found OpenMP_CXX: -fopenmp  
-- Found OpenMP: TRUE   

@hubutui
Copy link
Author

hubutui commented Mar 9, 2020

cmake 3.16.5, gcc 9.2.1, intel-mkl 2020.0.166 are available in ArchLinux, could you try in a docker container?

@TaoLv
Copy link
Member

TaoLv commented Mar 9, 2020

@hubutui Could you please share the directory structure of MKL and what are installed in the mkl/lib/intel64 folder?

@sl1pkn07
Copy link
Contributor

sl1pkn07 commented Mar 9, 2020

@TaoLv
Copy link
Member

TaoLv commented Mar 9, 2020

@sl1pkn07 Thanks! Seems static libraries are not released in the package. I don't see the files below which I think are needed for the changes in PR #17751.

libmkl_core.a
libmkl_gnu_thread.a
libmkl_intel_thread.a
libmkl_intel_lp64.a
libmkl_intel_ilp64.a
libmkl_sequential.a

@leezu
Copy link
Contributor

leezu commented Mar 9, 2020

@TaoLv the motivation of #17751 is to prevent the situation where MKLDNN dlopens intel omp after another omp has already been opened by the dynamic linker. Static MKL is not needed for that, so let's disable MKL_USE_STATIC_LIBS by default again.

@TaoLv
Copy link
Member

TaoLv commented Mar 10, 2020

@hubutui @sl1pkn07 Who is releasing the package for ArchLinux?

@sl1pkn07
Copy link
Contributor

sl1pkn07 commented Mar 10, 2020

official archlinux member

@svenstaro

@TaoLv
Copy link
Member

TaoLv commented Mar 10, 2020

Hope the package on ArchLinux can include those missing files so we can still use static linking.

@sl1pkn07
Copy link
Contributor

normally, archlinux always avoid ship static libs if exist a shared counterpart

this case is not a exception

@TaoLv
Copy link
Member

TaoLv commented Mar 10, 2020

Then one may need to turn MKL_USE_STATIC_LIBS off explicitly in the cmake command line.

@svenstaro
Copy link

svenstaro commented Mar 10, 2020 via email

@svenstaro
Copy link

Just to follow up on this, our intel-mkl package now has static libs so consider retesting/closing this.

@TaoLv
Copy link
Member

TaoLv commented Jul 28, 2020

I'm closing this issue as the target platform changed to provide static libraries of MKL. @sl1pkn07 please feel free to re-open the issue if you have more questions. Please also note that there is an open PR (#17794 ) to disable the static linking.

@TaoLv TaoLv closed this as completed Jul 28, 2020
CPU Performance and Quantization automation moved this from To do to Done Jul 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

7 participants