From e8d991053b89b6b30556a110118cf796a4e4fb07 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 18 Oct 2024 07:28:19 +0200 Subject: [PATCH] Fix capturing SUNDIALS warnings after 7.1.1 upgrade Disable SUNDIALS's warning-handling through `SUNLogger`. Instead pipe everything both errors and warnings through the provided`SUNErrHandlerFn`. For details, see #2550. Fixes #2550. --- ThirdParty/sundials/src/cvodes/cvodes.c | 3 +++ ThirdParty/sundials/src/idas/idas.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ThirdParty/sundials/src/cvodes/cvodes.c b/ThirdParty/sundials/src/cvodes/cvodes.c index 55399d7349..228911bee3 100644 --- a/ThirdParty/sundials/src/cvodes/cvodes.c +++ b/ThirdParty/sundials/src/cvodes/cvodes.c @@ -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 @@ -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); diff --git a/ThirdParty/sundials/src/idas/idas.c b/ThirdParty/sundials/src/idas/idas.c index 3174660c12..1f3c3b5935 100644 --- a/ThirdParty/sundials/src/idas/idas.c +++ b/ThirdParty/sundials/src/idas/idas.c @@ -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 @@ -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);