Skip to content

Centralized Fortran logging#108

Open
aoymt wants to merge 21 commits into
sissaschool:develfrom
aoymt:logger
Open

Centralized Fortran logging#108
aoymt wants to merge 21 commits into
sissaschool:develfrom
aoymt:logger

Conversation

@aoymt

@aoymt aoymt commented Mar 30, 2026

Copy link
Copy Markdown

Summary

This pull request introduces a shared logging facility in m_common, then migrates a large portion of the codebase from write usage to that API. The goal is more consistent, controllable diagnostics across TurboRVB tools and drivers.

What changed

New modules and provenance

  • Logging stack: The files stdlib_logger.f90, stdlib_ascii.f90, stdlib_kinds.f90, and stdlib_optval.f90 are taken from the Fortran standard library (fortran-lang/stdlib), copied into src/m_common/, and adapted locally so they build and integrate cleanly inside TurboRVB (this is not a full stdlib subtree).

  • Project-specific layer: logger_io.f90 is a TurboRVB-specific thin wrapper around stdlib_logger for convenient call sites. tostring.f90 (M_tostring) provides generic-to-string conversion used by that wrapper; it follows a pattern described on Fortran Wiki — tostring.

  • Build: m_common/CMakeLists.txt is updated to compile and link these new sources.

Call-site migration

  • Fortran sources across major areas (a_convertfort10, a_convertfort10mol, a_convertfortpfaff, a_makefort10, a_prep, a_readforward, a_tools, a_turborvb, b_complex, and many m_common utilities) now route diagnostics through the new logging layer instead of scattered direct output, with related cleanups where output paths were touched.

Licensing

Vendored stdlib-derived sources remain subject to the Fortran stdlib license (typically MIT). The authoritative license text is in per-file notices where present.

Notes

  • The diff is wide but largely mechanical: the same information is routed through the new logging API. Spot-check a few representative binaries (e.g. prep, turborvb, a couple of a_tools programs) for expected stdout/stderr behavior and log levels.
  • Confirm MPI / parallel runs still produce sensible output (e.g. no unintended duplication or lost messages on non-root ranks), if that was a design goal of this branch.
  • Limitation: The present implementation of logger_io do not directly handle arrays; they are printed elementwise via do-loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant