-
-
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
Improve reliability of simulations when using CasadiSolver
#3494
Improve reliability of simulations when using CasadiSolver
#3494
Conversation
and trigger another experiment with 500 runs on each Python version, amounting to a total of 2000 executions of the same notebook
This workflow will subsequently be removed in the next commit, after a final run on a push of this commit.
Since this is a bug fix, should this be included in the release? We had decided to look into the issue in the next one, but I think this should be conclusive enough and is also a small change |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3494 +/- ##
========================================
Coverage 99.58% 99.58%
========================================
Files 256 256
Lines 20126 20131 +5
========================================
+ Hits 20043 20048 +5
Misses 83 83 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a hash of the function name seems to be a bit of overkill, but it looks good. The failing integration tests look like they are just a sporadic pip download issue
I agree, albeit setting it as such should ensure that the hash will change at a time only when the name of the class changes—which will never happen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can include this in the next rc release once it is merged in develop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @agriyakhetarpal! I'll merge once the conflicts are resolved.
Description
Closes #3415; wraps and calls a fixed random seed set to the name of the
Simulation
class when using theCasadiSolver
orCasadiAlgebraicSolver
solvers for a model, which are susceptible to the initial conditions and sometimes fail randomly. This situation has been fixed for the integration tests and for the benchmarks earlier, this PR ensures that it will be fixed for general-purpose use-cases of theSimulation
class.Setting a random seed has been shown to bring the failure rate to zero on repeated executions of the half-cell models Jupyter notebook: https://github.com/agriyakhetarpal/PyBaMM/actions/runs/6709408022, https://github.com/agriyakhetarpal/PyBaMM/actions/runs/6729021051.
Type of change
Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: