Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ODES solver #3932

Merged
merged 20 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
ignore:
- pybamm/install_odes.py
64 changes: 0 additions & 64 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,12 @@ jobs:
- name: Install build-time dependencies & run unit tests for M-series macOS runner
shell: bash
env:
# Point scikits.odes to the correct SUNDIALS installation
SUNDIALS_INST: $HOME/.local/lib
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
NONINTERACTIVE: 1
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
python -m pip install --upgrade pip nox
# Don't use Homebrew to install SUNDIALS because scikits.odes looks for
# in Homebrew folders instead, which we don't want
brew uninstall sundials --force
pip cache remove scikits.odes
python -m nox -s pybamm-requires -- --force
python -m nox -s unit

Expand All @@ -179,60 +172,3 @@ jobs:
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
pyenv uninstall -f $( python --version )

test_install_odes:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-12]
python-version: ["3.8", "3.9", "3.10", "3.11"]
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
# scikits.odes is not available on Python 3.12 yet
# See https://github.com/bmcage/odes/issues/162
# - os: macos-14
# python-version: "3.12"
fail-fast: false
name: Test pybamm_install_odes (${{ matrix.os }} / Python ${{ matrix.python-version }})

steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4

- name: Install Linux system dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gfortran gcc libopenblas-dev
- name: Install macOS system dependencies
if: matrix.os == 'macos-12' || matrix.os == 'macos-14'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_COLOR: 1
# Speed up CI
NONINTERACTIVE: 1
run: |
brew analytics off
brew install openblas
brew reinstall gcc gfortran

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install PyBaMM
run: python -m pip install -e .

- name: Test pybamm_install_odes on ${{ matrix.os }}
run: |
python -m pip cache purge
python -m pip install wget cmake
pybamm_install_odes
32 changes: 9 additions & 23 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ jobs:
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
agriyakhetarpal marked this conversation as resolved.
Show resolved Hide resolved
# We check coverage on Ubuntu with Python 3.11, so we skip unit tests for it here
# TODO: check coverage with Python 3.12 when [odes] supports it
# We check coverage on Ubuntu with Python 3.12, so we skip unit tests for it here
exclude:
- os: ubuntu-latest
python-version: "3.11"
python-version: "3.12"
# Include macOS M1 runners
include:
- os: macos-14
Expand All @@ -57,7 +56,6 @@ jobs:
- name: Check out PyBaMM repository
uses: actions/checkout@v4

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/[email protected]
if: matrix.os == 'ubuntu-latest'
Expand All @@ -76,7 +74,6 @@ jobs:
- name: Install macOS system dependencies
if: matrix.os == 'macos-12' || matrix.os == 'macos-14'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_COLOR: 1
Expand Down Expand Up @@ -123,20 +120,17 @@ jobs:
- name: Run unit tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: python -m nox -s unit

# Runs only on Ubuntu with Python 3.11
# TODO: check coverage with Python 3.12 when [odes] supports it
check_coverage:
needs: style
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: Coverage tests (ubuntu-latest / Python 3.11)
name: Coverage tests (ubuntu-latest / Python 3.12)

steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/[email protected]
with:
Expand All @@ -150,11 +144,11 @@ jobs:
sudo dot -c
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng

- name: Set up Python 3.11
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12
cache: 'pip'

- name: Install nox
Expand Down Expand Up @@ -206,7 +200,6 @@ jobs:
- name: Check out PyBaMM repository
uses: actions/checkout@v4

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/[email protected]
if: matrix.os == 'ubuntu-latest'
Expand All @@ -225,7 +218,6 @@ jobs:
- name: Install macOS system dependencies
if: matrix.os == 'macos-12' || matrix.os == 'macos-14'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_COLOR: 1
Expand Down Expand Up @@ -272,8 +264,7 @@ jobs:
- name: Run integration tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: python -m nox -s integration

# Runs only on Ubuntu with Python 3.12. Skips IDAKLU module compilation
# for speedups, which is already tested in other jobs.
# Skips IDAKLU module compilation for speedups, which is already tested in other jobs.
kratman marked this conversation as resolved.
Show resolved Hide resolved
run_doctests:
needs: style
runs-on: ubuntu-latest
Expand All @@ -287,7 +278,6 @@ jobs:
with:
fetch-depth: 0

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/[email protected]
with:
Expand All @@ -301,7 +291,7 @@ jobs:
sudo dot -c
sudo apt-get install texlive-latex-extra dvipng

