-
Notifications
You must be signed in to change notification settings - Fork 1.2k
214 lines (184 loc) · 7.25 KB
/
benchmark.yml
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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.
name: "Ubuntu Benchmark"
on:
pull_request:
paths:
- '.github/workflows/benchmark.yml'
- 'scripts/benchmark-requirements.txt'
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
benchmark:
if: github.repository == 'facebookincubator/velox'
runs-on: 8-core-ubuntu-22.04
env:
CCACHE_DIR: "${{ github.workspace }}/ccache/"
CCACHE_BASEDIR: "${{ github.workspace }}"
BINARY_DIR: "${{ github.workspace }}/benchmarks/"
CONTENDER_OUTPUT_PATH: "${{ github.workspace }}/benchmark-results/contender/"
INSTALL_PREFIX: "${{ github.workspace }}/dependencies"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: 'velox'
submodules: 'recursive'
persist-credentials: false
- name: "Restore Dependencies"
uses: actions/cache/restore@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
id: restore-deps
with:
path: "${{ env.INSTALL_PREFIX }}"
key: dependencies-benchmark-${{ hashFiles('velox/scripts/setup-ubuntu.sh') }}
- name: "Install dependencies"
if: ${{ steps.restore-deps.outputs.cache-hit != 'true' }}
run: |
source velox/scripts/setup-ubuntu.sh
install_apt_deps
run_and_time install_fmt
run_and_time install_protobuf
run_and_time install_boost
run_and_time install_folly
run_and_time install_stemmer
run_and_time install_thrift
run_and_time install_arrow
- name: "Save Dependencies"
if: ${{ steps.restore-deps.outputs.cache-hit != 'true' }}
uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: "${{ env.INSTALL_PREFIX }}"
key: dependencies-${{ hashFiles('velox/scripts/setup-ubuntu.sh') }}
- name: "Restore ccache"
uses: apache/infrastructure-actions/stash/restore@3354c1565d4b0e335b78a76aedd82153a9e144d4
id: restore-cache
with:
path: "ccache"
key: ccache-benchmark
- name: Clear CCache Statistics
run: |
ccache -sz
- name: Build Contender Benchmarks
working-directory: velox
run: |
n_cores=$(nproc)
make benchmarks-basic-build NUM_THREADS=$n_cores MAX_HIGH_MEM_JOBS=$n_cores MAX_LINK_JOBS=$n_cores
mkdir -p ${BINARY_DIR}/contender/
cp -r --verbose _build/release/velox/benchmarks/basic/* ${BINARY_DIR}/contender/
- name: CCache after
run: |
ccache -vs
- name: "Save ccache"
uses: apache/infrastructure-actions/stash/save@3354c1565d4b0e335b78a76aedd82153a9e144d4
with:
path: "ccache"
key: ccache-benchmark
- name: "Install benchmark dependencies"
run: |
python3 -m pip install -r velox/scripts/benchmark-requirements.txt
- name: "Run Benchmarks - Contender"
working-directory: 'velox'
run: |
make benchmarks-basic-run \
EXTRA_BENCHMARK_FLAGS="--binary_path ${BINARY_DIR}/contender/ --output_path ${CONTENDER_OUTPUT_PATH}"
- name: "Upload result artifact"
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
with:
path: "benchmark-results"
name: "benchmark-results"
retention-days: 5
upload:
runs-on: ubuntu-latest
needs: benchmark
# if: github.event_name == 'push'
permissions:
actions: read
statuses: write
steps:
- name: Download artifacts
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
with:
merge-multiple: true
path: /tmp/artifacts/
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: velox
persist-credentials: false
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: "velox/scripts/*"
- name: "Install dependencies"
run: pip install -r velox/scripts/benchmark-requirements.txt
- name: "Upload results"
env:
CONBENCH_URL: "https://velox-conbench.voltrondata.run/"
CONBENCH_MACHINE_INFO_NAME: "GitHub-runner-8-core"
CONBENCH_EMAIL: "${{ secrets.CONBENCH_EMAIL }}"
CONBENCH_PASSWORD: "${{ secrets.CONBENCH_PASSWORD }}"
CONBENCH_PROJECT_REPOSITORY: "${{ github.repository }}"
CONBENCH_PROJECT_COMMIT: "${{ github.sha }}"
RUN_ID: "GHA-${{ github.run_id }}-${{ github.run_attempt }}"
run: |
./velox/scripts/benchmark-runner.py upload \
--run_id "$RUN_ID" \
--sha "$CONBENCH_PROJECT_COMMIT" \
--pr_number 12605 \
--output_dir "/tmp/artifacts/contender/"
- name: "Check the status of the upload"
# Status functions like failure() only work in `if:`
if: failure()
id: status
run: echo "failed=true" >> $GITHUB_OUTPUT
- name: "Create a GitHub Status on the contender commit (whether the upload was successful)"
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ !cancelled() && steps.extract.conclusion != 'failure' }}
with:
script: |
let url = 'https://github.com/${{github.repository}}/actions/runs/${{ github.run_id }}'
let state = 'success'
let description = 'Result upload succeeded!'
if(${{ steps.status.outputs.failed == 'true' && true || false }}) {
state = 'failure'
description = 'Result upload failed!'
}
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha
state: state,
target_url: url,
description: description,
context: 'Benchmark Result Upload'
})
- name: Create a GitHub Check benchmark report on the merged PR
env:
CONBENCH_URL: "https://velox-conbench.voltrondata.run/"
GITHUB_APP_ID: "${{ secrets.GH_APP_ID }}"
GITHUB_APP_PRIVATE_KEY: "${{ secrets.GH_APP_PRIVATE_KEY }}"
COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
CONTENDER_SHA: "${{ github.sha }}"
run: |
./velox/scripts/benchmark-alert.py \
--contender-sha "$CONTENDER_SHA" \
--merge-commit-message "$COMMIT_MESSAGE" \
--z-score-threshold 50