Created by: zhiqiu
PR types
Bug fixes
PR changes
Others
Describe
Attempt to resolve the TLS problem
As described in issue #21760 (closed) and PR #22001, a error of TLS may happens when import paddle on system with glibc < 2.22.
ImportError:dlopen:cannot load any more object with static TLS
In PR #22001, I attempt to resolve this problem by forcing libmkldnn.so to link libiomp5.so (provided by intel mkl) instead of libgomp.so, using cmake flags CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS
.
However, paddle upgrades the cmake version from 3.5 to 3.10, and DCMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS
is removed in the newer cmake. So PR #22001 fails to resolve the TLS problem.
This PR tries another way to solve the problem by preloading libgomp
before core_avx.so
.
It should be pointed out that, this a tricky way, and the best solution is to upgrade glibc since the TLS bug is fixed in glibc > 2.23.