Repository navigation
feat!: default convert_to_format to rust - #5966
Open
BradyPlanden wants to merge 1 commit into
Open
BradyPlanden wants to merge 1 commit into
BradyPlanden wants to merge 1 commit into
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
2 of 3 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## stack/10-diffsol-solver #5966 +/- ##
===========================================================
- Coverage 98.15% 98.14% -0.02%
===========================================================
Files 354 354
Lines 37278 37279 +1
===========================================================
- Hits 36592 36589 -3
- Misses 686 690 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 22, 2026
BradyPlanden
force-pushed
the
stack/11-default-rust
branch
from
October 28, 2026 09:55
cef6708 to
18aae11
Compare
BradyPlanden
force-pushed
the
stack/11-default-rust
branch
2 times, most recently
from
October 28, 2026 14:11
58c95d5 to
2ef0d3e
Compare
BradyPlanden
force-pushed
the
stack/11-default-rust
branch
from
October 28, 2026 15:28
2ef0d3e to
9fbc37e
Compare
BaseModel defaults to "rust"; CasADi-specific tests pin their format; user guide and multithreading docs describe the rust backend.
BradyPlanden
force-pushed
the
stack/11-default-rust
branch
from
October 29, 2026 08:01
9fbc37e to
fd167d2
Compare
BradyPlanden
marked this pull request as ready for review
October 29, 2026 10:10
Member
Author
|
I'm marking this ready-for-review to get benchers results with rust as the default backend. It should not be merged until the rust backend is verified as stable. |
Contributor
|
| Project | PyBaMM |
| Branch | stack/11-default-rust |
| Testbed | bare-metal |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
🚨 1 Alert
🐰 View full continuous benchmarking report in BencherThis branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Models default to
convert_to_format = "rust"instead of"casadi"(BaseModel._DEFAULT_CONVERT_TO_FORMAT). Every model is lowered to the Rust core unless it opts out withmodel.convert_to_format = "casadi". With the rest of the stack:the default
IDAKLUSolversolves and reads rust models in Rust;ScipySolver,AlgebraicSolverand EIS evaluate them through compiled functions;CasadiSolverandCasadiAlgebraicSolverconvert them to CasADi, logging the conversion at INFO for a model left at the default format and at WARNING for a format chosen explicitly, so the deprecated solvers'DeprecationWarningstays the one warning a default model sees.Serialisation: saving falls back to the default format, and a file saved without a
convert_to_formatkey loads as"rust".Tests:
"casadi": the CasADi solver suites (through autouse fixtures), CasADi leaves and pickles, AOT compilation, the lead-acid comparisons, the IDAKLU sparse-output sensitivity guard, and single tests in ten more files, among them the bitwise CasADi parity of input-dependent discontinuity times. Among those,test_multiple_inputskeeps covering CasADi with fewer solvers than threads.standard_output_testsraises its absolute tolerance from 2e-14 to 5e-14, since round-off differs by backend.Docs:
user_guide/rust_backend.rst, covers choosing the backend, its differences from CasADi,DiffsolSolver's output times and Hermite reads, and adding a new expression type.num_threadsacross the backends.rust_idaklu_build.mdand thepybamm-rustREADME point to the guide.What raises on the Rust backend:
IDAKLUSolverraisesSolverErrorfor sensitivities with respect to an input of width above 1, and solves withnum_solversequal tonum_threads, as the guide says.return_jacp_stackedandTensorFieldoutput variables also raiseSolverError.TypeErrororNotImplementedError, and an interpolant table Rust refuses raisesModelError.Performance
A release needs
pybammsolvers0.12.0 on PyPI (#5961) and the platform wheels from #5958.Type of change
Breaking change, under
## Breaking changesinCHANGELOG.md, with the migration note "Setmodel.convert_to_format = "casadi"to restore the previous backend."Key checklist
pre-commit runnox -s doctests"casadi". The CasADi solvers' conversion test, from feat(rust): evaluate rust models through compiled evaluators #5960, now checks the log level for a default and a chosen formatRust execution engine stack: proposal #5667, showcase #5732
Each PR is one commit on the one above it.
Function.create_copykeeps the function's classRegPowerand uniform-grid interpolant lookups matchevaluatepybamm-core: expression graph, typed IR, interpreters, forward-mode ADpybamm-core:CompiledModel, coloured Jacobians, the C ABIpybamm.rustbindings, built into thepybammwheelSymbol.to_rustconvert_to_format = "rust"forScipySolver,AlgebraicSolverand EISpybammsolvers: IDAKLU over the C ABIIDAKLUSolveron rust modelspybamm-core: diffsol DAE solverpybamm.DiffsolSolver"rust"as the defaultconvert_to_format← this PR