Update SUNDIALS to 7.8.0 - #1600
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
📝 WalkthroughWalkthroughSUNDIALS integrations were updated to use ChangesSUNDIALS context migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3fba4264-b353-407b-b942-ee2e70505ef6
📒 Files selected for processing (8)
3rdPartysrc/OMSimulatorLib/AlgLoop.cppsrc/OMSimulatorLib/AlgLoop.hsrc/OMSimulatorLib/CMakeLists.txtsrc/OMSimulatorLib/SystemSC.cppsrc/OMSimulatorLib/SystemSC.hsrc/OMSimulatorLib/SystemSC3.cppsrc/OMSimulatorLib/SystemSC3.h
773e251 to
f8881f6
Compare
|
We have a new CVODE issue when testing Strair.py: Looks like SUNDIALS 7.x is checking to not integrate over a too small interval after |
|
I might want to fix #1603 before merging this. Not sure but would be good to know that the event handling is not breaking when skipping CVODE calls if we are on an event. |
Bump 3rdParty, which replaces the patched sundials-5.4.0 source copy with a pristine submodule pinned to v7.8.0, and port the solvers to the new API. In the integrated OpenModelica build (OPENMODELICA_NEW_CMAKE_BUILD) this block is skipped and we link the SUNDIALS that OMC configured, so the two option sets have to stay in agreement. Going from 5.4.0 to 7.8.0 crosses two breaking releases: - Every SUNDIALS object is now created against a SUNContext. SystemSC, SystemSC3 and KinsolSolver each own one and pass it to N_VNew_Serial, SUNDenseMatrix, SUNLinSol_Dense, CVodeCreate and KINCreate. It has to be created before the first such object and freed after the last one. - realtype -> sunrealtype. - KINSetErrHandlerFn is gone; the error handler is pushed onto the SUNContext with SUNContext_PushErrHandler and now reports a source location plus a SUNErrCode instead of a module name and message string. Package level codes (KIN_* and friends) are not SUNErrCodes, so SUNGetErrMsg() is only used when SUNDIALS did not supply a message, the same rule its own default handler uses. - KINSetPrintLevel and KINSetInfoHandlerFn are gone with no equivalent, so sundialsInfoHandlerFunction is dropped. KINSOL's progress output only exists via the SUNLogger, which is compiled out at the logging level SUNDIALS is built with here. - SUNDIALS no longer writes to a FILE* of its own. Up to SUNDIALS 5 CVODE printed to cv_errfp, which defaulted to stderr; the same messages now go through the SUNContext error handler chain, whose default handler writes to the SUNLogger's error stream. Either way that bypasses OMSimulator's logger, so the logger's error and warning streams are muted per context and we report through logError as before. While in here, report the allocation failures in KinsolSolver::NewKinsolSolver that were silently ignored: the five N_VNew_Serial calls, SUNDenseMatrix and SUNLinSol_Dense were used without checking for NULL. Also correct two copy-pasted messages that blamed N_VNew_Serial for a failing SUNDenseMatrix. Also follow the oms::3rd::cvode/kinsol -> oms::3rd::sundials::cvode/kinsol alias rename from 3rdParty. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Skip steps with |tout - tn| < 2*uround*max(|tn|,|tout|) * Go directly to tout
2d2b004 to
44c54ef
Compare
|
The error |
|
I also updated |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1600 +/- ##
==========================================
+ Coverage 27.20% 27.23% +0.03%
==========================================
Files 69 69
Lines 13825 13844 +19
Branches 8600 8615 +15
==========================================
+ Hits 3761 3771 +10
- Misses 8878 8881 +3
- Partials 1186 1192 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Related Issues
OpenModelica will be updated to SUNDIALS v7.8.0, so OMSimulator needs to be updated first.
They share SUNDIALS, so they need to agree on the version.
Changes
Bump 3rdParty, which replaces the patched sundials-5.4.0 source copy with a pristine submodule pinned to v7.8.0, and port the solvers to the new API.
In the integrated OpenModelica build (OPENMODELICA_NEW_CMAKE_BUILD) this block is skipped and we link the SUNDIALS that OMC configured, so the two option sets have to stay in agreement.
Going from 5.4.0 to 7.8.0 crosses two breaking releases:
While in here, report the allocation failures in KinsolSolver::NewKinsolSolver that were silently ignored: the five N_VNew_Serial calls, SUNDenseMatrix and SUNLinSol_Dense were used without checking for NULL. Also correct two copy-pasted messages that blamed N_VNew_Serial for a failing SUNDenseMatrix.
Also follow the oms::3rd::cvode/kinsol -> oms::3rd::sundials::cvode/kinsol alias rename from 3rdParty.