- name: Set up Python 3.11
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
Expand All @@ -311,13 +301,12 @@ jobs:
- name: Install nox
run: python -m pip install nox

- name: Install docs dependencies and run doctests for GNU/Linux with Python 3.11
- name: Install docs dependencies and run doctests for GNU/Linux
run: python -m nox -s doctests

- name: Check if the documentation can be built for GNU/Linux with Python 3.11
- name: Check if the documentation can be built for GNU/Linux
run: python -m nox -s docs

# Runs only on Ubuntu with Python 3.12
run_example_tests:
needs: style
runs-on: ubuntu-latest
Expand All @@ -329,7 +318,6 @@ jobs:
- name: Check out PyBaMM repository
uses: actions/checkout@v4

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/[email protected]
with:
Expand Down Expand Up @@ -372,7 +360,6 @@ jobs:
- name: Run example notebooks tests for GNU/Linux with Python 3.12
run: python -m nox -s examples

# Runs only on Ubuntu with Python 3.12
run_scripts_tests:
needs: style
runs-on: ubuntu-latest
Expand All @@ -384,7 +371,6 @@ jobs:
- name: Check out PyBaMM repository
uses: actions/checkout@v4

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/[email protected]
with:
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ KLU_module_deps
# setup
setup.log

# odes setup
scikits_odes_setup.log

# test
test.c
test.json
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

## Breaking changes

