From 935da32d25a29746ee88e02e1d10d73531f94fc9 Mon Sep 17 00:00:00 2001 From: liuyuhui <1029880267@qq.com> Date: Fri, 14 Aug 2020 11:14:06 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90paddle.fleet=E3=80=91upgrade=20fleet:?= =?UTF-8?q?=20modify=20role=5Fmaker=20(#26038)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add unittest for paddlerolemaker with gloo --- cmake/external/gloo.cmake | 10 +- cmake/third_party.cmake | 9 +- paddle/scripts/paddle_build.sh | 8 + python/paddle/distributed/fleet/__init__.py | 14 +- .../tests/unittests/dist_fleet_debug_gloo.py | 61 ++++++ .../tests/unittests/test_dist_fleet_gloo.py | 188 ++++++++++++++++++ .../fluid/tests/unittests/test_fleet.py | 7 +- .../tests/unittests/test_fleet_nocvm_1.py | 7 +- .../tests/unittests/test_fleet_rolemaker.py | 8 +- .../tests/unittests/test_fleet_rolemaker_3.py | 7 +- .../unittests/test_fleet_unitaccessor.py | 7 +- 11 files changed, 302 insertions(+), 24 deletions(-) create mode 100644 python/paddle/fluid/tests/unittests/dist_fleet_debug_gloo.py create mode 100644 python/paddle/fluid/tests/unittests/test_dist_fleet_gloo.py diff --git a/cmake/external/gloo.cmake b/cmake/external/gloo.cmake index 337e326dc1..895bc0849a 100644 --- a/cmake/external/gloo.cmake +++ b/cmake/external/gloo.cmake @@ -14,13 +14,21 @@ INCLUDE(ExternalProject) +execute_process(COMMAND bash -c "gcc -dumpversion" OUTPUT_VARIABLE GCC_VERSION) + SET(GLOO_PROJECT "extern_gloo") IF((NOT DEFINED GLOO_VER) OR (NOT DEFINED GLOO_URL)) MESSAGE(STATUS "use pre defined download url") SET(GLOO_VER "master" CACHE STRING "" FORCE) SET(GLOO_NAME "gloo" CACHE STRING "" FORCE) - SET(GLOO_URL "https://pslib.bj.bcebos.com/gloo.tar.gz" CACHE STRING "" FORCE) + + if(${GCC_VERSION} VERSION_EQUAL "8.2.0") + SET(GLOO_URL "https://fleet.bj.bcebos.com/gloo/gloo.tar.gz.gcc8" CACHE STRING "" FORCE) + else() + SET(GLOO_URL "https://fleet.bj.bcebos.com/gloo/gloo.tar.gz.gcc482" CACHE STRING "" FORCE) + endif() ENDIF() + MESSAGE(STATUS "GLOO_NAME: ${GLOO_NAME}, GLOO_URL: ${GLOO_URL}") SET(GLOO_SOURCE_DIR "${THIRD_PARTY_PATH}/gloo") SET(GLOO_DOWNLOAD_DIR "${GLOO_SOURCE_DIR}/src/${GLOO_PROJECT}") diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index be536b2eef..5b2c0f51cd 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -263,10 +263,6 @@ if(WITH_PSLIB) endif() endif(WITH_PSLIB) -if(NOT WIN32 AND NOT APPLE) - include(external/gloo) - list(APPEND third_party_deps extern_gloo) -endif() if(WITH_BOX_PS) include(external/box_ps) @@ -274,6 +270,11 @@ if(WITH_BOX_PS) endif(WITH_BOX_PS) if(WITH_DISTRIBUTE) + if(WITH_GLOO) + include(external/gloo) + list(APPEND third_party_deps extern_gloo) + endif() + if(WITH_GRPC) list(APPEND third_party_deps extern_grpc) else() diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 4efcec7a41..4bd93da72e 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -195,6 +195,12 @@ function cmake_base() { distibuted_flag=${WITH_DISTRIBUTE:-OFF} grpc_flag=${WITH_GRPC:-${distibuted_flag}} + if [ "$SYSTEM" == "Darwin" ]; then + gloo_flag="OFF" + else + gloo_flag=${distibuted_flag} + fi + cat <