sundials icon indicating copy to clipboard operation
sundials copied to clipboard

Feature: Logging Updates

Open gardner48 opened this issue 1 year ago • 4 comments

Follow on to utilities added in #499

  • Make info logging output in the integrators more consistent
  • Update parser for MRI methods
  • Add function to extract lists of data for plotting
  • Add example scripts using log parser

gardner48 avatar Jun 08 '24 21:06 gardner48

Checkout https://github.com/LLNL/sundials/blob/feature/nls-switching-v7-gs/src/sundials/sundials_logger_impl.h#L35. Now that we have C99 we can change all the logging statements in the code to use a variadic macro and it makes the logging statements much cleaner and gets rid of the repetitive preprocessor checks. My intent was to bring this over from that branch. I can do that here if you think it looks good.

balos1 avatar Jun 10 '24 15:06 balos1

Checkout https://github.com/LLNL/sundials/blob/feature/nls-switching-v7-gs/src/sundials/sundials_logger_impl.h#L35. Now that we have C99 we can change all the logging statements in the code to use a variadic macro and it makes the logging statements much cleaner and gets rid of the repetitive preprocessor checks. My intent was to bring this over from that branch. I can do that here if you think it looks good.

I was going to ask if you still had the variadic macros from the original logging implementation on another branch. I think switching over to those would be great.

It would also be nice to have an "If" version of the macros i.e., something like SUNLogInfoIf that takes an additional boolean input to change cases like

#if SUNDIALS_LOGGING_LEVEL >= SUNDIALS_LOGGING_INFO
      if (kflag != ARK_SUCCESS)
      {
        SUNLogInfo(ARK_LOGGER, __func__, "end-step-attempt", "status = failed solve, kflag = %i", kflag);
      }
#endif

into something like

SUNLogInfoIf(kflag != ARK_SUCCESS, ARK_LOGGER __func__, "end-step-attempt", "status = failed solve, kflag = %i", kflag);

gardner48 avatar Jun 10 '24 16:06 gardner48

@gardner48 The "if" version sounds like a nice addition as well.

balos1 avatar Jun 13 '24 18:06 balos1

1. Add the integer values that correspond with each logging level (`SUN_LOGLEVEL_ALL`, `SUN_LOGLEVEL_NONE`, ...).  Currently, users are asked for a numerical logging level value by CMake, which can only be found hidden inside `include/sundials/sundials_logger.h`.

The logging documentation directs users to the documentation for the CMake option here which lists the numeric values and associated logging level.

2. The end of this file has an incredibly brief section on "Example Usage" for the logger.  Could you add a few step-by-step "case studies" showing how a user could
   
   * configure SUNDIALS with an "appropriate" logging level
   * set environment variables to hold the "relevant" log file(s)
   * run an existing SUNDIALS example
   * use one of `tools/log_example.py` or `tools/log_example_mri.py`, e.g., to plot the step size history as a function of time.

I'll update that section with additional information shortly.

gardner48 avatar Oct 02 '24 22:10 gardner48

The logging statements in all the ARKODE steppers have been updated now and CI tests added for each

gardner48 avatar Dec 10 '24 16:12 gardner48