- The ODES solver was removed due to compatability issues. Users should use IDAKULU, Casadi, or JAX instead. ([#3932](https://github.com/pybamm-team/PyBaMM/pull/3932))
- Integrated the `[pandas]` extra into the core PyBaMM package, deprecating the `pybamm[pandas]` optional dependency. Pandas is now a required dependency and will be installed upon installing PyBaMM ([#3892](https://github.com/pybamm-team/PyBaMM/pull/3892))
- Renamed "have_optional_dependency" to "import_optional_dependency" ([#3866](https://github.com/pybamm-team/PyBaMM/pull/3866))
- Integrated the `[latexify]` extra into the core PyBaMM package, deprecating the `pybamm[latexify]` set of optional dependencies. SymPy is now a required dependency and will be installed upon installing PyBaMM ([#3848](https://github.com/pybamm-team/PyBaMM/pull/3848))
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ conda install -c conda-forge pybamm

### Optional solvers

Following GNU/Linux and macOS solvers are optionally available:
The following solvers are optionally available:

- [scikits.odes](https://scikits-odes.readthedocs.io/en/latest/)-based solver, see [the documentation](https://docs.pybamm.org/en/latest/source/user_guide/installation/gnu-linux-mac.html#optional-scikits-odes-solver).
- [jax](https://jax.readthedocs.io/en/latest/notebooks/quickstart.html)-based solver, see [the documentation](https://docs.pybamm.org/en/latest/source/user_guide/installation/gnu-linux-mac.html#optional-jaxsolver).

## 📖 Citing PyBaMM
Expand Down
1 change: 0 additions & 1 deletion docs/source/api/solvers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Solvers
jax_solver
idaklu_solver
idaklu_jax
scikits_solvers
casadi_solver
algebraic_solvers
solution
Expand Down
8 changes: 0 additions & 8 deletions docs/source/api/solvers/scikits_solvers.rst

This file was deleted.

56 changes: 0 additions & 56 deletions docs/source/user_guide/installation/gnu-linux-mac.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,62 +89,6 @@ installed automatically when you install PyBaMM using ``pip``.
For an introduction to virtual environments, see
(https://realpython.com/python-virtual-environments-a-primer/).

.. _scikits.odes-label:

Optional - scikits.odes solver
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Users can install `scikits.odes <https://github.com/bmcage/odes>`__ to utilize its interfaced SUNDIALS ODE and DAE `solvers <https://docs.pybamm.org/en/latest/source/api/solvers/scikits_solvers.html>`__ wrapped in PyBaMM.

.. note::

Currently, only GNU/Linux and macOS are supported.

.. note::

The ``scikits.odes`` solver is not supported on Python 3.12 yet. Please refer to https://github.com/bmcage/odes/issues/162.
There is support for Python 3.8, 3.9, 3.10, and 3.11.

.. tab:: Debian/Ubuntu

In a terminal, run the following commands:

.. code:: bash

sudo apt-get install libopenblas-dev cmake
pybamm_install_odes

This will compile and install SUNDIALS for the system (under ``~/.local``), before installing ``scikits.odes``. (Alternatively, one can install SUNDIALS without this script and run ``pip install pybamm[odes]`` to install ``pybamm`` with ``scikits.odes``.)

.. tab:: macOS

In a terminal, run the following command:

.. code:: bash

brew install openblas gcc gfortran cmake
pybamm_install_odes

The ``pybamm_install_odes`` command, installed with PyBaMM, automatically downloads and installs the SUNDIALS library on your
system (under ``~/.local``), before installing `scikits.odes <https://scikits-odes.readthedocs.io/en/stable/installation.html>`__ . (Alternatively, one can install SUNDIALS without this script and run ``pip install pybamm[odes]`` to install ``pybamm`` with `scikits.odes <https://scikits-odes.readthedocs.io/en/stable/installation.html>`__)

To avoid installation failures when using ``pip install pybamm[odes]``, make sure to set the ``SUNDIALS_INST`` environment variable. If you have installed SUNDIALS using Homebrew, set the variable to the appropriate location. For example:

.. code:: bash

export SUNDIALS_INST=$(brew --prefix sundials)

Ensure that the path matches the installation location on your system. You can verify the installation location by running:

.. code:: bash

brew info sundials

Look for the installation path, and use that path to set the ``SUNDIALS_INST`` variable.

Note: The location where Homebrew installs SUNDIALS might vary based on the system architecture (ARM or Intel). Adjust the path in the ``export SUNDIALS_INST`` command accordingly.

To avoid manual setup of path the ``pybamm_install_odes`` is recommended for a smoother installation process, as it takes care of automatically downloading and installing the SUNDIALS library on your system.

Optional - JaxSolver
~~~~~~~~~~~~~~~~~~~~
Expand Down
20 changes: 1 addition & 19 deletions docs/source/user_guide/installation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ It can be installed using ``pip`` or ``conda``, or from source.
Optional solvers
----------------

Following GNU/Linux and macOS solvers are optionally available:
The following solvers are optionally available:

* `scikits.odes <https://scikits-odes.readthedocs.io/en/latest/>`_ -based solver, see `Optional - scikits.odes solver <https://docs.pybamm.org/en/latest/source/user_guide/installation/gnu-linux-mac.html#optional-scikits-odes-solver>`_.
* `jax <https://jax.readthedocs.io/en/latest/notebooks/quickstart.html>`_ -based solver, see `Optional - JaxSolver <https://docs.pybamm.org/en/latest/source/user_guide/installation/gnu-linux-mac.html#optional-jaxsolver>`_.

Dependencies
Expand Down Expand Up @@ -204,23 +203,6 @@ Dependency Minimu
`jaxlib <https://pypi.org/project/jaxlib/>`__ 0.4.20 jax Support library for JAX
========================================================================= ================== ================== =======================

.. _install.odes_dependencies:

odes dependencies
^^^^^^^^^^^^^^^^^

Installable with ``pip install "pybamm[odes]"``

======================================================================================================================================= ================== ================== =============================
Dependency Minimum Version pip extra Notes
======================================================================================================================================= ================== ================== =============================
`scikits.odes <https://docs.pybamm.org/en/latest/source/user_guide/installation/gnu-linux-mac.html#optional-scikits-odes-solver>`__ \- odes For scikits ODE & DAE solvers
======================================================================================================================================= ================== ================== =============================

.. note::

Before running ``pip install "pybamm[odes]"``, make sure to install ``scikits.odes`` build-time requirements as described `here <https://docs.pybamm.org/en/latest/source/user_guide/installation/gnu-linux-mac.html#optional-scikits-odes-solver>`_ .

Full installation guide
-----------------------

Expand Down
Loading
Loading