You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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
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)
The text was updated successfully, but these errors were encountered:
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.
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:
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
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)
The text was updated successfully, but these errors were encountered: