From 5d821578d90a1f8698035c149eee2989b6e2b488 Mon Sep 17 00:00:00 2001 From: zhouwei25 <52485244+zhouwei25@users.noreply.github.com> Date: Mon, 18 Nov 2019 16:58:05 +0800 Subject: [PATCH] fix bug when build openblas with a computer that has installed openblas before,test=develop (#21160) --- cmake/cblas.cmake | 2 +- cmake/inference_lib.cmake | 17 +++++++++-------- cmake/third_party.cmake | 3 +-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmake/cblas.cmake b/cmake/cblas.cmake index deca687a94..b51225dd4d 100644 --- a/cmake/cblas.cmake +++ b/cmake/cblas.cmake @@ -14,7 +14,7 @@ # Find the CBlas and lapack libraries # -# It will search MKLML, atlas, OpenBlas, reference-cblas in order. +# It will search MKLML, OpenBlas, reference-cblas, extern-openblas in order. # # If any cblas implementation found, the following variable will be set. # CBLAS_PROVIDER # one of MKLML, OPENBLAS, REFERENCE diff --git a/cmake/inference_lib.cmake b/cmake/inference_lib.cmake index 661661ed77..f00be99f07 100644 --- a/cmake/inference_lib.cmake +++ b/cmake/inference_lib.cmake @@ -75,25 +75,26 @@ copy(inference_lib_dist SRCS ${DLPACK_INCLUDE_DIR}/dlpack DSTS ${dst_dir}) -if(WITH_MKLML) + +if(${CBLAS_PROVIDER} STREQUAL MKLML) set(dst_dir "${FLUID_INFERENCE_INSTALL_DIR}/third_party/install/mklml") if(WIN32) copy(inference_lib_dist SRCS ${MKLML_LIB} ${MKLML_IOMP_LIB} ${MKLML_SHARED_LIB} - ${MKLML_SHARED_LIB_DEPS} ${MKLML_SHARED_IOMP_LIB} ${MKLML_INC_DIR} + ${MKLML_SHARED_LIB_DEPS} ${MKLML_SHARED_IOMP_LIB} ${MKLML_INC_DIR} DSTS ${dst_dir}/lib ${dst_dir}/lib ${dst_dir}/lib - ${dst_dir}/lib ${dst_dir}/lib ${dst_dir}) + ${dst_dir}/lib ${dst_dir}/lib ${dst_dir}) else() copy(inference_lib_dist SRCS ${MKLML_LIB} ${MKLML_IOMP_LIB} ${MKLML_INC_DIR} DSTS ${dst_dir}/lib ${dst_dir}/lib ${dst_dir}) endif() -elseif (NOT CBLAS_FOUND OR WIN32) +elseif(${CBLAS_PROVIDER} STREQUAL EXTERN_OPENBLAS) set(dst_dir "${FLUID_INFERENCE_INSTALL_DIR}/third_party/install/openblas") - copy(inference_lib_dist - SRCS ${CBLAS_INSTALL_DIR}/lib ${CBLAS_INSTALL_DIR}/include - DSTS ${dst_dir} ${dst_dir}) -endif () + copy(inference_lib_dist + SRCS ${CBLAS_INSTALL_DIR}/lib ${CBLAS_INSTALL_DIR}/include + DSTS ${dst_dir} ${dst_dir}) +endif() if(WITH_MKLDNN) set(dst_dir "${FLUID_INFERENCE_INSTALL_DIR}/third_party/install/mkldnn") diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index e3340932ba..5546e94185 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -116,8 +116,7 @@ endif() include(cblas) # find first, then download, build, install openblas if(${CBLAS_PROVIDER} STREQUAL MKLML) list(APPEND third_party_deps extern_mklml) -endif() -if(${CBLAS_PROVIDER} STREQUAL EXTERN_OPENBLAS) +elseif(${CBLAS_PROVIDER} STREQUAL EXTERN_OPENBLAS) list(APPEND third_party_deps extern_openblas) endif() -- GitLab