Skip to content

Commit ed11208

Browse files
committed
asv needs a commit to attribute the run to. Thus,
- point `asv` to the `tracker` branch - ensure the contents of this branch is equivalent to the current `main`. NB - commits in the `tracker` branch have links to `main` commits - OpenBLAS wheels into is listed in the commit messages in the `gh-pages` branch
1 parent b74a1c8 commit ed11208

File tree

4 files changed

+115
-32
lines changed

4 files changed

+115
-32
lines changed

.github/workflows/run_cirun_graviton.yml

+80-18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
schedule:
8+
- cron: "0 */1 * * *"
79

810
concurrency:
911
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -13,22 +15,52 @@ permissions:
1315
contents: read # to fetch code (actions/checkout)
1416

1517
env:
16-
# GITHUB_TOKEN: ${{ secrets.OB_BENCH_TOKEN }}
17-
# BENCHMARKS_REPO: ev-br/ob-bench-asv
1818
ASV_CONFIG: asv.conf.json
19+
NAME_PREFIX: gha
1920

2021
jobs:
22+
23+
trigger:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Check out the repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0 # To fetch all commits to be able to generate benchmarks html
30+
token: ${{ secrets.AWS_BENCHMARKS }}
31+
32+
- name: Prepare the tracker branch
33+
run: |
34+
git config --global user.email "project@openblas"
35+
git config --global user.name "OB benchmark bot"
36+
37+
# XXX this assumes the `tracker` branch is the squash-merge from main
38+
# revert the past merge and merge the current main instead
39+
# (cannot just merge main without a revert because force-pushes to main)
40+
git checkout tracker
41+
git revert HEAD --no-edit
42+
43+
# XXX needed locally not on CI?
44+
# git commit -am'revert squash-merging main'
45+
46+
git merge main --squash
47+
git commit -am"squash-merge main at `git rev-parse main`"
48+
git push origin HEAD
49+
git checkout main
50+
51+
2152
bench:
2253
strategy:
2354
fail-fast: false
2455
matrix:
2556
include:
2657
# define matrix.name to identify github actions machine as hostname changes everytime
2758
- image: "cirun-aws-runner-graviton--${{ github.run_id }}"
28-
name: "gh-graviton"
59+
name: "gha-aws-graviton"
2960
- image: "cirun-aws-runner-cascade-lake--${{ github.run_id }}"
30-
name: "gh-skylake"
61+
name: "gha-aws-skylake"
3162
runs-on: ${{ matrix.image }}
63+
needs: trigger
3264

3365
steps:
3466
- uses: actions/checkout@v4
@@ -58,16 +90,22 @@ jobs:
5890
run: |
5991
# --break-system-packages is required on ubuntu noble
6092
pip3 install "numpy<2" meson meson-python ninja build asv virtualenv --break-system-packages
93+
6194
# install the nightly OpenBLAS wheel
62-
pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple scipy-openblas32 --break-system-packages
95+
pip3 install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple scipy-openblas32 --break-system-packages
96+
97+
# dump the pkg-config for the ASV build to pick up (cf $PKG_CONFIG_PATH usage under `Run benchmarks`)
6398
python3 -c'import scipy_openblas32 as so; print(so.get_pkg_config())' > scipy_openblas.pc
64-
# export PKG_CONFIG_PATH=$PWD
6599
66100
- name: Print OpenBLAS information
67101
run: |
68102
echo "scipy_openblas.pc contents: "
69103
cat scipy_openblas.pc
70104
105+
# store the OpenBLAS wheel info to add to the gh-pages commit message
106+
echo ${{ matrix.name }}":" > wheel_info
107+
python3 -c'import scipy_openblas32 as sc; print(f"version={sc.__version__} - {sc.get_openblas_config()}")' >> wheel_info
108+
71109
- name: Set and log asv machine configuration
72110
run: |
73111
python3 -m asv machine --yes --config asv.conf.json
@@ -82,20 +120,25 @@ jobs:
82120
83121
- name: Run benchmarks
84122
run: |
123+
# asv fails to checkout tracker unless we help it a bit:
124+
git checkout tracker
125+
git checkout main
126+
git branch
127+
85128
python3 -m asv run --config $ASV_CONFIG -v
86-
ls -l .asv/results
87-
echo ">>> results/machine"
88-
ls -l .asv/results/${{ matrix.name }}
89129
env:
90130
PKG_CONFIG_PATH: ${{ github.workspace }}
91131

