Skip to content

Log to the console on rank 0 only in parallel runs - #204

Merged
BenjaminRodenberg merged 1 commit into
mainfrom
mpi-console-logging-rank-0
Oct 21, 2026
Merged

BenjaminRodenberg merged 1 commit into
mainfrom
mpi-console-logging-rank-0

Conversation

@BenjaminRodenberg

Copy link
Copy Markdown
Collaborator

In a run on several MPI ranks, every rank printed every console message, so N ranks repeated each line N times. On main this already affects runs on a partitioned Elmer mesh (--is-partitioned-elmer-mesh) on several ranks.

With this PR, rank 0 logs to the console at --log-level-console, and the other ranks only log warnings and errors there. A per-rank override in stdout_individual_log_levels still takes precedence. The per-rank log files (--log-file) keep the full level. print_time now logs the model time instead of printing it, so it follows the same rule.

Changes:

  • setup_logging (src/ebfm/core/logger.py): ranks other than 0 use at least WARNING for the console.
  • print_time (src/ebfm/core/LOOP_general_functions.py): logger.info instead of print.
  • Help text of --log-level-console.
  • New unit test tests/core/test_logger.py for the console level per rank, including the per-rank override.

The change comes from ade4fba of #197. #202 carries a copy of it (aa0d46c) and drops that copy once this PR lands.

🤖 Generated with Claude Code

@BenjaminRodenberg BenjaminRodenberg self-assigned this Oct 21, 2026
@BenjaminRodenberg BenjaminRodenberg added the usability Improves the user experience label Oct 21, 2026
Every rank printed every message, so a run on N ranks repeated each
line N times. Ranks other than 0 now only log warnings and errors to
the console; log files per rank keep the full level. print_time logs
instead of printing.

Taken from ade4fba of #197.

Assisted-by: Claude Code:claude-opus-5-5
@BenjaminRodenberg
BenjaminRodenberg force-pushed the mpi-console-logging-rank-0 branch from c7cb83b to eef76a5 Compare October 21, 2026 15:45
@BenjaminRodenberg
BenjaminRodenberg merged commit 2c90974 into main Oct 21, 2026
34 checks passed
@BenjaminRodenberg BenjaminRodenberg added this to the v0.9.0 milestone Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

usability Improves the user experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant