forked from PaddlePaddle/Paddle
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (150 loc) · 6.45 KB
/
_Api-Benchmark.yml
File metadata and controls
159 lines (150 loc) · 6.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Api-Benchmark
on:
workflow_call:
inputs:
docker_build_image:
type: string
required: true
can-skip:
type: string
required: false
baseline:
type: string
required: false
default: "false"
MANUALLY_PR_ID:
type: string
required: false
MANUALLY_COMMIT_ID:
type: string
required: false
run-labels:
type: string
required: false
default: "api-bm"
env:
PR_ID: ${{ github.event.pull_request.number || '0' }}
COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }}
work_dir: /paddle
PADDLE_ROOT: /paddle
TASK: paddle-CI-${{ github.event.pull_request.number }}-api-benchmark
ci_scripts: /paddle/ci
BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}
CI_name: api-benchmark
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
defaults:
run:
shell: bash
jobs:
check-bypass:
name: Check bypass
if: ${{ inputs.can-skip != 'true' }}
uses: ./.github/workflows/check-bypass.yml
with:
workflow-name: 'api-benchmark'
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
data-storage:
name: Performance data storage
needs: check-bypass
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
runs-on:
group: Api-bm
labels: [self-hosted, "${{ inputs.run-labels }}"]
steps:
- name: Determine the runner
run: |
docker_image=${{ inputs.docker_build_image }}
echo "docker_image=${docker_image}" >> $GITHUB_ENV
docker run -i --rm -v ${{ github.workspace }}:/paddle -w /paddle $docker_image /bin/bash -c 'rm -rf * .[^.]*'
cp -r /home/PTSTools .
runner_name=`(echo $PWD|awk -F '/' '{print $4}')`
echo $runner_name
core_index=-1
if [ $runner_name == "paddle-1" ];then
core_index=0
elif [ $runner_name == "paddle-2" ];then
core_index=8
fi
echo "core_index=${core_index}" >> $GITHUB_ENV
- name: Check docker image and run container
env:
python: "python3.10"
GIT_PR_ID: ${{ github.event.pull_request.number || '0' }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_ID: ${{ github.run_id }}
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
run: |
container_name=${TASK}-${core_index}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
docker container ls -a --filter "name=paddle-CI-*-api-benchmark-${core_index}*" --format "{{.ID}}" | xargs -r docker rm -f
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
docker run -d -t --name ${container_name} --shm-size=128g \
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
-v ${{ github.workspace }}:/paddle \
-e python \
-e core_index \
-e BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e RUN_ID \
-e wheel_link \
-e work_dir \
-e PADDLE_ROOT \
-e ci_scripts \
-e GIT_PR_ID \
-e PADDLE_VERSION \
-e no_proxy \
-e CI_name \
-e GITHUB_API_TOKEN \
-w /paddle --network host ${docker_image}
- name: Download PaddleTest.tar.gz
env:
work_dir: ${{ github.workspace }}
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
ldconfig
set -e
echo "Downloading PaddleTest.tar.gz"
wget -q --tries=5 --no-proxy https://xly-devops.bj.bcebos.com/PaddleTest/PaddleTest.tar.gz --no-check-certificate
echo "Extracting PaddleTest.tar.gz"
# git config --global --add safe.directory ${work_dir}
tar -zvxf PaddleTest.tar.gz 1>/dev/null 2>&1
# git submodule foreach "git config --global --add safe.directory \$toplevel/\$sm_path"
source ${{ github.workspace }}/../../../proxy
mkdir -p ${{ github.workspace }}/../../../pip
${python} -m pip config set global.cache-dir ${{ github.workspace }}/../../../pip
${python} -m pip install -r ./PaddleTest/framework/e2e/api_benchmark_new/requirement.txt
'
- name: Paddletest check
env:
work_dir: ${{ github.workspace }}
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c '
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}
cd ./PaddleTest/framework/e2e/api_benchmark_new
cp /paddle/PTSTools/Uploader/apibm_config.yml .
source ${{ github.workspace }}/../../../proxy
if [[ "${{ inputs.baseline }}" == "true" ]];then
set -e
if [[ "${{ inputs.MANUALLY_PR_ID }}" == "" ]]; then
export pr_wheel_link=https://paddle-github-action.bj.bcebos.com/PR/build/$PR_ID/$COMMIT_ID/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
else
export pr_wheel_link=https://paddle-github-action.bj.bcebos.com/PR/build/${{ inputs.MANUALLY_PR_ID }}/${{ inputs.MANUALLY_COMMIT_ID }}/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
fi
${python} -m pip install $pr_wheel_link
${python} runner_ci_multipro_action.py --yaml ../yaml/sort_api_benchmark_fp32.yml --core_index ${core_index} --baseline_whl_link $pr_wheel_link
exit 0
fi
${python} -m pip install $wheel_link
if [ ${core_index} -eq -1 ];then
${python} runner_ci_action.py --yaml ../yaml/api_benchmark_fp32.yml --core_index 2
else
${python} runner_ci_multipro_action.py --yaml ../yaml/sort_api_benchmark_fp32.yml --core_index ${core_index}
fi
'
- name: Terminate and delete the container
if: always()
run: |
docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*'
docker rm -f ${{ env.container_name }}