Skip to content

Commit

Permalink
Fix capturing SUNDIALS warnings after 7.1.1 upgrade
Browse files Browse the repository at this point in the history
Disable SUNDIALS's warning-handling through `SUNLogger`.
Instead pipe everything both errors and warnings through
the provided`SUNErrHandlerFn`.

For details, see #2550.

Fixes #2550.
  • Loading branch information
dweindl committed Oct 18, 2024
1 parent c8778e5 commit e8d9910
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ThirdParty/sundials/src/cvodes/cvodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -9930,6 +9930,8 @@ void cvProcessError(CVodeMem cv_mem, int error_code, int line, const char* func,
break;
}

/* AMICI: https://github.com/AMICI-dev/AMICI/issues/2550 */
#ifdef AMICI_SUNLOGGER_WARNINGS
if (error_code == CV_WARNING)
{
#if SUNDIALS_LOGGING_LEVEL >= SUNDIALS_LOGGING_WARNING
Expand All @@ -9940,6 +9942,7 @@ void cvProcessError(CVodeMem cv_mem, int error_code, int line, const char* func,
#endif
break;
}
#endif

/* Call the SUNDIALS main error handler */
SUNHandleErrWithMsg(line, func, file, msg, error_code, cv_mem->cv_sunctx);
Expand Down
3 changes: 3 additions & 0 deletions ThirdParty/sundials/src/idas/idas.c
Original file line number Diff line number Diff line change
Expand Up @@ -8779,6 +8779,8 @@ void IDAProcessError(IDAMem IDA_mem, int error_code, int line, const char* func,
break;
}

/* AMICI: https://github.com/AMICI-dev/AMICI/issues/2550 */
#ifdef AMICI_SUNLOGGER_WARNINGS
if (error_code == IDA_WARNING)
{
#if SUNDIALS_LOGGING_LEVEL >= SUNDIALS_LOGGING_WARNING
Expand All @@ -8789,6 +8791,7 @@ void IDAProcessError(IDAMem IDA_mem, int error_code, int line, const char* func,
#endif
break;
}
#endif

/* Call the SUNDIALS main error handler */
SUNHandleErrWithMsg(line, func, file, msg, error_code, IDA_mem->ida_sunctx);
Expand Down

0 comments on commit e8d9910

Please sign in to comment.