92132
- name: Store/Upload benchmark results
93133
uses: actions/upload-artifact@v4
94134
with:
95135
name: ${{ matrix.name }}
96-
path: .asv/results/*
136+
path: |
137+
.asv/results/*
138+
wheel_info
97139
if-no-files-found: error
98140

141+
99142
combine-and-publish:
100143
runs-on: ubuntu-latest
101144
needs: bench
@@ -112,17 +155,33 @@ jobs:
112155
- name: Collect past runs
113156
run: |
114157
git checkout gh-pages
115-
mkdir -p .asv/resuls
116-
cp -r results .asv/results
158+
mkdir -p .asv/results
159+
cp -r results .asv
117160
118161
- name: Combine the runs
119162
run: |
120-
cp -r gh-skylake/* .asv/results
121-
cp -r gh-graviton/* .asv/results
122-
ls -l
123-
ls -l .asv/results
163+
# NB artifact names start with gha-
164+
artifacts=`ls -d ./$NAME_PREFIX-*`
165+
echo "found ARTIFACTS = "$artifacts
166+
167+
# put the benchmark results to where asv expects them:
168+
# .asv/
169+
# results/
170+
# benchmarks.json
171+
# machine-name-1/
172+
# machine.json
173+
# commit_hash-1...json
174+
# machine-name-2/
175+
# machine.json
176+
# commit_hash-1...json
177+
for dir in $artifacts; do cp -r $dir/.asv/* .asv; done
178+
179+
# combine the wheel_info files from the artifacts
180+
for dir in $artifacts; do cat $dir/wheel_info >>./wheel_info; done
181+
cat wheel_info
182+
183+
# return to main to be able to generate the new html report
124184
git checkout main
125-
ls -l
126185
127186
- name: Set up Python
128187
uses: actions/setup-python@v4
@@ -131,6 +190,9 @@ jobs:
131190

132191
- name: Set up ASV and generate the html
133192
run: |
193+
git checkout tracker
194+
git checkout main
195+
134196
pip install asv
135197
asv machine --yes --config $ASV_CONFIG
136198
asv publish --config $ASV_CONFIG -v
@@ -145,5 +207,5 @@ jobs:
145207
git checkout gh-pages
146208
cp -r .asv/results results
147209
git add results/
148-
git commit -am"add results for `git rev-parse origin/gh-pages`"
210+
git commit -am"add results for `git rev-parse origin/gh-pages`" -m"`cat wheel_info`"
149211
git push origin HEAD

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
CI orchestration
2+
================
3+
4+
We run the benchmark suite on a cron schedule.
5+
6+
We use three branches:
7+
8+
- `main` : contains benchmark code, the BLAS/LAPACK wrappers etc. This is the branch
9+
you want to merge feature branches to;
10+
- `gh-pages` : contains the html site + the `results/` from past runs; This branch
11+
is auto-updated on each CI run from main;
12+
- `tracker` : `asv` benchmarks this branch. Mirrors `main`.
13+
Is auto-updated on each CI run.
14+
15+
The reason for this setup is that on each run, `asv`
16+
17+
- checks out the branch it benchmarks,
18+
- builds the project, and
19+
- labels the results by the top commit in that branch
20+
21+
Since we use the `scipy_openblas32` nightly builds, our main branch itself does
22+
not track changes in OpenBLAS (the wheels do).
23+
Were we to just benchmark `main`, all our runs would have been attributed
24+
to the same commit --- effectively, a new CI run would overwrite the previous one.
25+
26+
To sidestep this, on each CI run we point `asv` to the `tracker` branch, make it
27+
functionally equivalent to `main`, and add a new commit at the beginning of a CI
28+
benchmarking run.
29+
30+
31+
Running benchmarks locally
32+
==========================
33+
34+
135
To run the benchmark suite locally, first do
236

337
```

asv.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
// List of branches to benchmark. If not provided, defaults to "main"
4242
// (for git) or "default" (for mercurial).
43-
"branches": ["main"], // for git
43+
"branches": ["tracker"], // for git
4444
// "branches": ["default"], // for mercurial
4545

4646
// The DVCS being used. If not set, it will be automatically

scipy_openblas.pc

-13
This file was deleted.

0 commit comments

Comments
 (0)