Repository navigation
276 lines (268 loc) · 9.64 KB
/
Copy pathbenchmarks.yml
File metadata and controls
276 lines (268 loc) · 9.64 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
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# ------------------------------------------------------------------------------
# Copyright Matt Borland 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# ------------------------------------------------------------------------------
#
# Builds and runs test/benchmark_u256.cpp and test/benchmark_i256.cpp in release
# mode across the platforms documented on the two benchmark pages, and uploads
# one benchmarks-<os>-<arch> artifact per platform holding u256.json and
# i256.json.
#
# To refresh the documentation: download the artifacts, unpack the
# benchmarks-<os>-<arch> folders into doc/modules/ROOT/data, and run
# doc/render_benchmarks.py. It rewrites every table and plot from the data sets,
# taking the platform, compiler, and element count out of the data itself.
#
# The emulated jobs (s390x, ppc64le, ARM32) and the 32-bit jobs measure a smaller
# vector: QEMU is roughly an order of magnitude slower than native, and several
# 256-bit vectors of the default length do not fit in a 32-bit address space. The
# element count lands in the data set and is printed in the documentation, so the
# tables stay honest about what was measured.
#
# The comparison baseline is boost::multiprecision::uint256_t (int256_t for the
# signed driver), which every job gets from the Boost tree that
# setup_benchmarks.sh checks out. The second comparator is wide-integer's
# uintwide_t, which setup_benchmarks.sh checks out into that same tree at the
# WIDE_INTEGER_REF commit below; both are header only, so no job needs a package.
# There is no 256-bit Abseil type to compare against.
#
# Every pull request gets a full set of runs: the step summary of each job
# compares the fresh numbers against the ones committed under
# doc/modules/ROOT/data, so a regression is visible without downloading
# anything, and the artifacts of that same run are what you unpack to publish
# the new numbers. The comparison never fails a job; these are shared runners
# and a few percent either way is noise.
#
# workflow_dispatch only shows up in the Actions tab once this file is on the
# default branch. Until then, use a pull request (which runs the version of the
# workflow on the branch) or push to a benchmarks/** branch.
name: Run Benchmarks
on:
workflow_dispatch:
inputs:
elements:
description: Values per vector on the native 64-bit runners
default: '10000000'
emulated_elements:
description: Values per vector on the emulated runners
default: '1000000'
repetitions:
description: Passes over each vector
default: '5'
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- benchmarks
- benchmarks/**
# Keyed on the branch rather than the ref so that a new push to a pull request
# cancels the runs still going for the previous one.
concurrency:
group: ${{ format('{0}:{1}:benchmarks', github.repository, github.head_ref || github.ref) }}
cancel-in-progress: true
env:
GIT_FETCH_JOBS: 8
ELEMENTS: ${{ inputs.elements || '10000000' }}
EMULATED_ELEMENTS: ${{ inputs.emulated_elements || '1000000' }}
REPETITIONS: ${{ inputs.repetitions || '5' }}
# The wide-integer commit every job measures, master at the time of writing.
# Move it deliberately, and republish, so runs stay comparable.
WIDE_INTEGER_REF: '5c0d550088862e804f10d9a5f00e5c0f73d87c3f'
jobs:
linux:
name: ${{ matrix.title }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- title: Linux x64
os: ubuntu-latest
arch: x64
compiler: g++-14
packages: g++-14
cxxflags: ''
ldflags: ''
elements: ''
- title: Linux x86 (32-bit)
os: ubuntu-latest
arch: x86
compiler: g++-14
packages: g++-14 g++-14-multilib
cxxflags: '-m32'
ldflags: ''
elements: '5000000'
- title: Linux ARM64
os: ubuntu-24.04-arm
arch: arm64
compiler: g++-14
packages: g++-14
cxxflags: ''
ldflags: ''
elements: ''
steps:
- uses: actions/checkout@v6
- name: Install packages
run: |
sudo apt-get -o Acquire::Retries=5 update
sudo apt-get -o Acquire::Retries=5 install -y ${{ matrix.packages }}
- name: Setup Boost
run: .github/scripts/setup_benchmarks.sh
- name: Build and run
run: |
cd "$BOOST_ROOT"
COUNT="${{ matrix.elements }}"
: "${COUNT:=$ELEMENTS}"
"$GITHUB_WORKSPACE/.github/scripts/run_benchmarks.sh" \
--compiler '${{ matrix.compiler }}' \
--cxxflags '${{ matrix.cxxflags }}' \
--ldflags '${{ matrix.ldflags }}' \
--elements "$COUNT" \
--repetitions "$REPETITIONS" \
--out "$GITHUB_WORKSPACE/bench-results"
- name: Compare with the published numbers
run: .github/scripts/compare_benchmarks.sh bench-results
- name: Upload results
uses: actions/upload-artifact@v6
with:
name: benchmarks-linux-${{ matrix.arch }}
path: bench-results
if-no-files-found: error
macos:
name: macOS ARM64
runs-on: macos-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- name: Setup Boost
run: .github/scripts/setup_benchmarks.sh
- name: Build and run
run: |
cd "$BOOST_ROOT"
"$GITHUB_WORKSPACE/.github/scripts/run_benchmarks.sh" \
--compiler clang++ \
--elements "$ELEMENTS" \
--repetitions "$REPETITIONS" \
--out "$GITHUB_WORKSPACE/bench-results"
- name: Compare with the published numbers
run: .github/scripts/compare_benchmarks.sh bench-results
- name: Upload results
uses: actions/upload-artifact@v6
with:
name: benchmarks-macos-arm64
path: bench-results
if-no-files-found: error
windows:
name: ${{ matrix.title }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- title: Windows x64
os: windows-latest
arch: x64
msvc_arch: x64
elements: ''
- title: Windows x86 (32-bit)
os: windows-latest
arch: x86
msvc_arch: x86
elements: '5000000'
- title: Windows ARM64
os: windows-11-arm
arch: arm64
msvc_arch: arm64
elements: ''
steps:
- uses: actions/checkout@v6
- name: Setup Boost
run: .github/scripts/setup_benchmarks.sh
- uses: ./.github/actions/setup-msvc
with:
arch: ${{ matrix.msvc_arch }}
- name: Build and run
run: |
cd "$BOOST_ROOT"
COUNT="${{ matrix.elements }}"
: "${COUNT:=$ELEMENTS}"
"$GITHUB_WORKSPACE/.github/scripts/run_benchmarks.sh" \
--msvc \
--elements "$COUNT" \
--repetitions "$REPETITIONS" \
--out "$GITHUB_WORKSPACE/bench-results"
- name: Compare with the published numbers
run: .github/scripts/compare_benchmarks.sh bench-results
- name: Upload results
uses: actions/upload-artifact@v6
with:
name: benchmarks-windows-${{ matrix.arch }}
path: bench-results
if-no-files-found: error
emulated:
name: ${{ matrix.title }}
runs-on: ubuntu-latest
timeout-minutes: 360
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- title: Linux s390x (emulated)
arch: s390x
platform: linux/s390x
image: s390x/debian:bookworm
packages: g++
ldflags: ''
- title: Linux ppc64le (emulated)
arch: ppc64le
platform: linux/ppc64le
image: debian:bookworm
packages: g++
ldflags: ''
- title: Linux ARM32 (emulated)
arch: arm32
platform: linux/arm/v7
image: debian:bookworm
packages: g++
ldflags: ''
steps:
- uses: actions/checkout@v6
- name: Setup Boost
run: .github/scripts/setup_benchmarks.sh
- uses: docker/setup-qemu-action@v4
- name: Build and run
run: |
# Create the output directory first so that docker does not, as root.
mkdir -p "$GITHUB_WORKSPACE/bench-results"
docker run --rm --platform ${{ matrix.platform }} \
-v "$BOOST_ROOT":/boost-root \
-v "$GITHUB_WORKSPACE/.github/scripts":/scripts:ro \
-v "$GITHUB_WORKSPACE/bench-results":/out \
-e DEBIAN_FRONTEND=noninteractive \
-w /boost-root ${{ matrix.image }} bash -c "
apt-get -o Acquire::Retries=5 update
apt-get -o Acquire::Retries=5 install -y ${{ matrix.packages }}
/scripts/run_benchmarks.sh --compiler g++ --ldflags '${{ matrix.ldflags }}' \
--elements $EMULATED_ELEMENTS --repetitions $REPETITIONS --out /out
"
- name: Compare with the published numbers
run: .github/scripts/compare_benchmarks.sh bench-results
- name: Upload results
uses: actions/upload-artifact@v6
with:
name: benchmarks-linux-${{ matrix.arch }}
path: bench-results
if-no-files-found: error