You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

MKL_DNN.cmake 923 B

12345678910111213141516171819202122232425262728293031
  1. if(MGE_USE_SYSTEM_LIB)
  2. find_package(dnnl)
  3. if(dnnl_FOUND)
  4. message(STATUS "Using system provided MKL-DNN.")
  5. set(MGE_USE_SYSTEM_MKLDNN ON)
  6. return()
  7. endif()
  8. endif()
  9. option(DNNL_BUILD_TESTS "" OFF)
  10. option(DNNL_BUILD_EXAMPLES "" OFF)
  11. # we do not want to use OMP now, so config to CPU mode if set to OMP, some dnnl algo
  12. # will be more fast
  13. set(DNNL_CPU_RUNTIME
  14. "SEQ"
  15. CACHE STRING "config dnnl to DNNL_RUNTIME_SEQ")
  16. if(MGE_BLAS STREQUAL "MKL")
  17. option(_DNNL_USE_MKL "" ON)
  18. set(MKLROOT
  19. ${MKL_ROOT_DIR}
  20. CACHE STRING "MKL ROOT FOR DNNL")
  21. set(MKLLIB libmkl)
  22. else()
  23. option(_DNNL_USE_MKL "" OFF)
  24. endif()
  25. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-extra")
  26. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-extra")
  27. set(DNNL_LIBRARY_TYPE
  28. STATIC
  29. CACHE STRING "config dnnl to STATIC")
  30. add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/intel-mkl-dnn)