-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
[Roadmap area] Solver improvements #3910
Comments
Not solver, but this is related to speed-up: #4058 |
This is my attempt at a roadmap for PyBaMM's solvers, comments / suggestions welcome Sensitivities
Multithreaded/GPU support:
Post Processing optimisation and refactoring
Solver refactoring
Solver documentation
WASM build
|
Here are my thoughts on improving the solver. Please let me know if you have comments or questions @martinjrobins and others. Solver optionsInitializationTime steppingIn PyBaMM, the solver currently stops at all values in the
These three reasons for setting a
If we compare the solver stats,
Even though we solve the same system, the dense
|
yea, agree that it would be great to get rid of |
If we can access IDA's internal time steps via Casadi, I think we can do most of this stuff |
Corollary from the PyBaMM developer meeting on 05/08/2024 as a part of PyBaMM running in WASM:
|
@agriyakhetarpal: FYI, I've compiled IDA with KLU using enscripten in the past, see this repo: https://github.com/martinjrobins/diffeq-runtime. However I agree that focusing on the casadi solver for now is the best approach since you have it already compiled and in Pyodide |
Thanks for the resource, @martinjrobins! I see you've built a static lib for KLU and also used |
To improve the speed of our ODE models, I'd like to add
And just FYI, I don't plan on starting this work for at least a couple of weeks. |
Hi @martinjrobins, an update: I've made a substantial amount of progress recently in compiling PyBaMM + the IDAKLU solver for WASM and I'm at one of the last stages for it – which is to finish up and get it to compile fully so that we have a shareable wasm32 wheel (and hopefully correctly in terms of computations, which I can't verify until we do have a wheel at hand). I've linked a PR with my progress above, and the blocker seems to be the fact that post #4260 (which can be closed now since it was superseded, I think?) and its latter variant #4449 that was merged recently, is that I need to figure out how to turn off OpenMP/threading support completely using a build-time flag/CMake argument that I can pass on/an environment variable of sorts/a hardcoded define I can patch, that will set the number of available threads to one so that the solver's compilation can proceed with the That aside, PyBaMM without the IDAKLU solver, i.e., with just the |
Hi @agriyakhetarpal. I would define a new variable in the CMakeLists.txt (e.g. #ifdef PYBAMM_OPENMP
#include <nvector/nvector_openmp.h>
#endif Then you need to go through the code and switch off any openmp related code using this compile definition remember also to switch off the searching and linking against openmp in |
looking forward to trying out pybamm in the browser, let me know when you have a deployment :) |
Thanks for the ideas, @martinjrobins; I did have something like that in mind! I'll put together a PR for this and add another patch. I'll also need changes from #4449 for it, so it might be better for me to wait until we have a new release with #4598. I'll consider moving my repository to our GitHub organisation once the deployments are up and working. [Note to self] some more changes that be needed to be done:
Most of these changes can very well be upstreamed; it would only help us in the future and I wouldn't need to maintain these patches. |
Additional notes for further reference: we don't have a recipe for SUNDIALS in Pyodide yet – there will soon be one, though, but it will be for the latest version (7.1.1) and not the version we use (6.5.0), so I've been compelled to create a custom one myself and patch out or exclude the Fortran bits however we can because we don't have a relatively stable Fortran to WASM compiler ( The same goes for SuiteSparse; we have v5.11.0 in Pyodide (for SparseQR, and does not compile KLU so far), but we use 6.0.3 here in PyBaMM (side note: we're getting quite behind, though, it might be worth testing the latest 7.8.3 for our conventional targets), which lacks some of the "build system convenience" changes such as being able to pass For CasADi, we can't simply use the PyPI/non-PyPI wheels because we need the CasADi shared objects as side modules for the IDAKLU shared object to link to. Again, it might be nice to compile it some time as a native |
I'd like to continue making pybamm easier to work with for the parameter inference libraries like PyBOP (https://github.com/pybop-team/PyBOP). At the moment I think this includes:
Originally posted by @martinjrobins in #3839 (comment)
The text was updated successfully, but these errors were encountered: