Skip to content

Conversation

sbstndb
Copy link
Contributor

@sbstndb sbstndb commented Oct 3, 2025

  • Removed automatic output redirection for ranks != 0, no more rdbuf(/dev/null). Ref: include/samurai/samurai.hpp:70
  • Introduced samurai::io::{print,eprint} with scopes root, all, rank(n) to control where to print. Ref: include/samurai/print.hpp:1
  • New --print-root-only flag to restore historical behavior (default printing only on rank 0). Ref: include/samurai/arguments.hpp:28
  • Replaces the old --dont-redirect-output flag (removed) and flips the default semantics.
  • Migration examples: replace std::cout/std::cerr with samurai::io::{print,eprint}, or run with --print-root-only to get “root-only” mode. Ref: include/samurai/samurai.hpp:100

Printing examples:

  • Default ( --print-root-only): samurai::io::print("Hi {}\n", name);
  • Root stderr: samurai::io::eprint(samurai::io::root, "Error: {}\n", msg);
  • Specific-rank stderr: samurai::io::eprint(samurai::io::rank(1), "Only rank 1\n");
  • With streamed object: samurai::io::print(samurai::io::all, "{}\n", fmt::streamed(obj));

Note: I am proposing this PR because it seems useful for users, but I am open to discussion (use of fmt vs std, defaults, naming, etc.).

  • I have installed pre-commit locally and use it to validate my commits.
  • The PR title follows the conventional commits convention.
    Available tags: 'build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test'
  • This new PR is documented.
  • This new PR is tested.

Related issue

Global output redirection was unsafe: it overrode all std::cout without user control.

Code of Conduct

By submitting this PR, you agree to follow our Code of Conduct

  • I agree to follow this project's Code of Conduct

sbstndb added 30 commits October 3, 2025 15:46
	-	Now all print use fmt instead of std::cout.
…tended eprint changes and stray includes in FV headers (part 1)
…des in explicit flux-based schemes"

This reverts commit c5e8ef4.
…ert unintended eprint changes and stray includes in FV headers (part 1)"

This reverts commit 4fbdc57.
…nclude/ (excluding timers.hpp); add includes and fmt::streamed where needed
…> includes where print.hpp is already included
…M tests, highorder, set_operator, p4est simple_2d, WENO examples, bubble_2d; add includes
…rint.hpp>; fix prediction_map to_stream; run clang-format
…or paths to prevent unformattable type errors in fmt; print placeholder instead
…d; include <xtensor/xio.hpp>; wrap xtensor prints in burgers_os.cpp
@sbstndb sbstndb changed the title feat: print MPI - wrapper fmt et contrôle explicite de la redirection feat: print MPI - wrapper fmt and explicit control of redirection Oct 3, 2025
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