toolchain: batch example-case validation in precheck (~7x faster)#1634
Merged
sbryngelson merged 1 commit intoJul 8, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR speeds up ./mfc.sh precheck by batching validation of all examples/*/case.py files into a single ./mfc.sh validate invocation, avoiding repeated toolchain/venv bootstrap overhead while preserving the historical “only fail on load/parse errors” behavior.
Changes:
- Add a multi-file validation path in
toolchain/mfc/validate.pyto load and constraint-check many cases in one process. - Update the CLI to accept one or more positional
inputfiles (nargs="+") and normalize them to absolute paths. - Change
precheck.shexample-case validation step from a per-case loop to a single batched validate call.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| toolchain/mfc/validate.py | Adds _validate_batch() and routes multi-file inputs through it. |
| toolchain/mfc/cli/commands.py | Changes validate positional input to accept multiple files (nargs="+"). |
| toolchain/mfc/args.py | Converts input to absolute paths when it is a list (multi-file validate). |
| toolchain/bootstrap/precheck.sh | Replaces serial per-case validate loop with one batched validate invocation. |
This comment was marked as resolved.
This comment was marked as resolved.
The precheck example-case step (7/7) ran './mfc.sh validate' once per case in a serial loop over all 155+ examples/*/case.py. Each invocation re-paid the mfc.sh/venv bootstrap (~2.4s), which dominated (~90%) the ~6.5min serial cost. Validate now accepts multiple case files (nargs="+") and validates them all in ONE process (_validate_batch): load+constraint-check each, fail only on a load error - matching the historical per-file exit behavior. precheck.sh calls './mfc.sh validate examples/*/case.py' once. Full precheck drops from ~394s to ~51s (~7x) on an idle node; correctness unchanged (all cases still validated). Batch mode still surfaces cases with constraint issues (listed in the summary, exit 0) so the output is not misleading, and --migrate with multiple files fails fast (it rewrites a file in place - single-case only) instead of a silent no-op. VALIDATED: full precheck green (all 7 checks); batch validates 158/158 cases in one process; single-file './mfc.sh validate' path unchanged.
ff5ced2 to
55b3562
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1634 +/- ##
==========================================
+ Coverage 60.88% 61.07% +0.18%
==========================================
Files 83 83
Lines 19836 19925 +89
Branches 2953 2975 +22
==========================================
+ Hits 12077 12169 +92
+ Misses 5767 5753 -14
- Partials 1992 2003 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
drcole17
added a commit
to cmtl-wpi/MFC-drcole
that referenced
this pull request
Jul 9, 2026
Sync 8 upstream commits: BC-routine unification (MFlowCode#1629), synthetic turbulence (MFlowCode#1548), extrusion v3 (MFlowCode#1349), amdflang CPU builds (MFlowCode#1635), batched example validation (MFlowCode#1634). Conflicts (all 'both added, keep both'): - m_global_parameters_common.fpp: thermal_conduction + synthetic_turbulence GPU_DECLAREs - m_checker.fpp: thermal_conduction/visc_model + synthetic_turbulence checks - m_start_up.fpp: conduction finalize + broadened body-forces finalize condition Verified: all 3 targets build+install on gfortran CPU. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
./mfc.sh precheck's example-case step (check 7/7) ran./mfc.sh validateonce per case in a serial loop over all 155examples/*/case.py. Each invocation re-paid themfc.sh/venv bootstrap (~2.4s), which dominated (~90%) the ~6.5 min serial cost of that step.validatenow accepts multiple case files (nargs="+") and validates them all in one process: load + constraint-check each, failing only on a genuine load/parse error — matching the historical per-file exit behavior (a single./mfc.sh validateexits non-zero only on a load error; constraint issues are warnings).precheck.shcalls./mfc.sh validate examples/*/case.pyonce instead of looping.Impact
precheck(idle node)validatecallsCorrectness is unchanged — all 155 cases are still loaded and constraint-checked; only the process/bootstrap overhead is removed. The single-file
./mfc.sh validate case.pypath is untouched.Changes (4 files, +52/−14)
toolchain/mfc/validate.py—_validate_batch()for the multi-file pathtoolchain/mfc/cli/commands.py—validatepositional gainsnargs="+"toolchain/mfc/args.py— abspath loop handles the list casetoolchain/bootstrap/precheck.sh— step 7 is a single batchedvalidatecallValidation
Full
precheckgreen (all 7 checks) — the commit's own pre-commit hook prechecked itself in ~56 s. Batch validates 155/155 example cases in one process.