Skip to content

improve options monitor

Vaclav Hapla requested to merge haplav/improve-options-monitor into master

Inspired by #600 (closed), I have looked at how options monitoring works and tried to improve it. The problem with the current state is -options_monitor has effect only after PetscOptionsSetFromOptions which is called after majority of options are already set. So it's useful only if one inserted the options programmatically but then also the monitor can be set programmatically, so there's no point actually.

  • -options_monitor and -options_monitor_cancel have immediate effect
    • no need to call for PetscOptionsSetFromOptions
  • PetscOptionsMonitorDefault now uses plain PetscPrintf if NULL context (viewer) is passed
    • so we can avoid creating a viewer early in PetscInitialize
  • -options_monitor_cancel cancels just hard-wired monitors
  • Deprecate PetscOptionsSetFromOptions
  • Remove PetscOptionsMonitorCancel
  • Introduce concept of options with absolute precedence
    • -options_monitor,-options_monitor_cancel,-h,-help,-skip_petscrc,-options_file_yaml,-options_string_yaml
  • PetscOptionsInsert: improve -skip_petscrc handling
  • Call PetscOptionsInsertArgs just once per PetscOptionsInsert
  • Improve related manpages
  • PetscOptionsStringToBool: return TRUE for empty/NULL string

This also possibly enables monitoring the source of the option (command-line / filename / environment variable) in a future MR.

Questions

  • should PetscOptionsMonitorCancel be deprecated rather than removed - but what would it do then

TODO

  • fix petsc4py issues
  • update changelog
Edited by Vaclav Hapla

Merge request reports