Fix MKL_USE_STATIC_LIBS=0 and test on one CI pipeline
Co-authored-by: Anna Karbownik <anna.karbownik@intel.com>,
diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh
index c8ec09a..1af9d87 100755
--- a/ci/docker/runtime_functions.sh
+++ b/ci/docker/runtime_functions.sh
@@ -526,6 +526,7 @@
-DUSE_CUDA=OFF \
-DUSE_TVM_OP=ON \
-DUSE_MKL_IF_AVAILABLE=ON \
+ -DMKL_USE_STATIC_LIBS=OFF \
-DUSE_BLAS=MKL \
-DBUILD_EXTENSION_PATH=/work/mxnet/example/extensions/lib_external_ops \
-GNinja /work/mxnet
diff --git a/python/mxnet/base.py b/python/mxnet/base.py
index daa33b8..2be3448 100644
--- a/python/mxnet/base.py
+++ b/python/mxnet/base.py
@@ -281,7 +281,11 @@
# pylint: disable=E1123
lib = ctypes.CDLL(lib_path[0], winmode=0x00000008)
else:
- lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
+ # We use RTLD_GLOBAL as, when dynamically linking with MKL,
+ # libmkl_core.so may load libmkl_avx512.so via dlopen. When opening
+ # libmxnet and it's dependencies (libmkl_core.so) via RTLD_LOCAL, MKL's
+ # dlopen calls will fail with undefined symbol errors.
+ lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
# DMatrix functions
lib.MXGetLastError.restype = ctypes.c_char_p
return lib