Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so #4085

Closed
emailweixu opened this issue Sep 13, 2017 · 2 comments · Fixed by #5512
Closed

Intel MKL FATAL ERROR: Cannot load libmkl_avx.so or libmkl_def.so #4085

emailweixu opened this issue Sep 13, 2017 · 2 comments · Fixed by #5512
Assignees

Comments

@emailweixu
Copy link
Collaborator

emailweixu commented Sep 13, 2017

When paddle is compiled with MKL (by setting INTEL_MKL_ROOT when running cmake), _swig_paddle.so is linked against some libmkl_*.so. When MKL functions are actually used by the program, another MKL library libmkl_avx.so is dynamically loaded by MKL and some symbols in libmkl_avx.so need to be resolved from libmkl_intel_sequential.so. However, the symbols of libmkl_intel_sequential.so are not visible to libmkl_avx.so because when python imports an .so as an module the so lib is dlopened without RTLD_GLOBAL flag by default.

There are several ways to solve this issue:

  1. Using static library. Which can be achieved using the following two methods:
    i. Change cmake/cblas.cmake to search for static libraries libmkl_*.a explicitly at several find_library() calls.
    ii. Move .so files under INTEL_MKL_ROOT/lib/intel64 to a different location

  2. Using RTLD_GLOBAL to do import. This can be achieved by adding a line at paddle/py_paddle/__init__.py:
    sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)

@lcy-seso
Copy link
Contributor

I encountered the same problem and this issue explains the reason. Thank you.

@luotao1
Copy link
Contributor

luotao1 commented Sep 14, 2017

I encountered the same problem before.

However, as Paddle support MKLML & MKLDNN currently, we could use MKLML to instead INTEL_MKL_ROOT. That is, setting WITH_MKLML=ON and WITH_MKLDNN=ON, all the MKL related libraries will be auto downloaded, compiled and installed.

Thus, can we remove INTEL_MKL_ROOT? @emailweixu @tensor-tang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants