LIST(APPEND MKLDNN_INCLUDE_DIR ${IDEEP_INCLUDE_DIR})
IF(MKL_FOUND)
- # Configure MKL-DNN
- ADD_DEFINITIONS(-DUSE_MKL)
- SET(MKLDNN_USE_MKL "FULL")
- INCLUDE_DIRECTORIES(AFTER ${MKL_INCLUDE_DIR})
- LIST(APPEND mkldnn_LINKER_LIBS ${MKL_LIBRARIES})
-
LIST(APPEND MKLDNN_LIBRARIES ${MKL_LIBRARIES})
LIST(APPEND MKLDNN_INCLUDE_DIR ${MKL_INCLUDE_DIR})
-
- # The OMP-related variables of MKL-DNN have to be overrode here
- # if MKL is used. Then, the OMP version can be defined by MKL.
+ # The OMP-related variables of MKL-DNN have to be overwritten here,
+ # if MKL is used, and the OMP version is defined by MKL.
# MKL_LIBRARIES_xxxx_LIBRARY is defined by MKL.
- IF (EXISTS "${MKL_LIBRARIES_gomp_LIBRARY}")
- SET(MKLIOMP5LIB ${MKL_LIBRARIES_gomp_LIBRARY} CACHE STRING "Override MKL-DNN omp dependency" FORCE)
- ELSEIF(EXISTS "${MKL_LIBRARIES_iomp5_LIBRARY}")
- SET(MKLIOMP5LIB ${MKL_LIBRARIES_iomp5_LIBRARY} CACHE STRING "Override MKL-DNN omp dependency" FORCE)
- ELSEIF(EXISTS "${MKL_LIBRARIES_libiomp5md_LIBRARY}")
- SET(MKLIOMP5DLL ${MKL_LIBRARIES_libiomp5md_LIBRARY} CACHE STRING "Override MKL-DNN omp dependency" FORCE)
- ELSE(EXISTS "${MKL_LIBRARIES_gomp_LIBRARY}")
- SET(MKLIOMP5LIB "" CACHE STRING "Override MKL-DNN omp dependency" FORCE)
- SET(MKLIOMP5DLL "" CACHE STRING "Override MKL-DNN omp dependency" FORCE)
- ENDIF(EXISTS "${MKL_LIBRARIES_gomp_LIBRARY}")
+ # INTEL_MKL_DIR gives the MKL root path.
+ IF (INTEL_MKL_DIR)
+ SET(MKLROOT ${INTEL_MKL_DIR})
+ IF(WIN32)
+ SET(MKLIOMP5DLL ${MKL_LIBRARIES_libiomp5md_LIBRARY} CACHE STRING "Overwrite MKL-DNN omp dependency" FORCE)
+ ELSE(WIN32)
+ IF (MKL_LIBRARIES_gomp_LIBRARY)
+ SET(MKLOMPLIB ${MKL_LIBRARIES_gomp_LIBRARY})
+ ELSE(MKL_LIBRARIES_gomp_LIBRARY)
+ SET(MKLOMPLIB ${MKL_LIBRARIES_iomp5_LIBRARY})
+ ENDIF(MKL_LIBRARIES_gomp_LIBRARY)
+ SET(MKLIOMP5LIB ${MKLOMPLIB} CACHE STRING "Overwrite MKL-DNN omp dependency" FORCE)
+ ENDIF(WIN32)
+ ELSE(INTEL_MKL_DIR)
+ MESSAGE(STATUS "Warning: MKL is found, but INTEL_MKL_DIR is not set!")
+ ENDIF(INTEL_MKL_DIR)
ELSE(MKL_FOUND)
# If we cannot find MKL, we will use the Intel MKL Small library
ADD_COMPILE_OPTIONS(-Wno-strict-overflow)
ADD_COMPILE_OPTIONS(-Wno-error=strict-overflow)
ENDIF(NOT APPLE AND CMAKE_COMPILER_IS_GNUCC)
- SET(MKLDNN_THREADING "OMP:COMP")
SET(WITH_TEST FALSE CACHE BOOL "build with mkl-dnn test" FORCE)
SET(WITH_EXAMPLE FALSE CACHE BOOL "build with mkl-dnn examples" FORCE)
ADD_SUBDIRECTORY(${MKLDNN_ROOT})