From 7638f0afb30b849f6a237438c97c8d5680572cf4 Mon Sep 17 00:00:00 2001 From: peizhilin Date: Fri, 9 Nov 2018 21:07:42 +0800 Subject: [PATCH] simplify the logic --- cmake/external/openblas.cmake | 61 +++++++-------------------- paddle/fluid/operators/CMakeLists.txt | 2 +- paddle/fluid/platform/variant.h | 2 +- 3 files changed, 18 insertions(+), 47 deletions(-) diff --git a/cmake/external/openblas.cmake b/cmake/external/openblas.cmake index ac31423a6d..25431f0aee 100644 --- a/cmake/external/openblas.cmake +++ b/cmake/external/openblas.cmake @@ -72,51 +72,22 @@ IF(NOT ${CBLAS_FOUND}) ENDIF() ENDIF() - IF(WIN32) - ExternalProject_Add( - extern_openblas - ${EXTERNAL_PROJECT_LOG_ARGS} - # GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git - GIT_REPOSITORY http://admin@172.20.90.14:8080/r/openblas.git - # GIT_TAG ${OPENBLAS_COMMIT} - PREFIX ${CBLAS_SOURCES_DIR} - INSTALL_DIR ${CBLAS_INSTALL_DIR} - BUILD_IN_SOURCE 1 - CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} - -DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG} - -DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE} - -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} - -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} - -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} - -DNO_SHARED=ON - -DNO_STATIC=OFF - -DBUILD_WITHOUT_LAPACK=ON - -DUSE_THREAD=OFF - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CBLAS_INSTALL_DIR} - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - -DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE} - ) - ELSE(WIN32) - SET(COMMON_ARGS CC=${OPENBLAS_CC} NO_SHARED=1 NO_LAPACK=1 libs) - ExternalProject_Add( - extern_openblas - ${EXTERNAL_PROJECT_LOG_ARGS} - # GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git - GIT_REPOSITORY http://admin@172.20.90.14:8080/r/openblas.git - # GIT_TAG ${OPENBLAS_COMMIT} - PREFIX ${CBLAS_SOURCES_DIR} - INSTALL_DIR ${CBLAS_INSTALL_DIR} - BUILD_IN_SOURCE 1 - BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} ${COMMON_ARGS} ${OPTIONAL_ARGS} - INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install NO_SHARED=1 NO_LAPACK=1 PREFIX= - && rm -r ${CBLAS_INSTALL_DIR}/lib/cmake ${CBLAS_INSTALL_DIR}/lib/pkgconfig - UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - ) - ENDIF(WIN32) + SET(COMMON_ARGS CC=${OPENBLAS_CC} NO_SHARED=1 NO_LAPACK=1 libs) + ExternalProject_Add( + extern_openblas + ${EXTERNAL_PROJECT_LOG_ARGS} + # GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git + GIT_REPOSITORY http://admin@172.20.90.14:8080/r/openblas.git + # GIT_TAG ${OPENBLAS_COMMIT} + PREFIX ${CBLAS_SOURCES_DIR} + INSTALL_DIR ${CBLAS_INSTALL_DIR} + BUILD_IN_SOURCE 1 + BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} ${COMMON_ARGS} ${OPTIONAL_ARGS} + INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install NO_SHARED=1 NO_LAPACK=1 PREFIX= + && rm -r ${CBLAS_INSTALL_DIR}/lib/cmake ${CBLAS_INSTALL_DIR}/lib/pkgconfig + UPDATE_COMMAND "" + CONFIGURE_COMMAND "" + ) ENDIF (WITH_PREBUILD_OPENBLAS) SET(CBLAS_PROVIDER openblas) diff --git a/paddle/fluid/operators/CMakeLists.txt b/paddle/fluid/operators/CMakeLists.txt index df8d8e557c..3bc3b3c5e3 100644 --- a/paddle/fluid/operators/CMakeLists.txt +++ b/paddle/fluid/operators/CMakeLists.txt @@ -320,8 +320,8 @@ op_library(save_op DEPS lod_tensor) op_library(load_op DEPS lod_tensor) op_library(save_combine_op DEPS lod_tensor) op_library(load_combine_op DEPS lod_tensor) -op_library(tensor_array_to_tensor_op DEPS concat_op) op_library(concat_op DEPS concat_and_split) +op_library(tensor_array_to_tensor_op DEPS concat_op) list(REMOVE_ITEM GENERAL_OPS ${DEPS_OPS}) diff --git a/paddle/fluid/platform/variant.h b/paddle/fluid/platform/variant.h index 148e1ae6eb..fb6a8bb96f 100644 --- a/paddle/fluid/platform/variant.h +++ b/paddle/fluid/platform/variant.h @@ -44,7 +44,7 @@ limitations under the License. */ #include // some platform-independent defintion -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) +#if defined(_WIN32) #define __UNUSED__() #define __builtin_expect(EXP, C) (EXP) #else -- GitLab