From 0e23dc3a2d0d1063f1975f593b3a18ea58e525f4 Mon Sep 17 00:00:00 2001 From: Wilber Date: Fri, 24 Jul 2020 11:14:52 +0800 Subject: [PATCH] [Compile] Update compile for arm FT2000 (#25651) --- CMakeLists.txt | 3 +++ cmake/external/openblas.cmake | 2 ++ python/setup.py.in | 2 ++ 3 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbdba79d2f..265ddc9504 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -218,6 +218,9 @@ endif(WITH_AMD_GPU) if(WITH_ARM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + set(WITH_XBYAK OFF CACHE STRING "Disable XBYAK when compiling WITH_ARM=ON" FORCE) + set(WITH_MKL OFF CACHE STRING "Disable MKL when compiling WITH_ARM=ON." FORCE) + set(WITH_GPU OFF CACHE STRING "Disable GPU when compiling WITH_ARM=ON." FORCE) add_definitions(-DPADDLE_WITH_ARM) endif() diff --git a/cmake/external/openblas.cmake b/cmake/external/openblas.cmake index 5e47f268a3..5bc7eaaff3 100644 --- a/cmake/external/openblas.cmake +++ b/cmake/external/openblas.cmake @@ -20,6 +20,8 @@ SET(CBLAS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/openblas) SET(CBLAS_REPOSITORY https://github.com/xianyi/OpenBLAS.git) SET(CBLAS_TAG v0.3.7) IF(WITH_ARM) + # Under the FT2000 architecture, the calculation result of blas.sgemm in openblas 0.3+ is wrong, + # so version 0.2 is used by default. SET(CBLAS_TAG v0.2.18) ENDIF() cache_third_party(extern_openblas diff --git a/python/setup.py.in b/python/setup.py.in index f3dc1035fc..10325e096f 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -324,6 +324,8 @@ if '${CMAKE_BUILD_TYPE}' == 'Release': command = "install_name_tool -id \"@loader_path/../libs/\" ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so' else: command = "patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/${FLUID_CORE_NAME}" + '.so' + # The dynamic library compiled under aarch64 is greater than 64M, + # and an oversize error will be reported when using patchelf. if platform.machine() != 'aarch64': if os.system(command) != 0: raise Exception("patch ${FLUID_CORE_NAME}.%s failed, command: %s" % (ext_name, command)) -- GitLab