From 4707db919e6b2352ca1c55fedd2a547069e7a9f0 Mon Sep 17 00:00:00 2001 From: Peihan Date: Wed, 21 Jul 2021 17:13:50 +0800 Subject: [PATCH] [cherry-pick] enable remove grad op of linux/win compile scripts (#34295) * Update paddle_build.bat to remove op grad when build windows inference lib (#33800) 1. check status of remove op grad shell scripts 2. Update paddle_build.bat to remove op grad when build windows inference lib 3. add inference demo test after build finish * Update paddle_build.sh for remove op grad when compile c++ inference lib (#33798) * fix zip inference library bug (#34025) Co-authored-by: Zhou Wei <1183042833@qq.com> --- paddle/scripts/paddle_build.bat | 5 +++++ paddle/scripts/paddle_build.sh | 1 + 2 files changed, 6 insertions(+) diff --git a/paddle/scripts/paddle_build.bat b/paddle/scripts/paddle_build.bat index f6c947eee0..85f4c822dd 100644 --- a/paddle/scripts/paddle_build.bat +++ b/paddle/scripts/paddle_build.bat @@ -202,9 +202,12 @@ rem ------Build windows inference library------ set ON_INFER=ON set WITH_PYTHON=OFF set CUDA_ARCH_NAME=All +python %work_dir%\tools\remove_grad_op_and_kernel.py +if %errorlevel% NEQ 0 exit /b 1 call :cmake || goto cmake_error call :build || goto build_error +call :test_inference || goto test_inference_error call :zip_cc_file || goto zip_cc_file_error call :zip_c_file || goto zip_c_file_error goto:success @@ -678,6 +681,7 @@ exit /b 1 rem --------------------------------------------------------------------------------------------- :zip_cc_file +cd /d %work_dir%\build tree /F %cd%\paddle_inference_install_dir\paddle if exist paddle_inference.zip del paddle_inference.zip python -c "import shutil;shutil.make_archive('paddle_inference', 'zip', root_dir='paddle_inference_install_dir')" @@ -695,6 +699,7 @@ exit /b 1 rem --------------------------------------------------------------------------------------------- :zip_c_file +cd /d %work_dir%\build tree /F %cd%\paddle_inference_c_install_dir\paddle if exist paddle_inference_c.zip del paddle_inference_c.zip python -c "import shutil;shutil.make_archive('paddle_inference_c', 'zip', root_dir='paddle_inference_c_install_dir')" diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 66420a1506..d19b6cf20e 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -1974,6 +1974,7 @@ function main() { test_fluid_lib ;; build_inference_lib) + python ${PADDLE_ROOT}/tools/remove_grad_op_and_kernel.py cmake_gen ${PYTHON_ABI:-""} gen_fluid_lib ${parallel_number} ;; -- GitLab