From df1aec45cbdab31630531eadb31e010b4c7ede50 Mon Sep 17 00:00:00 2001 From: Joel Eliason Date: Wed, 24 Jun 2026 15:36:44 -0600 Subject: [PATCH] Lower CVODE mxstep cap 500000 -> 50000 to fail stiff draws fast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A stiff / near-singular parameter draw could grind ~500k microscopic BDF steps (~3 min wall) before CVodeSetMaxNumSteps tripped CV_TOO_MUCH_WORK — a "straggler" that stalls batch/SBI walltime to reach a failure that is detectable far sooner. With a per-call MaxStep on the order of the output cadence, a valid integration crosses one interval in O(1-100) steps, so 50000 still leaves ~3 orders of magnitude of headroom while failing pathological draws ~10x faster. --- cpp/src/CVODEBase.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cpp/src/CVODEBase.cpp b/cpp/src/CVODEBase.cpp index 51a1e6c..e551d81 100644 --- a/cpp/src/CVODEBase.cpp +++ b/cpp/src/CVODEBase.cpp @@ -7,7 +7,15 @@ #include #include -const int mxstep = 500000; +// Max internal CVODE steps per integration call (CVodeSetMaxNumSteps). +// Lowered 500000 -> 50000: with a per-call MaxStep on the order of the output +// cadence, a well-behaved integration crosses one interval in O(1-100) steps, +// so 50000 still leaves ~3 orders of magnitude of headroom. The old 500000 +// let a stiff/near-singular parameter draw grind ~half a million microscopic +// BDF steps (~3 min wall) before CV_TOO_MUCH_WORK tripped — a "straggler" that +// stalls batch/SBI walltime to reach a failure detectable far sooner. At 50000 +// the same draw fails ~10x faster while valid sims are unaffected. +const int mxstep = 50000; CVODEBase::CVODEBase() : _species_var()