Skip to content

Small fixes: serial BC files every save, no-MPI reductions, format/lint/validator tooling - #2118

Open
sbryngelson wants to merge 2 commits into
MFlowCode:masterfrom
sbryngelson:tooling-fixes
Open

sbryngelson wants to merge 2 commits into
MFlowCode:masterfrom
sbryngelson:tooling-fixes

Conversation

@sbryngelson

@sbryngelson sbryngelson commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Developed with AI assistance (Claude Code).

Contribution Policy

All contributions are expected to demonstrate:

  • A clear understanding of the codebase
  • Alignment with product direction
  • Thoughtful reasoning behind changes
  • Evidence of real-world usage or hands-on experience with the problem

Summary

Small fixes and tooling found while preparing #2116 (solver performance) and #2117 (AMR), split out so they can be
reviewed on their own. Independent of both; #2117 includes these commits until this merges.

  • Serial boundary files every save: serial readers (post_process, restart) need bc_type.dat and bc_buffers.dat in
    each step directory, not only step 0. s_write_serial_boundary_condition_files now takes the packed buffers, so pre and
    sim share it. (The bc_type dummy-shape fix that was here landed separately in Match bc_type dummy shapes to the (1:num_dims, 1:2) actual #2143.)
  • format.sh: ffmt reports unmatched block structure as a warning and exits 0; the script now shows stderr and fails
    on those warnings (the source would not compile).
  • No-MPI scalar reductions (bug): without MPI, s_mpi_allreduce_sum/_min/_max left the output unset; they now
    return their input.
  • Cray debug builds get -h bounds, as the other compilers' debug builds already check bounds.
  • Run template: the mpirun launcher exports the Open MPI 4 and 5 oversubscribe settings, so runs with more ranks
    than cores work (small CI runners refused -np 4), and warns when it oversubscribes.
  • Source lint: rejects per-executable preprocessor guards (MFC_PRE_PROCESS, ...), which the sources no longer use.
  • Validator: derives cfl_dt from cfl_adap_dt/cfl_const_dt like the Fortran; rejects MHD with Euler bubbles and a
    non-positive rburn%pign.

Verification

No golden changes. These commits are also in #2117, whose full regression passes on Frontier (amdflang OpenMP, CCE
OpenACC and OpenMP) and on A100 (NVHPC 25.11 OpenACC; OpenMP builds). CI passes on this branch alone, including the
no-MPI NVHPC CPU build and the Open MPI 5 GNU runners these fixes target.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Claude Code Review

Head SHA: ac07222

Files changed:

  • 12
  • cmake/GPU.cmake
  • docs/documentation/contributing.md
  • src/common/m_boundary_io.fpp
  • src/common/m_mpi_common.fpp
  • src/pre_process/m_data_output.fpp
  • src/simulation/m_data_output.fpp
  • toolchain/bootstrap/format.sh
  • toolchain/mfc/case_validator.py
  • toolchain/mfc/lint_source.py
  • toolchain/templates/default.mako

Findings:

  • medium toolchain/templates/default.mako: OMPI_MCA_rmaps_base_oversubscribe=1 and PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe are exported for every mpirun launch, not only when ranks exceed nproc. The warning is already gated on ranks > avail, so the export can sit inside the same if. As written, a mistaken rank count that Open MPI would normally reject now runs silently oversubscribed on any machine where nproc is correct. nproc honours the affinity mask and cgroup, so the warning can also misfire. Confidence: moderate, and this is a behaviour choice more than a bug.
  • medium src/simulation/m_data_output.fpp: s_write_serial_data_files now calls s_write_serial_boundary_condition_files at every output step. That routine writes the host bc_buffers, which simulation fills only from the startup read, as the new comment in m_boundary_io.fpp says. Every step directory therefore gets the startup buffers, not the current state. This is harmless if the readers only need startup values, such as non-reflective or characteristic BCs reading the t=0 profile. I could not confirm that against the readers, so please confirm. The call is also repeated per rank with unit 1 and status='new', which is fine only because the directory was just recreated. Confidence: low to moderate.

The other hunks in m_boundary_io.fpp, m_data_output.fpp and m_mpi_common.fpp, and the case_validator.py, lint_source.py and format.sh changes, look consistent with their callers and comments. The new serial-only-fallback else branches in the s_mpi_allreduce_* routines are correct. The bc_type bounds change to 1:2 matches the allocation in m_time_steppers.fpp. A grep of src/ found no remaining MFC_PRE_PROCESS, MFC_SIMULATION or MFC_POST_PROCESS guards, so the new lint check will not fail on existing code.

@sbryngelson
sbryngelson marked this pull request as ready for review November 3, 2026 18:04
@sbryngelson
sbryngelson requested a review from a team as a code owner November 3, 2026 18:04
@sbryngelson
sbryngelson requested review from wilfonba and removed request for a team November 3, 2026 18:04
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.27%. Comparing base (7b16d32) to head (c3c6f9e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2118   +/-   ##
=======================================
  Coverage   64.27%   64.27%           
=======================================
  Files          89       89           
  Lines       23733    23734    +1     
  Branches     3402     3403    +1     
=======================================
+ Hits        15255    15256    +1     
  Misses       5863     5863           
  Partials     2615     2615           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbryngelson sbryngelson changed the title Small fixes: bc_type dummy shape, serial BC files every save, format/lint/validator tooling Small fixes: bc_type dummy shape, serial BC files every save, no-MPI reductions, format/lint/validator tooling Nov 4, 2026
…ir input; fail format on ffmt structure warnings; Cray debug bounds checking; Open MPI oversubscribe; stage-guard lint; validator fixes
@sbryngelson sbryngelson changed the title Small fixes: bc_type dummy shape, serial BC files every save, no-MPI reductions, format/lint/validator tooling Small fixes: serial BC files every save, no-MPI reductions, format/lint/validator tooling Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Lines of Code

File Lines Diff
src/common/m_mpi_common.fpp 1518 +6
src/simulation/m_data_output.fpp 1923 +4
src/common/m_boundary_io.fpp 319 -3
src/pre_process/m_data_output.fpp 677 +1
Directory Lines Diff
common 10654 +3
pre_process 5073 +1
simulation 30010 +4
total 49177 +8

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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant