leezu edited a comment on issue #17641: OpenMP Error
URL: 
https://github.com/apache/incubator-mxnet/issues/17641#issuecomment-590716897
 
 
   As it's rather difficult to disable clang linking with llvm openmp, we can 
disable linking intel openmp until a solution is found to only link against 
intel openmp (may require compiling with icc) or `mkl_rt.so` is fixed to prefer 
already present `libomp.so` over dynamically loading `libiomp5.so` and running 
into the conflict..
   
   To stop linking with intel openmp, remove / disable
   
   
https://github.com/apache/incubator-mxnet/blob/31144c763bfd0fe199b7fe0f23a20555c9731e7a/cmake/Modules/FindMKL.cmake#L126-L145
   
   and set `-DMKL_USE_SINGLE_DYNAMIC_LIBRARY=OFF`.
   
   Then we get
   
   ```
    0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
    0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
    0x0000000000000001 (NEEDED)             Shared library: 
[libmkl_intel_lp64.so]
    0x0000000000000001 (NEEDED)             Shared library: 
[libmkl_intel_thread.so]
    0x0000000000000001 (NEEDED)             Shared library: [libmkl_core.so]
    0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
    0x0000000000000001 (NEEDED)             Shared library: 
[libopencv_highgui.so.3.2]
    0x0000000000000001 (NEEDED)             Shared library: 
[libopencv_imgcodecs.so.3.2]
    0x0000000000000001 (NEEDED)             Shared library: 
[libopencv_imgproc.so.3.2]
    0x0000000000000001 (NEEDED)             Shared library: 
[libopencv_core.so.3.2]
    0x0000000000000001 (NEEDED)             Shared library: [liblapack.so.3]
    0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
    0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
    0x0000000000000001 (NEEDED)             Shared library: [libomp.so.5]
    0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
    0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
    0x0000000000000001 (NEEDED)             Shared library: 
[ld-linux-x86-64.so.2]
   ```
   
   and `libmkl` shouldn't attempt loading `iomp` dynamically.
   This works because llvm openmp is compatible with `iomp`.
   
   @icemelon9 I can't reproduce this problem. Please comment out the lines 
pointed out above and compile with `cmake -DUSE_CUDA=0 -DUSE_MKLDNN=1 
DMKL_USE_SINGLE_DYNAMIC_LIBRARY=OFF -GNinja ..; ninja`
   
   @cjolivier01 any suggestion how to disable linking llvm openmp for clang if 
`iomp5` is present?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to