Skip to content

Logger simplify - #355

Open
jacob-moore22 wants to merge 3 commits into
mainfrom
Logger_simplify
Open

jacob-moore22 wants to merge 3 commits into
mainfrom
Logger_simplify

Conversation

@jacob-moore22

@jacob-moore22 jacob-moore22 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Simplifies fierro::Logger and removes unused #includes across the multiphysics app.

Logger (common/include/logger.hpp, new common/src/logger.cpp)

  • Rewrote the 950-line header-only logger as a ~95-line header plus a small .cpp. Removed the GPU-kernel logging path, which nothing used (Handle, FLOG_DEV, log_handle(), device ring buffers, StdoutTarget, all_ranks(), set_file_prefix). The header no longer includes Kokkos.
  • Log levels are unchanged: Trace < Debug < Info < Warn < Error < Off, with trace/debug/info/warn/error, log(lvl, ...), set_level() and level().
  • Uses printf-style C varargs with __attribute__((format(printf, ...))), so call sites now get compile-time format checking. This fixes the clang -Wformat-security warnings that came from the old logger.hpp:418.
  • MPI: rank and size are read once in the constructor. Each rank writes to Fierro_log_<rank>, and rank 0 also writes to stdout. Lines are tagged [rank N][LEVEL]. flush() is no longer collective, so it is safe in loops whose trip count differs between ranks.
  • Solver::log_handle() is removed. Solver::log and set_logger are unchanged, and no info/error/flush call sites changed.

Header cleanup

  • Removed 106 unused #includes from 36 files. The candidates came from clang-include-cleaner. Removals that were only safe through transitive includes were put back, and every matar.h/ELEMENTS.h include was kept.
  • Removed the unused logger.hpp include from region_fill.hpp.

Behavior notes

  • Rank 0's terminal output now appears when each line is logged, instead of at the next flush(). The content and order are the same.
  • Messages are no longer truncated at 512 bytes.
  • This removes public logger API (listed above) that nothing in the tree uses. Any out-of-tree code that used it will need updating.

No new dependencies.

Type of change

Please select all relevant options

  • Bug fix (non-breaking change which fixes an issue)
  • Formatting and/or style fixes
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Test A: Full rebuild of Fierro, then regression_tests/test_refactor.py against build/app/Fierro. 35/35 tests pass, and the results match the pre-change baseline.
  • Test B: Ran an SGH 3D case with mpirun -np 1 and -np 4 (--oversubscribe).
    • Fierro_log_0..3 are created with each rank's lines, and only rank 0 prints to stdout.
    • The run exits cleanly with no hang.
    • Calling set_level(LogLevel::Warn) hides info lines while warn and error lines still print.
  • Test C: Compiled each of the 17 headers that lost includes on its own, to confirm none of them relies on an include that was removed.

Not yet tested: clang/Apple clang, CUDA/HIP builds, and the regression suite on more than one rank.

Test Configuration:

  • OS version: Fedora Linux 43 (kernel 7.1.12)
  • Hardware: AMD Ryzen AI 9 HX 370 (24 threads), CPU only
  • Compiler: GCC 15.3.1, Open MPI 5.0.8, Kokkos OpenMP + Serial backends

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • The code builds from scratch with my new changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@jacob-moore22 jacob-moore22 self-assigned this Oct 19, 2026
@jacob-moore22 jacob-moore22 added the enhancement New feature or request label Oct 19, 2026

This branch has not been deployed

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant