From 394edd8647ece5cb47f0ac78ae2e43117ceed0c0 Mon Sep 17 00:00:00 2001 From: zhouwei25 <52485244+zhouwei25@users.noreply.github.com> Date: Mon, 4 Nov 2019 14:04:13 +0800 Subject: [PATCH] fix mklml and cblas bug,test=develop (#20970) --- cmake/third_party.cmake | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 1910e4111f0..eb1fc7048be 100755 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -19,16 +19,6 @@ set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING set(THIRD_PARTY_BUILD_TYPE Release) -set(WITH_MKLML ${WITH_MKL}) -if (NOT DEFINED WITH_MKLDNN) - if (WITH_MKL AND AVX2_FOUND) - set(WITH_MKLDNN ON) - else() - message(STATUS "Do not have AVX2 intrinsics and disabled MKL-DNN") - set(WITH_MKLDNN OFF) - endif() -endif() - # Correction of flags on different Platform(WIN/MAC) and Print Warning Message if (APPLE) if(WITH_MKL) @@ -36,12 +26,6 @@ if (APPLE) "Mac is not supported with MKL in Paddle yet. Force WITH_MKL=OFF.") set(WITH_MKL OFF CACHE STRING "Disable MKL for building on mac" FORCE) endif() - - if(WITH_MKLML) - MESSAGE(WARNING - "Mac is not supported with MKLML in Paddle yet. Force WITH_MKLML=OFF.") - set(WITH_MKLML OFF CACHE STRING "Disable MKLML package in MacOS" FORCE) - endif() endif() if(WIN32 OR APPLE) @@ -67,6 +51,16 @@ if(WIN32 OR APPLE) endif() endif() +set(WITH_MKLML ${WITH_MKL}) +if (NOT DEFINED WITH_MKLDNN) + if (WITH_MKL AND AVX2_FOUND) + set(WITH_MKLDNN ON) + else() + message(STATUS "Do not have AVX2 intrinsics and disabled MKL-DNN") + set(WITH_MKLDNN OFF) + endif() +endif() + if(WIN32 OR APPLE OR NOT WITH_GPU OR ON_INFER) set(WITH_DGC OFF) endif() @@ -93,10 +87,11 @@ endif() if(WITH_MKLML) include(external/mklml) # download, install mklml package list(APPEND third_party_deps mklml) -elseif (NOT CBLAS_FOUND OR WIN32) +endif() +include(external/openblas) # find first, then download, build, install openblas +if(NOT CBLAS_FOUND) list(APPEND third_party_deps extern_openblas) endif() -include(external/openblas) # find first, then download, build, install openblas if(WITH_MKLDNN) include(external/mkldnn) # download, build, install mkldnn -- GitLab