Skip to content

Commit 13df625

Browse files
authored
[CI] Add Api-Benchmark (#72647)
* test=document_fix * add api-bm * bypass * bypass * bypass * docker * bypass * docker * test=document_fix images * pip * rerun * pip * pip * all * test=document_fix * test=document_fix * test=document_fix bypass * test=document_fix no rm
1 parent 0f96e01 commit 13df625

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed

.github/workflows/CI.yml

+8
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,11 @@ jobs:
7777
with:
7878
can-skip: ${{ needs.build.outputs.can-skip }}
7979
docker_build_image: ${{ needs.build-docker.outputs.docker_build_image }}
80+
81+
api-benchmark:
82+
name: Api-Benchmark
83+
uses: ./.github/workflows/_Api-Benchmark.yml
84+
needs: [build-docker, build]
85+
with:
86+
can-skip: ${{ needs.build.outputs.can-skip }}
87+
docker_build_image: ${{ needs.build-docker.outputs.docker_build_image }}

.github/workflows/_Api-Benchmark.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Api-Benchmark
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
docker_build_image:
7+
type: string
8+
required: true
9+
can-skip:
10+
type: string
11+
required: false
12+
13+
env:
14+
PR_ID: ${{ github.event.pull_request.number }}
15+
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
16+
work_dir: /paddle
17+
PADDLE_ROOT: /paddle
18+
TASK: paddle-CI-${{ github.event.pull_request.number }}-api-benchmark
19+
ci_scripts: /paddle/ci
20+
BRANCH: ${{ github.event.pull_request.base.ref }}
21+
CI_name: api-benchmark
22+
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
23+
24+
defaults:
25+
run:
26+
shell: bash
27+
28+
jobs:
29+
check-bypass:
30+
name: Check bypass for Api-Benchmark
31+
uses: ./.github/workflows/check-bypass.yml
32+
with:
33+
workflow-name: 'api-bm'
34+
secrets:
35+
github-token: ${{ secrets.GITHUB_TOKEN }}
36+
37+
data-storage:
38+
name: Performance data storage
39+
needs: check-bypass
40+
if: ${{ inputs.can-skip != 'true' && needs.check-bypass.outputs.can-skip != 'true' }}
41+
runs-on:
42+
group: Api-bm
43+
steps:
44+
- name: Determine the runner
45+
run: |
46+
sudo rm -rf * .[^.]*
47+
cp -r /home/PTSTools .
48+
runner_name=`(echo $PWD|awk -F '/' '{print $4}')`
49+
echo $runner_name
50+
core_index=-1
51+
if [ $runner_name == "paddle-1" ];then
52+
core_index=0
53+
elif [ $runner_name == "paddle-2" ];then
54+
core_index=8
55+
fi
56+
echo "core_index=${core_index}" >> $GITHUB_ENV
57+
58+
- name: Check docker image and run container
59+
env:
60+
python: "python3.10"
61+
GIT_PR_ID: ${{ github.event.pull_request.number }}
62+
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
RUN_ID: ${{ github.run_id }}
64+
wheel_link: https://paddle-github-action.bj.bcebos.com/PR/build/${{ github.event.pull_request.number }}/${{ github.event.pull_request.head.sha }}/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
65+
run: |
66+
container_name=${TASK}-${core_index}-$(date +%Y%m%d-%H%M%S)
67+
echo "container_name=${container_name}" >> ${{ github.env }}
68+
docker_image=${{ inputs.docker_build_image }}
69+
docker container ls -a --filter "name=paddle-CI-*-api-benchmark-${core_index}*" --format "{{.ID}}" | xargs -r docker rm -f
70+
docker container ls -a --filter "name=api_benchmark_ci_baseline_" --format "{{.ID}} {{.CreatedAt}}" | awk '$2 <= "'$(date -d '1 day ago' +'%Y-%m-%d')'" {print $1}' | xargs -r docker rm -f
71+
docker run -d -t --name ${container_name} --privileged --shm-size=128g \
72+
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
73+
-v ${{ github.workspace }}:/paddle \
74+
-e python \
75+
-e core_index \
76+
-e BRANCH \
77+
-e PR_ID \
78+
-e COMMIT_ID \
79+
-e RUN_ID \
80+
-e wheel_link \
81+
-e work_dir \
82+
-e PADDLE_ROOT \
83+
-e ci_scripts \
84+
-e GIT_PR_ID \
85+
-e PADDLE_VERSION \
86+
-e no_proxy \
87+
-e CI_name \
88+
-e GITHUB_API_TOKEN \
89+
-w /paddle --network host ${docker_image}
90+
91+
- name: Download PaddleTest.tar.gz
92+
env:
93+
work_dir: ${{ github.workspace }}
94+
run: |
95+
docker exec -t ${{ env.container_name }} /bin/bash -c '
96+
ldconfig
97+
set -e
98+
echo "Downloading PaddleTest.tar.gz"
99+
wget -q --no-proxy https://xly-devops.bj.bcebos.com/PaddleTest/PaddleTest.tar.gz --no-check-certificate
100+
echo "Extracting PaddleTest.tar.gz"
101+
# git config --global --add safe.directory ${work_dir}
102+
tar -zvxf PaddleTest.tar.gz 1>/dev/null 2>&1
103+
# git submodule foreach "git config --global --add safe.directory \$toplevel/\$sm_path"
104+
source ${{ github.workspace }}/../../../proxy
105+
${python} -m pip install -r ./PaddleTest/framework/e2e/api_benchmark_new/requirement.txt
106+
'
107+
108+
- name: Paddletest check
109+
env:
110+
work_dir: ${{ github.workspace }}
111+
run: |
112+
docker exec -t ${{ env.container_name }} /bin/bash -c '
113+
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/compat:/usr/local/cuda/compat:/usr/local/cuda/lib:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}
114+
cd ./PaddleTest/framework/e2e/api_benchmark_new
115+
cp /paddle/PTSTools/Uploader/apibm_config.yml .
116+
${python} -m pip install https://paddle-github-action.bj.bcebos.com/PR/build/${PR_ID}/${COMMIT_ID}/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
117+
if [ ${core_index} -eq -1 ];then
118+
${python} runner_ci_action.py --yaml ../yaml/api_benchmark_fp32.yml --core_index 2
119+
else
120+
${python} runner_ci_multipro_action.py --yaml ../yaml/sort_api_benchmark_fp32.yml --core_index ${core_index}
121+
fi
122+
'
123+
124+
- name: Terminate and delete the container
125+
if: always()
126+
run: |
127+
sudo rm -rf * .[^.]*
128+
docker rm -f ${{ env.container_name }}

0 commit comments

Comments
 (0)