From 624e9ad6a527c3520caad3eee93e3d83a2d6521d Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 17 Feb 2025 09:46:41 +0100 Subject: [PATCH] Disable CvodeF checkpointing (#2645) amici wants to avoid sundials' checkpointing, that's we set `steps` (the number of integration steps at which a checkpoint is created) for `CVodeAdjInit` to the maximum number of integration steps (`mxsteps`) for the forward problem. However, the checkpoint is created at step `steps`, not at step `steps + 1`. Therefore, if the forward integration takes exactly `mxsteps`, a checkpoint is still created. This is not a problem per se, but it may trigger segfaults under circumstances not fully understood (-> https://github.com/LLNL/sundials/issues/49). Although unlikely, it still occasionally crashes long running optimizations. This change should make sure that checkpointing never occurs. --- src/solver_cvodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solver_cvodes.cpp b/src/solver_cvodes.cpp index 9ef289ea4d..8d34fedfb4 100644 --- a/src/solver_cvodes.cpp +++ b/src/solver_cvodes.cpp @@ -716,7 +716,7 @@ void CVodeSolver::adjInit() const { status = CVodeAdjReInit(solver_memory_.get()); } else { status = CVodeAdjInit( - solver_memory_.get(), static_cast(maxsteps_), + solver_memory_.get(), static_cast(maxsteps_ + 1), static_cast(interp_type_) ); setAdjInitDone();