Benchmarks #207
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow periodically runs the benchmarks suite in benchmarks/ | |
# using asv and publish the results, effectively updating | |
# the display website hosted in the pybamm-bench repo | |
# Steps: | |
# - Benchmark all commits since the last one that was benchmarked | |
# - Push results to pybamm-bench repo | |
# - Publish website | |
name: Benchmarks | |
on: | |
# Every day at 3 am UTC | |
schedule: | |
- cron: "0 3 * * *" | |
# Make it possible to trigger the | |
# workflow manually | |
workflow_dispatch: | |
env: | |
PYBAMM_DISABLE_TELEMETRY: "true" | |
jobs: | |
benchmarks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: 3.12 | |
- name: Install Linux system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install gfortran gcc libopenblas-dev | |
- name: Set up uv | |
run: python -m pip install uv | |
- name: Install python dependencies | |
run: | | |
python -m uv pip install --upgrade pip wheel setuptools wget cmake casadi numpy | |
python -m uv pip install asv[virtualenv] | |
- name: Install SuiteSparse and SUNDIALS | |
run: python scripts/install_KLU_Sundials.py | |
- name: Run benchmarks | |
run: | | |
asv machine --machine "GitHubRunner" | |
asv run --machine "GitHubRunner" NEW --show-stderr -v | |
env: | |
SUNDIALS_INST: $HOME/.local | |
LD_LIBRARY_PATH: $HOME/.local/lib | |
- name: Upload results as artifact | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: asv_periodic_results | |
path: results | |
if-no-files-found: error | |
publish-results: | |
if: github.repository == 'pybamm-team/PyBaMM' | |
name: Push and publish results | |
needs: benchmarks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: 3.12 | |
- name: Install asv | |
run: pip install asv | |
- name: Checkout pybamm-bench repo | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
repository: pybamm-team/pybamm-bench | |
token: ${{ secrets.BENCH_PAT }} | |
- name: Download results artifact(s) | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
path: results | |
merge-multiple: true | |
- name: Copy new results and push to pybamm-bench repo | |
env: | |
PUSH_BENCH_EMAIL: ${{ secrets.PUSH_BENCH_EMAIL }} | |
PUSH_BENCH_NAME: ${{ secrets.PUSH_BENCH_NAME }} | |
run: | | |
git config --global user.email "$PUSH_BENCH_EMAIL" | |
git config --global user.name "$PUSH_BENCH_NAME" | |
git add results | |
git commit -am "Add new results" | |
git push | |
- name: Publish results | |
run: | | |
asv publish | |
git fetch origin gh-pages:gh-pages | |
asv gh-pages |