Python interface for the IDAKLU solver
Actively maintained. Last release 6 days ago, commits in 25 of the last 26 weeks. A safe choice.
pip install pybammsolversIDAKLU solver
Standalone repository for the C/C++ solvers used in PyBaMM
Installation
From PyPI:
pip install pybammsolvers
And from conda-forge (>=v0.7.0 only):
conda install pybammsolvers
# or mamba install pybammsolvers
Solvers
The following solvers are available:
- PyBaMM's IDAKLU solver
Development
Local builds
For testing new solvers and unsupported architectures, local builds are possible.
The build backend is scikit-build-core;
build-time dependencies (scikit-build-core, pybind11, cmake, ninja) are
resolved automatically via PEP 517 isolation when running pip install.
SUNDIALS and SuiteSparse are compiled automatically from the bundled git submodules during the build, so initialise the submodules first.
Nox (Recommended)
Nox can be used to do a quick build:
pip install nox
nox
This will setup an environment and attempt to build the library.
MacOS
Mac dependencies can be installed using brew
brew install libomp
brew reinstall gcc
git submodule update --init --recursive
pip install .
Linux
Linux installs may vary based on the distribution, however, the basic build can be performed with the following commands:
sudo apt-get install libopenblas-dev gcc gfortran make g++ build-essential
git submodule update --init --recursive
pip install .
Custom SUNDIALS / SuiteSparse paths
If SUNDIALS and SuiteSparse are installed somewhere other than ./.idaklu,
pass paths through pip's --config-settings:
pip install . \
--config-settings=cmake.define.SUNDIALS_ROOT=/path/to/sundials \
--config-settings=cmake.define.SuiteSparse_ROOT=/path/to/suitesparse
Editable installs and rebuilding the C++ extension
pip install -e .[dev] installs in editable mode with auto-rebuild on import:
edits to C++ sources trigger a rebuild the next time pybammsolvers is
imported. To force a rebuild manually (e.g. when auto-rebuild is bypassed in
CI):