leezu commented on issue #17641: OpenMP Error URL: https://github.com/apache/incubator-mxnet/issues/17641#issuecomment-591002985 > > -DMKL_USE_STATIC_LIBS=ON > > How broken? When I built with clang, it seems to run ok. > > Nevermind, scratch that, it wasn;t finding mkl You can use this patch as fix ``` diff diff --git a/cmake/Modules/FindMKL.cmake b/cmake/Modules/FindMKL.cmake index 51eff8fe0..444a57687 100644 --- a/cmake/Modules/FindMKL.cmake +++ b/cmake/Modules/FindMKL.cmake @@ -19,8 +19,6 @@ # # Options: # -# USE_MKLDNN : Search for MKL:ML library variant -# # MKL_USE_SINGLE_DYNAMIC_LIBRARY : use single dynamic library interface # MKL_USE_STATIC_LIBS : use static libraries # MKL_MULTI_THREADED : use multi-threading @@ -45,8 +43,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) + # Single dynamic library interface leads to conflicts between intel omp and llvm omp + # https://github.com/apache/incubator-mxnet/issues/17641 + 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) 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) @@ -122,10 +122,9 @@ set(INTEL_ROOT "/opt/intel" CACHE PATH "Folder contains intel libs") list(APPEND MKL_LIBRARIES ${${__mkl_lib_upper}_LIBRARY}) endforeach() - if(NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY) if (MKL_USE_STATIC_LIBS) - set(__iomp5_libs iomp5 libiomp5mt.lib) + set(__iomp5_libs libiomp5.a libiomp5mt.lib) else() set(__iomp5_libs iomp5 libiomp5md.lib) endif() @@ -135,15 +134,18 @@ set(INTEL_ROOT "/opt/intel" CACHE PATH "Folder contains intel libs") list(APPEND __looked_for INTEL_INCLUDE_DIR) endif() - find_library(MKL_RTL_LIBRARY ${__iomp5_libs} + find_library(IOMP_LIBRARY ${__iomp5_libs} PATHS ${INTEL_RTL_ROOT} ${INTEL_ROOT}/compiler ${MKL_ROOT}/.. ${MKL_ROOT}/../compiler PATH_SUFFIXES ${__path_suffixes} DOC "Path to Path to OpenMP runtime library") - list(APPEND __looked_for MKL_RTL_LIBRARY) - list(APPEND MKL_LIBRARIES ${MKL_RTL_LIBRARY}) + list(APPEND __looked_for IOMP_LIBRARY) + list(APPEND MKL_LIBRARIES ${IOMP_LIBRARY}) endif() + if(MKL_USE_STATIC_LIBS) + set(MKL_LIBRARIES -Wl,--start-group "${MKL_LIBRARIES}" -Wl,--end-group) + endif() include(FindPackageHandleStandardArgs) @@ -154,4 +156,3 @@ if(MKL_FOUND) endif() mxnet_clear_vars(__looked_for __mkl_libs __path_suffixes __lib_suffix __iomp5_libs) - ```
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
