From 0a4fad3b8aabfc98273a7e5eed32f747d3355535 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Wed, 19 Jul 2023 15:07:54 +0800 Subject: [PATCH 1/6] add absl to third_party --- cmake/cinn.cmake | 4 ---- cmake/cinn/external/absl.cmake | 30 ++++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/cmake/cinn.cmake b/cmake/cinn.cmake index a7b74124a150a..538d2d8f19eb0 100644 --- a/cmake/cinn.cmake +++ b/cmake/cinn.cmake @@ -318,10 +318,6 @@ set(CINN_LIB "${CINN_LIB_LOCATION}/${CINN_LIB_NAME}") # Add CINN's dependencies header files ###################################### -# Add absl -set(ABSL_INCLUDE_DIR "${CMAKE_BINARY_DIR}/dist/third_party/absl/include") -include_directories(${ABSL_INCLUDE_DIR}) - # Add isl set(ISL_INCLUDE_DIR "${CMAKE_BINARY_DIR}/dist/third_party/isl/include") include_directories(${ISL_INCLUDE_DIR}) diff --git a/cmake/cinn/external/absl.cmake b/cmake/cinn/external/absl.cmake index 466d531780736..492ff4b55f176 100644 --- a/cmake/cinn/external/absl.cmake +++ b/cmake/cinn/external/absl.cmake @@ -1,13 +1,31 @@ include(ExternalProject) -set(ABSL_SOURCES_DIR ${THIRD_PARTY_PATH}/absl) +set(ABSL_SOURCES_DIR ${PADDLE_SOURCE_DIR}/third_party/absl) set(ABSL_INSTALL_DIR ${THIRD_PARTY_PATH}/install/absl) - +set(ABSL_PREFIX_DIR ${THIRD_PARTY_PATH}/absl) set(ABSL_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) set(ABSL_REPOSITORY "https://github.com/abseil/abseil-cpp.git") set(ABSL_TAG "20210324.2") +if(NOT EXISTS ${ABSL_SOURCES_DIR}) + message( + STATUS "Download absl source from ${ABSL_REPOSITORY} to ABSL_SOURCES_DIR") + execute_process(COMMAND ${GIT_EXECUTABLE} clone -b ${ABSL_TAG} + ${ABSL_REPOSITORY} ${ABSL_SOURCES_DIR}) +else() + # check git tag + execute_process( + COMMAND ${GIT_EXECUTABLE} -C ${ABSL_SOURCES_DIR} describe --tags + OUTPUT_VARIABLE CURRENT_TAG + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT ${CURRENT_TAG} STREQUAL ${ABSL_TAG}) + message(STATUS "Checkout absl to ${ABSL_TAG}") + execute_process(COMMAND ${GIT_EXECUTABLE} -C ${ABSL_SOURCES_DIR} checkout + -q ${ABSL_TAG}) + endif() +endif() + set(OPTIONAL_ARGS "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" @@ -22,10 +40,10 @@ ExternalProject_Add( external_absl ${EXTERNAL_PROJECT_LOG_ARGS} DEPENDS gflags - GIT_REPOSITORY ${ABSL_REPOSITORY} - GIT_TAG ${ABSL_TAG} - PREFIX ${ABSL_SOURCES_DIR} - UPDATE_COMMAND "" + PREFIX ${ABSL_PREFIX_DIR} + SOURCE_DIR ${ABSL_SOURCES_DIR} + UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_directory ${ABSL_SOURCES_DIR}/include + ${ABSL_INSTALL_DIR}/include CMAKE_ARGS ${OPTIONAL_ARGS} -DCMAKE_INSTALL_PREFIX=${ABSL_INSTALL_DIR} -DCMAKE_INSTALL_LIBDIR=${ABSL_INSTALL_DIR}/lib From 801c9fb0b8cc83086ef1edfe581a2f6362e8463a Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Wed, 19 Jul 2023 17:27:24 +0800 Subject: [PATCH 2/6] fix --- cmake/cinn/external/absl.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/cinn/external/absl.cmake b/cmake/cinn/external/absl.cmake index 492ff4b55f176..051a83c956882 100644 --- a/cmake/cinn/external/absl.cmake +++ b/cmake/cinn/external/absl.cmake @@ -42,8 +42,7 @@ ExternalProject_Add( DEPENDS gflags PREFIX ${ABSL_PREFIX_DIR} SOURCE_DIR ${ABSL_SOURCES_DIR} - UPDATE_COMMAND ${CMAKE_COMMAND} -E copy_directory ${ABSL_SOURCES_DIR}/include - ${ABSL_INSTALL_DIR}/include + UPDATE_COMMAND "" CMAKE_ARGS ${OPTIONAL_ARGS} -DCMAKE_INSTALL_PREFIX=${ABSL_INSTALL_DIR} -DCMAKE_INSTALL_LIBDIR=${ABSL_INSTALL_DIR}/lib From 7b12c68f71d880ba86eb7e1d9d9ba6b6e91c9e21 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Fri, 21 Jul 2023 16:28:14 +0800 Subject: [PATCH 3/6] ci test --- paddle/scripts/paddle_build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index cd56e6a7176c1..49179bb349930 100644 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -3578,6 +3578,9 @@ EOF fi fi + cat /workspace/Paddle/build/third_party/absl/src/external_absl-stamp/external_absl-configure-err.log + sleep 10h + # ci will collect ccache hit rate collect_ccache_hits From 5bc2c41d41d604e70f439b1da59dbb913699a5e0 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Fri, 21 Jul 2023 23:19:27 +0800 Subject: [PATCH 4/6] ci test --- paddle/scripts/paddle_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 49179bb349930..4ffbcbc60569b 100644 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -3568,6 +3568,7 @@ EOF if [ "$SYSTEM" == "Darwin" ]; then ${PYTHON_EXECUTABLE} setup.py $2 --plat-name=macosx_10_9_x86_64;build_error=$? else + rm -rf /workspace/Paddle/build/third_party/ ${PYTHON_EXECUTABLE} setup.py $2;build_error=$? fi else From 0d06a73d86cda6c55c09ccb1fe7888aed30aa753 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Sat, 22 Jul 2023 10:03:12 +0800 Subject: [PATCH 5/6] ci test --- paddle/scripts/paddle_build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 4ffbcbc60569b..38ef7823a2104 100644 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -3568,20 +3568,20 @@ EOF if [ "$SYSTEM" == "Darwin" ]; then ${PYTHON_EXECUTABLE} setup.py $2 --plat-name=macosx_10_9_x86_64;build_error=$? else - rm -rf /workspace/Paddle/build/third_party/ ${PYTHON_EXECUTABLE} setup.py $2;build_error=$? fi else if [ "$SYSTEM" == "Darwin" ]; then python setup.py $2 --plat-name=macosx_10_9_x86_64;build_error=$? else - python setup.py $2;build_error=$? + rm -rf /workspace/Paddle/build/third_party/ + python setup.py $2 + cat /workspace/Paddle/build/third_party/absl/src/external_absl-stamp/external_absl-configure-err.log + sleep 10h + # python setup.py $2;build_error=$? fi fi - cat /workspace/Paddle/build/third_party/absl/src/external_absl-stamp/external_absl-configure-err.log - sleep 10h - # ci will collect ccache hit rate collect_ccache_hits From 6686e262c0d2c7c7faf6311fc6b014db2a16b0c1 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Mon, 7 Aug 2023 15:58:15 +0800 Subject: [PATCH 6/6] rollback --- paddle/scripts/paddle_build.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index f00ad1a661a8c..1cbf14d1908e9 100644 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -3554,11 +3554,7 @@ EOF if [ "$SYSTEM" == "Darwin" ]; then python setup.py $2 --plat-name=macosx_10_9_x86_64;build_error=$? else - rm -rf /workspace/Paddle/build/third_party/ - python setup.py $2 - cat /workspace/Paddle/build/third_party/absl/src/external_absl-stamp/external_absl-configure-err.log - sleep 10h - # python setup.py $2;build_error=$? + python setup.py $2;build_error=$? fi fi