Skip to content

Commit 344cce3

Browse files
swgu98Luckycheng222
authored andcommitted
[CI] add api-bm baseline (PaddlePaddle#74690)
* add api-bm baseline * test matrix * rollback * api baseline * time
1 parent 3e3449a commit 344cce3

File tree

2 files changed

+127
-3
lines changed

2 files changed

+127
-3
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Api-benchmark-baseline
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
PR_ID:
7+
required: false
8+
type: string
9+
COMMIT_ID:
10+
required: false
11+
type: string
12+
job-name:
13+
required: true
14+
default: 'api-benchmark'
15+
type: choice
16+
options:
17+
- api-benchmark
18+
- others
19+
schedule:
20+
- cron: '0 21 * * *'
21+
- cron: '0 22 * * 3'
22+
23+
permissions: read-all
24+
25+
defaults:
26+
run:
27+
shell: bash
28+
29+
jobs:
30+
clone:
31+
name: Api benchmark clone
32+
if: github.event.schedule == '0 21 * * *'
33+
uses: ./.github/workflows/_Clone-linux.yml
34+
with:
35+
clone_dir: Paddle-build
36+
is_pr: 'false'
37+
38+
build-docker:
39+
name: Api benchmark build docker
40+
if: github.event.schedule == '0 21 * * *'
41+
needs: clone
42+
uses: ./.github/workflows/docker.yml
43+
with:
44+
clone_dir: Paddle-build
45+
task: build
46+
47+
build:
48+
name: Api benchmark build
49+
if: github.event.schedule == '0 21 * * *'
50+
needs: [clone, build-docker]
51+
uses: ./.github/workflows/_Linux-build.yml
52+
with:
53+
docker_build_image: ${{ needs.build-docker.outputs.docker_build_image }}
54+
is_pr: 'false'
55+
56+
api-benchmark-baseline:
57+
name: Api benchmark baseline
58+
if: github.event.schedule == '0 21 * * *' || github.event.inputs.job-name == 'api-benchmark'
59+
strategy:
60+
matrix:
61+
run-labels: [api-bm-20, api-bm-27]
62+
uses: ./.github/workflows/_Api-Benchmark.yml
63+
needs: [clone, build-docker, build]
64+
with:
65+
docker_build_image: ${{ needs.build-docker.outputs.docker_build_image }}
66+
baseline: 'true'
67+
MANUALLY_PR_ID: ${{ inputs.PR_ID }}
68+
MANUALLY_COMMIT_ID: ${{ inputs.COMMIT_ID }}
69+
run-labels: ${{ matrix.run-labels }}
70+
71+
test1:
72+
runs-on: ubuntu-latest
73+
if: github.event.schedule == '0 0 * * *'
74+
steps:
75+
- name: Test
76+
run: |
77+
echo "test1"
78+
79+
test2:
80+
runs-on: ubuntu-latest
81+
if: github.event.schedule == '0 21 * * *'
82+
steps:
83+
- name: Test
84+
run: |
85+
echo "test2"
86+
87+
test3:
88+
runs-on: ubuntu-latest
89+
if: github.event.schedule == '0 22 * * 3'
90+
steps:
91+
- name: Test
92+
run: |
93+
echo "test3"
94+
95+
test4:
96+
runs-on: ubuntu-latest
97+
if: github.event.schedule == '0 21 * * 1'
98+
steps:
99+
- name: Test
100+
run: |
101+
echo "test4"

.github/workflows/_Api-Benchmark.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,24 @@ on:
99
can-skip:
1010
type: string
1111
required: false
12+
baseline:
13+
type: string
14+
required: false
15+
default: "false"
16+
MANUALLY_PR_ID:
17+
type: string
18+
required: false
19+
MANUALLY_COMMIT_ID:
20+
type: string
21+
required: false
22+
run-labels:
23+
type: string
24+
required: false
25+
default: "api-bm"
1226

1327
env:
14-
PR_ID: ${{ github.event.pull_request.number }}
15-
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
28+
PR_ID: ${{ github.event.pull_request.number || '0' }}
29+
COMMIT_ID: ${{ github.event.pull_request.head.sha || github.sha }}
1630
work_dir: /paddle
1731
PADDLE_ROOT: /paddle
1832
TASK: paddle-CI-${{ github.event.pull_request.number }}-api-benchmark
@@ -41,6 +55,7 @@ jobs:
4155
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
4256
runs-on:
4357
group: Api-bm
58+
labels: [self-hosted, "${{ inputs.run-labels }}"]
4459
steps:
4560
- name: Determine the runner
4661
run: |
@@ -118,7 +133,15 @@ jobs:
118133
cd ./PaddleTest/framework/e2e/api_benchmark_new
119134
cp /paddle/PTSTools/Uploader/apibm_config.yml .
120135
source ${{ github.workspace }}/../../../proxy
121-
${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
136+
${python} -m pip install $wheel_link
137+
if [[ "${{ inputs.baseline }}" == "true" ]];then
138+
if [[ "${{ inputs.MANUALLY_PR_ID }}" == "" ]]; then
139+
${python} runner_ci_action.py --yaml ../yaml/api_benchmark_fp32.yml --baseline_whl_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
140+
else
141+
${python} runner_ci_action.py --yaml ../yaml/api_benchmark_fp32.yml --baseline_whl_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
142+
fi
143+
exit 0
144+
fi
122145
if [ ${core_index} -eq -1 ];then
123146
${python} runner_ci_action.py --yaml ../yaml/api_benchmark_fp32.yml --core_index 2
124147
else

0 commit comments

Comments
 (0)