Skip to content

Commit

Permalink
Merge branch 'pybamm-team:develop' into jax_gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbrittain authored Oct 9, 2023
2 parents 342c703 + 774d56d commit 83b9cf5
Show file tree
Hide file tree
Showing 183 changed files with 7,405 additions and 2,914 deletions.
28 changes: 24 additions & 4 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"login": "wigging",
"name": "Gavin Wiggins",
"avatar_url": "https://avatars.githubusercontent.com/u/6828967?v=4",
"profile": "https://wigging.me",
"profile": "https://gavinw.me",
"contributions": [
"bug",
"code"
Expand Down Expand Up @@ -531,7 +531,8 @@
"contributions": [
"infra",
"code",
"doc"
"doc",
"review"
]
},
{
Expand Down Expand Up @@ -613,7 +614,8 @@
"contributions": [
"infra",
"code",
"doc"
"doc",
"review"
]
},
{
Expand Down Expand Up @@ -697,7 +699,25 @@
"code",
"test"
]
}
},
{
"login": "aitorres",
"name": "Andrés Ignacio Torres",
"avatar_url": "https://avatars.githubusercontent.com/u/26191851?v=4",
"profile": "https://aitorres.com",
"contributions": [
"infra"
]
},
{
"login": "Agnik7",
"name": "Agnik Bakshi",
"avatar_url": "https://avatars.githubusercontent.com/u/77234005?v=4",
"profile": "https://github.com/Agnik7",
"contributions": [
"doc"
]
},
],
"contributorsPerLine": 7,
"projectName": "PyBaMM",
Expand Down
2 changes: 1 addition & 1 deletion .github/release_reminder.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Quarterly reminder to create a -
1. pre-release if the month has just started.
2. non-pre-release if the month is about to end (**before the end of the month**).

