Skip to content

Commit

Permalink
Merge pull request pybamm-team#3379 from agriyakhetarpal/fix-benchmarks
Browse files Browse the repository at this point in the history
Fix periodic benchmarks and remove version cap on `asv`
  • Loading branch information
Saransh-cpp authored Sep 30, 2023
2 parents ad5f51c + 04713c6 commit 7eb5879
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/benchmark_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt install gfortran gcc libopenblas-dev
- name: Install python dependencies
# Pin asv==0.5.1 to fix failing benchmarks. Related to https://github.com/airspeed-velocity/asv/issues/1323
run: |
python -m pip install --upgrade pip wheel setuptools virtualenv asv==0.5.1 wget cmake casadi numpy
- name: Install SuiteSparse and Sundials
python -m pip install --upgrade pip wheel setuptools wget cmake casadi numpy packaging
python -m pip install asv[virtualenv]
- name: Install SuiteSparse and SUNDIALS
run: python scripts/install_KLU_Sundials.py

- name: Fetch base branch
run: |
# This workflow also runs for merge commits
Expand All @@ -49,7 +53,8 @@ jobs:
HEAD_COMMIT=$(git rev-parse HEAD)
echo $BASE_COMMIT | tee commits_to_compare.txt
echo $HEAD_COMMIT | tee -a commits_to_compare.txt
asv run HASHFILE:commits_to_compare.txt --m "GitHubRunner" --show-stderr --strict -v
asv run HASHFILE:commits_to_compare.txt --m "GitHubRunner" --show-stderr -v
- name: Compare commits' benchmark results
run: |
BASE_COMMIT=$(head -1 commits_to_compare.txt)
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/periodic_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install gfortran gcc libopenblas-dev
- name: Install python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools virtualenv asv wget cmake casadi numpy
- name: Install SuiteSparse and Sundials
python -m pip install --upgrade pip wheel setuptools wget cmake casadi numpy packaging
python -m 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 --strict -v
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@v3
with:
Expand All @@ -55,18 +62,22 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install asv
run: pip install asv

- name: Checkout pybamm-bench repo
uses: actions/checkout@v4
with:
repository: pybamm-team/pybamm-bench
token: ${{ secrets.BENCH_PAT }}

- name: Download results artifact
uses: actions/download-artifact@v3
with:
name: asv_new_results
path: new_results

- name: Copy new results and push to pybamm-bench repo
env:
PUSH_BENCH_EMAIL: ${{ secrets.PUSH_BENCH_EMAIL }}
Expand All @@ -78,6 +89,7 @@ jobs:
git add results
git commit -am "Add new results"
git push
- name: Publish results
run: |
asv publish
Expand Down

0 comments on commit 7eb5879

Please sign in to comment.