Repository navigation
Run exit diagnostics on every failing check_error path - #1478
Closed
ChrisRackauckas-Claude wants to merge 1 commit into
Closed
ChrisRackauckas-Claude wants to merge 1 commit into
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
This was referenced Jul 29, 2026
The extended diagnostics added in SciML#1379 only ran on the dtmin, sub-epsilon, and unstable-check exits. A solve that dies on maxiters — the common outcome when one equation quietly forces the step size down — reported nothing beyond "larger maxiters is needed", so there was no information to debug from. Every non-Success exit now runs the same diagnostic and reports the time it exited at. Adds `log_error_estimate`, a hook for solver packages to report the adaptive error estimate and the state components contributing most to it. The scalar estimate says "the step was rejected"; the per-component breakdown says which equation rejected it, which is what the user needs to look at. The diagnostics were previously computed and then discarded when the verbosity toggle was off. They are now gated before the work is done, which matters because the numeric diagnostic can build a fresh Jacobian. The dt-below-epsilon exit also gated its diagnostic on `dt_min_unstable` while emitting under `dt_epsilon`; it now uses `dt_epsilon` for both. Drops the `isdefined(integrator, :EEst)` interpolation from the dtmin messages. ODEIntegrator moved `EEst` onto the controller cache, so that branch had gone permanently dead; `log_error_estimate` reports the estimate instead. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DKB6v14nZHZPYtKiLsPLDT
ChrisRackauckas-Claude
force-pushed
the
diagnostics/check-error-all-exits
branch
from
July 29, 2026 14:53
4e61978 to
96a26d5
Compare
Member
|
Supersceded by @Shreyas-Ekanathan ? |
Contributor
|
Yeah I'll take this one and refactor as we discussed |
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.
Please ignore until reviewed by @ChrisRackauckas.
Motivation
From a Slack thread with @MasonProtter: a large ODE solved in a loop suddenly starts hitting
maxiters. Saving every step to inspect what happened OOMs a 256GB machine, andsave_everystep=falseleaves almost nothing to look at:No NaNs, no large values, no obvious culprit. The solver knew exactly which equation was forcing the step size down — it just never said so.
The extended diagnostics added in #1379 do report that kind of information, but only on the
dtmin, sub-epsilon, and unstable-check exits. As @oscardssmith put it in the thread, "shreyas's pr won't help if we aren't exiting with a dt<dtmin or unstable". Amaxitersexit got the generic "larger maxiters is needed" string and nothing else.What this does
The high level, quoting the thread: "should I exit?" -> "if logging is on, diagnose more information about why I exited" -> "exit".
Successexit fromcheck_errornow runs the same diagnostic —MaxItersandDtNaNandConvergenceFailureincluded, not just the two instability branches. The shared construction moved intoSciMLBase.exit_diagnostic.SciMLBase.log_error_estimate(integrator)hook, defaulting to"". Solver packages specialize it to report the adaptive error estimate and, more usefully, the state components contributing most to it.EEst = ||atmp||only says the step was rejected;atmpsays which equation rejected it. Implemented forODEIntegratorin Report the top error-estimate contributors on solver exit OrdinaryDiffEq.jl#4057.maxitersanddt_NaNmessages now report thet(anddt) they gave up at.Two incidental fixes in the same code:
dt_min_unstablewhile emitting the message underdt_epsilon, so settingdt_epsilonalone got a message with no diagnostic. Both now usedt_epsilon.Also drops the
isdefined(integrator, :EEst) ? ... : ""interpolation from the dtmin messages.ODEIntegratormovedEEstonto the controller cache, soisdefinedhas been permanentlyfalseand that text never printed.log_error_estimatereports the estimate through a hook the solver actually implements.What it looks like
With SciML/OrdinaryDiffEq.jl#4057 providing the hook, on a 10-equation system where only component 7 is stiff:
Tests
test/check_error_diagnostics.jldrives a mock integrator through the genericcheck_errorand asserts that all six exit branches (DtNaN,MaxIters,DtLessThanMin, sub-epsilonUnstable, unstable-checkUnstable,ConvergenceFailure) emit both hooks' output, that a successful check emits nothing, and that a silent toggle skips the diagnostic entirely.Run locally on Julia 1.11:
Checklist
Additional context
Supports SciML/OrdinaryDiffEq.jl#4057 (implements
log_error_estimate) and composes with SciML/OrdinaryDiffEq.jl#3731, whoselog_numerical_instabilitynow also fires onmaxitersexits.🤖 Generated with Claude Code
https://claude.ai/code/session_01DKB6v14nZHZPYtKiLsPLDT