From 03090d3604d68f4e5768b5c45dae7bbf6f0b824e Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Wed, 21 Jul 2021 16:46:09 +0800 Subject: [PATCH 01/12] notest;test=cpu-benchmark --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6b3f3ef86fe1b..f067ca0764c0e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +

From 408bc4e9ae9624395566fbba0219cf2ea186f114 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Thu, 22 Jul 2021 16:22:28 +0800 Subject: [PATCH 02/12] benchmark-cpu --- tools/test_model_benchmark.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index 98066d7beeaa7..b793667559e4a 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -83,6 +83,16 @@ function run_model_benchmark { bash model_ci.sh } -compile_install_paddle -prepare_data -run_model_benchmark +case $1 in + whl_check) + compile_install_paddle + ;; + run_benchmark) + prepare_data + run_model_benchmark + ;; + *) + echo "Error: Incorrect or no parameters" + exit 1 + ;; +esac From 99fcece9f121152185488511639837b80930c912 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Thu, 29 Jul 2021 16:42:27 +0800 Subject: [PATCH 03/12] notest;test=cpu-benchmark --- README.md | 1 - tools/test_model_benchmark.sh | 27 ++++++++++----------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f067ca0764c0e..6b3f3ef86fe1b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -

diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index b793667559e4a..f1d62e8f6f072 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -54,33 +54,26 @@ function compile_install_paddle { export WITH_TESTING=OFF export WITH_UNITY_BUILD=ON check_whl + cd ${cache_dir} + mkdir benchmark_data && cd benchmark_data + git clone --recurse-submodules=PaddleClas --recurse-submodules=PaddleNLP https://github.com/paddlepaddle/benchmark.git } function prepare_data { - cd ${cache_dir} - if [ -d "benchmark_data" ];then - echo -e "benchmark_data exist!" - else - mkdir benchmark_data - cd benchmark_data - mkdir dataset - cd dataset - wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/Bert.zip - unzip Bert.zip - wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/imagenet100_data.zip - unzip imagenet100_data.zip - fi + cd ${cache_dir}/benchmark_data + mkdir dataset && cd dataset + wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/Bert.zip + unzisetp Bert.zip + wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/imagenet100_data.zip + unzip imagenet100_data.zip } function run_model_benchmark { cd ${cache_dir}/benchmark_data - if [ -d "benchmark" ];then rm -rf benchmark - fi - git clone --recurse-submodules=PaddleClas --recurse-submodules=PaddleNLP https://github.com/paddlepaddle/benchmark.git export data_path=${cache_dir}/benchmark_data/dataset export BENCHMARK_ROOT=${cache_dir}/benchmark_data/benchmark cd ${BENCHMARK_ROOT}/scripts/benchmark_ci - bash model_ci.sh + bash -x model_ci.sh } case $1 in From 1411246b2c6c9d17f74cd8c94bb0ddc1c94c9941 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Thu, 29 Jul 2021 16:43:59 +0800 Subject: [PATCH 04/12] notest;benchmark-cpu --- tools/test_model_benchmark.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index f1d62e8f6f072..fc2a9d207bd2a 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -54,8 +54,7 @@ function compile_install_paddle { export WITH_TESTING=OFF export WITH_UNITY_BUILD=ON check_whl - cd ${cache_dir} - mkdir benchmark_data && cd benchmark_data + cd ${cache_dir} && mkdir benchmark_data && cd benchmark_data git clone --recurse-submodules=PaddleClas --recurse-submodules=PaddleNLP https://github.com/paddlepaddle/benchmark.git } From 5a0ffe34cfff5b4565d0bf8eaed0e8aa65152c34 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Sat, 31 Jul 2021 14:57:13 +0800 Subject: [PATCH 05/12] notest;benchmark-cpu --- tools/test_model_benchmark.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index fc2a9d207bd2a..0a8a32f229246 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -59,12 +59,17 @@ function compile_install_paddle { } function prepare_data { - cd ${cache_dir}/benchmark_data - mkdir dataset && cd dataset - wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/Bert.zip - unzisetp Bert.zip - wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/imagenet100_data.zip - unzip imagenet100_data.zip + cd ${cache_dir} + if [ -d "benchmark_data" ];then + echo -e "benchmark_data exist!" + else + mkdir benchmark_data && cd benchmark_data + mkdir dataset && cd dataset + wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/Bert.zip + unzip Bert.zip + wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/imagenet100_data.zip + unzip imagenet100_data.zip + fi } function run_model_benchmark { From 70c6a9c7ce663bcf8c81515546b4501b8679c65b Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Sat, 31 Jul 2021 16:17:45 +0800 Subject: [PATCH 06/12] notest;benchmark-cpu --- tools/test_model_benchmark.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index 0a8a32f229246..d34c51a4e101d 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -54,7 +54,7 @@ function compile_install_paddle { export WITH_TESTING=OFF export WITH_UNITY_BUILD=ON check_whl - cd ${cache_dir} && mkdir benchmark_data && cd benchmark_data + cd /workspace/Paddle git clone --recurse-submodules=PaddleClas --recurse-submodules=PaddleNLP https://github.com/paddlepaddle/benchmark.git } @@ -75,7 +75,7 @@ function prepare_data { function run_model_benchmark { cd ${cache_dir}/benchmark_data export data_path=${cache_dir}/benchmark_data/dataset - export BENCHMARK_ROOT=${cache_dir}/benchmark_data/benchmark + export BENCHMARK_ROOT=/workspace/Paddle/benchmark cd ${BENCHMARK_ROOT}/scripts/benchmark_ci bash -x model_ci.sh } From b99ab9439c130b27137f7b606145d9962cf192a8 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Sat, 31 Jul 2021 19:30:16 +0800 Subject: [PATCH 07/12] notest;benchmark-cpu --- tools/test_model_benchmark.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index d34c51a4e101d..21419b91f6d4f 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -20,6 +20,7 @@ function check_whl { [ $? -ne 0 ] && echo "build paddle failed." && exit 1 pip uninstall -y paddlepaddle_gpu pip install build/python/dist/*.whl + mkdir build/pr_whl && cp build/python/dist/*.whl build/pr_whl [ $? -ne 0 ] && echo "install paddle failed." && exit 1 mkdir -p /tmp/pr && mkdir -p /tmp/develop @@ -32,6 +33,7 @@ function check_whl { [ $? -ne 0 ] && echo "install paddle failed." && exit 1 cd build unzip -q python/dist/*.whl -d /tmp/develop + mkdir build/dev_whl && cp build/python/dist/*.whl build/dev_whl sed -i '/version.py/d' /tmp/pr/*/RECORD sed -i '/version.py/d' /tmp/develop/*/RECORD @@ -73,6 +75,7 @@ function prepare_data { } function run_model_benchmark { + pip install build/pr_whl/*.whl cd ${cache_dir}/benchmark_data export data_path=${cache_dir}/benchmark_data/dataset export BENCHMARK_ROOT=/workspace/Paddle/benchmark From 71f873fcb0cca90d1107ed21b22b1f9e5da05384 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Sat, 31 Jul 2021 19:54:01 +0800 Subject: [PATCH 08/12] notest;benchmark-cpu --- tools/test_model_benchmark.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index 21419b91f6d4f..67daaaa92c4fa 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -75,6 +75,7 @@ function prepare_data { } function run_model_benchmark { + cd /workspace/Paddle pip install build/pr_whl/*.whl cd ${cache_dir}/benchmark_data export data_path=${cache_dir}/benchmark_data/dataset From 69818b90b225f8b276a550b18bafc33f10261d67 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Sat, 31 Jul 2021 20:31:27 +0800 Subject: [PATCH 09/12] notest;benchmark-cpu --- tools/test_model_benchmark.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index 67daaaa92c4fa..25f954bdd6528 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -81,7 +81,7 @@ function run_model_benchmark { export data_path=${cache_dir}/benchmark_data/dataset export BENCHMARK_ROOT=/workspace/Paddle/benchmark cd ${BENCHMARK_ROOT}/scripts/benchmark_ci - bash -x model_ci.sh + bash model_ci.sh } case $1 in From 80f17c2bfce5e2701a8e426003bcef9045a26747 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Sat, 31 Jul 2021 20:31:49 +0800 Subject: [PATCH 10/12] fix --- tools/test_model_benchmark.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index 25f954bdd6528..11b2f0f66f102 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -33,7 +33,6 @@ function check_whl { [ $? -ne 0 ] && echo "install paddle failed." && exit 1 cd build unzip -q python/dist/*.whl -d /tmp/develop - mkdir build/dev_whl && cp build/python/dist/*.whl build/dev_whl sed -i '/version.py/d' /tmp/pr/*/RECORD sed -i '/version.py/d' /tmp/develop/*/RECORD From c42bf671a2ac7151c82e121b53429db5f0176c54 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Sat, 31 Jul 2021 22:12:11 +0800 Subject: [PATCH 11/12] fix --- tools/test_model_benchmark.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index 11b2f0f66f102..ae2d4458efdb1 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -92,7 +92,8 @@ case $1 in run_model_benchmark ;; *) - echo "Error: Incorrect or no parameters" - exit 1 + compile_install_paddle + prepare_data + run_model_benchmark ;; esac From 4525b4012e9042f10c30e76249df1e74ab00e546 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Mon, 2 Aug 2021 10:35:25 +0800 Subject: [PATCH 12/12] add test_ci_model_benchmark.sh --- tools/test_ci_model_benchmark.sh | 99 ++++++++++++++++++++++++++++++++ tools/test_model_benchmark.sh | 33 ++++------- 2 files changed, 110 insertions(+), 22 deletions(-) create mode 100644 tools/test_ci_model_benchmark.sh diff --git a/tools/test_ci_model_benchmark.sh b/tools/test_ci_model_benchmark.sh new file mode 100644 index 0000000000000..ae2d4458efdb1 --- /dev/null +++ b/tools/test_ci_model_benchmark.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +function check_whl { + bash -x paddle/scripts/paddle_build.sh build + [ $? -ne 0 ] && echo "build paddle failed." && exit 1 + pip uninstall -y paddlepaddle_gpu + pip install build/python/dist/*.whl + mkdir build/pr_whl && cp build/python/dist/*.whl build/pr_whl + [ $? -ne 0 ] && echo "install paddle failed." && exit 1 + + mkdir -p /tmp/pr && mkdir -p /tmp/develop + unzip -q build/python/dist/*.whl -d /tmp/pr + rm -f build/python/dist/*.whl && rm -f build/python/build/.timestamp + + git checkout . + git checkout -b develop_base_pr upstream/$BRANCH + bash -x paddle/scripts/paddle_build.sh build + [ $? -ne 0 ] && echo "install paddle failed." && exit 1 + cd build + unzip -q python/dist/*.whl -d /tmp/develop + + sed -i '/version.py/d' /tmp/pr/*/RECORD + sed -i '/version.py/d' /tmp/develop/*/RECORD + diff_whl=`diff /tmp/pr/*/RECORD /tmp/develop/*/RECORD|wc -l` + if [ ${diff_whl} -eq 0 ];then + echo "paddle whl does not diff in PR-CI-Model-benchmark, so skip this ci" + echo "ipipe_log_param_isSkipTest_model_benchmark: 1" + exit 0 + else + echo "ipipe_log_param_isSkipTest_model_benchmark: 0" + fi +} + +function compile_install_paddle { + export CUDA_ARCH_NAME=Auto + export PY_VERSION=3.7 + export WITH_DISTRIBUTE=OFF + export WITH_GPU=ON + export WITH_TENSORRT=OFF + export WITH_TESTING=OFF + export WITH_UNITY_BUILD=ON + check_whl + cd /workspace/Paddle + git clone --recurse-submodules=PaddleClas --recurse-submodules=PaddleNLP https://github.com/paddlepaddle/benchmark.git +} + +function prepare_data { + cd ${cache_dir} + if [ -d "benchmark_data" ];then + echo -e "benchmark_data exist!" + else + mkdir benchmark_data && cd benchmark_data + mkdir dataset && cd dataset + wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/Bert.zip + unzip Bert.zip + wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/imagenet100_data.zip + unzip imagenet100_data.zip + fi +} + +function run_model_benchmark { + cd /workspace/Paddle + pip install build/pr_whl/*.whl + cd ${cache_dir}/benchmark_data + export data_path=${cache_dir}/benchmark_data/dataset + export BENCHMARK_ROOT=/workspace/Paddle/benchmark + cd ${BENCHMARK_ROOT}/scripts/benchmark_ci + bash model_ci.sh +} + +case $1 in + whl_check) + compile_install_paddle + ;; + run_benchmark) + prepare_data + run_model_benchmark + ;; + *) + compile_install_paddle + prepare_data + run_model_benchmark + ;; +esac diff --git a/tools/test_model_benchmark.sh b/tools/test_model_benchmark.sh index ae2d4458efdb1..98066d7beeaa7 100644 --- a/tools/test_model_benchmark.sh +++ b/tools/test_model_benchmark.sh @@ -20,7 +20,6 @@ function check_whl { [ $? -ne 0 ] && echo "build paddle failed." && exit 1 pip uninstall -y paddlepaddle_gpu pip install build/python/dist/*.whl - mkdir build/pr_whl && cp build/python/dist/*.whl build/pr_whl [ $? -ne 0 ] && echo "install paddle failed." && exit 1 mkdir -p /tmp/pr && mkdir -p /tmp/develop @@ -55,8 +54,6 @@ function compile_install_paddle { export WITH_TESTING=OFF export WITH_UNITY_BUILD=ON check_whl - cd /workspace/Paddle - git clone --recurse-submodules=PaddleClas --recurse-submodules=PaddleNLP https://github.com/paddlepaddle/benchmark.git } function prepare_data { @@ -64,8 +61,10 @@ function prepare_data { if [ -d "benchmark_data" ];then echo -e "benchmark_data exist!" else - mkdir benchmark_data && cd benchmark_data - mkdir dataset && cd dataset + mkdir benchmark_data + cd benchmark_data + mkdir dataset + cd dataset wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/Bert.zip unzip Bert.zip wget --no-proxy -q https://paddle-qa.bj.bcebos.com/benchmark_data/imagenet100_data.zip @@ -74,26 +73,16 @@ function prepare_data { } function run_model_benchmark { - cd /workspace/Paddle - pip install build/pr_whl/*.whl cd ${cache_dir}/benchmark_data + if [ -d "benchmark" ];then rm -rf benchmark + fi + git clone --recurse-submodules=PaddleClas --recurse-submodules=PaddleNLP https://github.com/paddlepaddle/benchmark.git export data_path=${cache_dir}/benchmark_data/dataset - export BENCHMARK_ROOT=/workspace/Paddle/benchmark + export BENCHMARK_ROOT=${cache_dir}/benchmark_data/benchmark cd ${BENCHMARK_ROOT}/scripts/benchmark_ci bash model_ci.sh } -case $1 in - whl_check) - compile_install_paddle - ;; - run_benchmark) - prepare_data - run_model_benchmark - ;; - *) - compile_install_paddle - prepare_data - run_model_benchmark - ;; -esac +compile_install_paddle +prepare_data +run_model_benchmark