See [Release Workflow](./release_workflow.md) for more information.
See [Release Workflow](https://github.com/pybamm-team/PyBaMM/blob/develop/.github/release_workflow.md) for more information.
25 changes: 15 additions & 10 deletions .github/release_workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file contains the workflow required to make a `PyBaMM` release on GitHub an

## rc0 releases (automated)

1. The `update_version.yml` workflow will run on every 1st of January, May and September, updating incrementing the version to `YY.MMrc0` by running `scripts/update_version.py` in the following files -
1. The `update_version.yml` workflow will run on every 1st of January, May and September, updating incrementing the version to `vYY.MMrc0` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
Expand All @@ -13,21 +13,21 @@ This file contains the workflow required to make a `PyBaMM` release on GitHub an
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to a new branch `YY.MM`.
These changes will be automatically pushed to a new branch `vYY.MM` and a PR from `vvYY.MM` to `develop` will be created (to sync the branches).

2. Create a new GitHub _pre-release_ with the tag `YY.MMrc0` from the `YY.MM` branch and a description copied from `CHANGELOG.md`.
2. Create a new GitHub _pre-release_ with the tag `vYY.MMrc0` from the `vYY.MM` branch and a description copied from `CHANGELOG.md`.

3. This release will automatically trigger `publish_pypi.yml` and create a _pre-release_ on PyPI.

## rcX releases (manual)

If a new release candidate is required after the release of `rc0` -

1. Fix a bug in `YY.MM` (no new features should be added to `YY.MM` once `rc0` is released) and `develop` individually.
1. Fix a bug in `vYY.MM` (no new features should be added to `vYY.MM` once `rc0` is released) and `develop` individually.

2. Run `update_version.yml` manually while using `append_to_tag` to specify the release candidate version number (`rc1`, `rc2`, ...).

3. This will increment the version to `YY.MMrcX` by running `scripts/update_version.py` in the following files -
3. This will increment the version to `vYY.MMrcX` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
Expand All @@ -36,9 +36,9 @@ If a new release candidate is required after the release of `rc0` -
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to the existing branch `YY.MM`.
These changes will be automatically pushed to the existing `vYY.MM` branch and a PR from `vvYY.MM` to `develop` will be created (to sync the branches).

4. Create a new GitHub _pre-release_ with the same tag (`YY.MMrcX`) from the `YY.MM` branch and a description copied from `CHANGELOG.md`.
4. Create a new GitHub _pre-release_ with the same tag (`vYY.MMrcX`) from the `vYY.MM` branch and a description copied from `CHANGELOG.md`.

5. This release will automatically trigger `publish_pypi.yml` and create a _pre-release_ on PyPI.

Expand All @@ -48,7 +48,7 @@ Once satisfied with the release candidates -

1. Run `update_version.yml` manually, leaving the `append_to_tag` field blank ("") for an actual release.

2. This will increment the version to `YY.MMrcX` by running `scripts/update_version.py` in the following files -
2. This will increment the version to `vYY.MMrcX` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
Expand All @@ -57,9 +57,9 @@ Once satisfied with the release candidates -
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to the existing branch `YY.MM`.
These changes will be automatically pushed to the existing `vYY.MM` branch and a PR from `vvYY.MM` to `develop` will be created (to sync the branches).

3. Next, a PR from `YY.MM` to `main` will be generated that should be merged once all the tests pass.
3. Next, a PR from `vYY.MM` to `main` will be generated that should be merged once all the tests pass.

4. Create a new GitHub _release_ with the same tag from the `main` branch and a description copied from `CHANGELOG.md`.

Expand All @@ -72,3 +72,8 @@ Some other essential things to check throughout the release process -
- If updating our custom vcpkg registory entries [pybamm-team/sundials-vcpkg-registry](https://github.com/pybamm-team/sundials-vcpkg-registry) or [pybamm-team/casadi-vcpkg-registry](https://github.com/pybamm-team/casadi-vcpkg-registry) (used to build Windows wheels), make sure to update the baseline of the registories in vcpkg-configuration.json to the latest commit id.
- Update jax and jaxlib to the latest version in `pybamm.util` and `setup.py`, fixing any bugs that arise
- Make sure the URLs in `docs/_static/versions.json` are valid
- As the release workflow is initiated by the `release` event, it's important to note that the default `GITHUB_REF` used by `actions/checkout` during the checkout process will correspond to the tag created during the release process. Consequently, the workflows will consistently build PyBaMM based on the commit associated with this tag. Should new commits be introduced to the `vYY.MM` branch, such as those addressing build issues, it becomes necessary to manually update this tag to point to the most recent commit -
```
git tag -f <tag_name> <commit_hash>
git push origin <tag_name> # can only be carried out by the maintainers
```
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
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
75 changes: 75 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build & Push Docker Images

on:
workflow_dispatch:
push:
branches:
- develop

jobs:
pre_job:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: List built images
run: docker images

- name: Build and Push Docker Image (Without Solvers)
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:latest
push: true

- name: Build and Push Docker Image (With JAX Solver)
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:jax
push: true
build-args: |
JAX=true
- name: Build and Push Docker Image (With ODES & DAE Solver)
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:odes
push: true
build-args: |
ODES=true
- name: Build and Push Docker Image (With IDAKLU Solver)
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:idaklu
push: true
build-args: |
IDAKLU=true
- name: Build and Push Docker Image (With All Solvers)
uses: docker/build-push-action@v5
with:
context: .
file: scripts/Dockerfile
tags: pybamm/pybamm:latest
push: true
build-args: |
ALL=true
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
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
18 changes: 9 additions & 9 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ jobs:
- name: Build wheels on Linux and MacOS
run: python -m cibuildwheel --output-dir wheelhouse
env:
# TODO: openblas no longer available on centos 7 i686 image, use blas instead for now
CIBW_ARCHS_LINUX: x86_64
CIBW_BEFORE_ALL_LINUX: >
yum -y install blas-devel lapack-devel &&
bash build_manylinux_wheels/install_sundials.sh 5.8.1 6.5.0
yum -y install openblas-devel lapack-devel &&
bash build_manylinux_wheels/install_sundials.sh 6.0.3 6.5.0
CIBW_BEFORE_BUILD_LINUX: "python -m pip install cmake casadi numpy"
CIBW_BEFORE_BUILD_MACOS: >
Expand Down Expand Up @@ -135,13 +135,13 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11

- name: Install dependencies
run: pip install wheel
run: pip install --upgrade pip setuptools wheel build

- name: Build sdist
run: python setup.py sdist --formats=gztar
run: python -m build --sdist

- name: Upload sdist
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -171,13 +171,13 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: files/
packages-dir: files/

- name: Publish on TestPyPI
if: github.event.inputs.target == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TESTPYPI_TOKEN }}
packages_dir: files/
repository_url: https://test.pypi.org/legacy/
packages-dir: files/
repository-url: https://test.pypi.org/legacy/
2 changes: 1 addition & 1 deletion .github/workflows/release_reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
remind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: nox -s doctests

- name: Check if the documentation can be built
if: matrix.os == 'ubuntu-latest'
run: nox -s docs

- name: Install dev dependencies and run example tests
if: matrix.os == 'ubuntu-latest'
run: nox -s examples
Expand Down
Loading

0 comments on commit 83b9cf5

Please sign in to comment.