leezu removed a comment on issue #17641: OpenMP Error
URL: 
https://github.com/apache/incubator-mxnet/issues/17641#issuecomment-590950280
 
 
   `-DMKL_USE_STATIC_LIBS=ON` will still link `libiomp5` dynamically as per our 
`FindMKL.cmake`. That could be fixed, but then `libiomp5` will be statically 
linked and llvm `libopenmp` dynamically linked. So both will still be present 
and the error reported by @icemelon9 would remain?
   
   I'll verify the following patch for 
https://github.com/apache/incubator-mxnet/pull/17645
   
   ``` diff
   diff --git a/cmake/Modules/FindMKL.cmake b/cmake/Modules/FindMKL.cmake
   index 51eff8fe0..346a02103 100644
   --- a/cmake/Modules/FindMKL.cmake
   +++ b/cmake/Modules/FindMKL.cmake
   @@ -45,9 +45,10 @@ set(INTEL_ROOT "/opt/intel" CACHE PATH "Folder contains 
intel libs")
    
    
      # ---[ Options
   -  option(MKL_USE_SINGLE_DYNAMIC_LIBRARY "Use single dynamic library 
interface" ON)
   -  cmake_dependent_option(MKL_USE_STATIC_LIBS "Use static libraries" OFF 
"NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY" OFF)
   +  option(MKL_USE_SINGLE_DYNAMIC_LIBRARY "Use single dynamic library 
interface" OFF)
   +  cmake_dependent_option(MKL_USE_STATIC_LIBS "Use static libraries" ON "NOT 
MKL_USE_SINGLE_DYNAMIC_LIBRARY" OFF)
      cmake_dependent_option(MKL_MULTI_THREADED  "Use multi-threading"  ON "NOT 
MKL_USE_SINGLE_DYNAMIC_LIBRARY" OFF)
   +  cmake_dependent_option(MKL_IOMP  "Link with Intel OpenMP" OFF "NOT 
MKL_USE_SINGLE_DYNAMIC_LIBRARY" OFF)
      option(MKL_USE_ILP64 "Use ilp64 data model" OFF)
      cmake_dependent_option(MKL_USE_CLUSTER "Use cluster functions" OFF 
"CMAKE_SIZEOF_VOID_P EQUAL 4" OFF)
    
   @@ -121,9 +122,12 @@ set(INTEL_ROOT "/opt/intel" CACHE PATH "Folder contains 
intel libs")
        list(APPEND __looked_for ${__mkl_lib_upper}_LIBRARY)
        list(APPEND MKL_LIBRARIES ${${__mkl_lib_upper}_LIBRARY})
      endforeach()
   +  if(MKL_USE_STATIC_LIBS)
   +    set(MKL_LIBRARIES -Wl,--start-group "${MKL_LIBRARIES}" -Wl,--end-group)
   +  endif()
    
    
   -  if(NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY)
   +  if(NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY AND MKL_IOMP)
        if (MKL_USE_STATIC_LIBS)
          set(__iomp5_libs iomp5 libiomp5mt.lib)
        else()
   ```
   
   > On my machine, I always have another gomp as reported here:
   
   Empirically loading gomp and iomp or llvm openmp does not cause problems. 
But loading llvm openmp + intel openmp causes problems. @cjolivier01 may want 
to clarify as he vetoes any change.
   
   Ideally for GCC, we should only link `libiomp5.so` if compiled with MKL and 
not any llvm openmp. For compiling with clang, we should only link llvm 
`libomp.so`, as apparently llvm + intel omp conflict.

----------------------------------------------------------------
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