MKL_DNN.cmake 928 字节
Newer Older
1 2 3 4 5 6 7 8
if (MGE_USE_SYSTEM_LIB)
    find_package(dnnl)
    if (dnnl_FOUND)
        message("Using system provided MKL-DNN.")
        set (MGE_USE_SYSTEM_MKLDNN ON)
        return()
    endif()
endif()
9 10 11 12 13
option(DNNL_BUILD_TESTS "" OFF)
option(DNNL_BUILD_EXAMPLES "" OFF)
# we do not want to use OMP now, so config to CPU mode
# if set to OMP, some dnnl algo will be more fast
set(DNNL_CPU_RUNTIME DNNL_RUNTIME_SEQ CACHE STRING "config dnnl to DNNL_RUNTIME_SEQ")
14
if(MGE_BLAS STREQUAL "MKL")
15 16
    option(_DNNL_USE_MKL "" ON)
    set(MKLROOT ${MKL_ROOT_DIR} CACHE STRING "MKL ROOT FOR DNNL")
17
    set(MKLLIB libmkl)
18
else()
19
    option(_DNNL_USE_MKL "" OFF)
20 21
endif()

22 23
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-extra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-extra")
24
set(DNNL_LIBRARY_TYPE STATIC CACHE STRING "config dnnl to STATIC")
25
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/intel-mkl-dnn)