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
Changes from 6 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
63 changes: 0 additions & 63 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
@@ -150,19 +150,13 @@ 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
kratman marked this conversation as resolved.
Show resolved Hide resolved
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

@@ -179,60 +173,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
2 changes: 0 additions & 2 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@ jobs:
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
exclude:
- os: ubuntu-latest
python-version: "3.11"
kratman marked this conversation as resolved.
Show resolved Hide resolved
@@ -124,7 +123,6 @@ jobs:
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
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -107,9 +107,6 @@ KLU_module_deps
# setup
setup.log

# odes setup
scikits_odes_setup.log

# test
test.c
test.json
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -130,7 +130,6 @@ conda install -c conda-forge pybamm

Following GNU/Linux and macOS solvers are optionally available:
kratman marked this conversation as resolved.
Show resolved Hide resolved

- [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
1 change: 0 additions & 1 deletion docs/source/api/solvers/index.rst
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ Solvers
jax_solver
idaklu_solver
idaklu_jax
scikits_solvers
casadi_solver
algebraic_solvers
solution
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
@@ -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
~~~~~~~~~~~~~~~~~~~~
18 changes: 0 additions & 18 deletions docs/source/user_guide/installation/index.rst
Original file line number Diff line number Diff line change
@@ -47,7 +47,6 @@ Optional solvers

Following GNU/Linux and macOS solvers are optionally available:
kratman marked this conversation as resolved.
Show resolved Hide resolved

* `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
@@ -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
-----------------------

13 changes: 0 additions & 13 deletions docs/source/user_guide/installation/install-from-docker.rst
Original file line number Diff line number Diff line change
@@ -26,12 +26,6 @@ Use the following command to pull the PyBaMM Docker image from Docker Hub:

docker pull pybamm/pybamm:latest

.. tab:: Scikits.odes solver

.. code:: bash

docker pull pybamm/pybamm:odes

kratman marked this conversation as resolved.
Show resolved Hide resolved
.. tab:: JAX solver

.. code:: bash
@@ -143,18 +137,11 @@ Building Docker images with optional arguments
When building the PyBaMM Docker images locally, you have the option to include specific solvers by using optional arguments. These solvers include:

- ``IDAKLU``: For IDA solver provided by the SUNDIALS plus KLU.
- ``ODES``: For scikits.odes solver for ODE & DAE problems.
- ``JAX``: For Jax solver.
- ``ALL``: For all the above solvers.

To build the Docker images with optional arguments, you can follow these steps for each solver:

.. tab:: Scikits.odes solver

.. code-block:: bash

docker build -t pybamm:odes -f scripts/Dockerfile --build-arg ODES=true .

.. tab:: JAX solver

.. code-block:: bash
10 changes: 0 additions & 10 deletions examples/scripts/compare_dae_solver.py
Original file line number Diff line number Diff line change
@@ -38,16 +38,6 @@
Please consult installation instructions on GitHub.
"""
)
if pybamm.have_scikits_odes():
scikits_sol = pybamm.ScikitsDaeSolver(atol=1e-8, rtol=1e-8).solve(model, t_eval)
solutions.append(scikits_sol)
else:
pybamm.logger.error(
"""
Cannot solve model with Scikits DAE solver as solver is not installed.
Please consult installation instructions on GitHub.
"""
)

# plot
plot = pybamm.QuickPlot(solutions)
Loading