Skip to content

Commit 4c1c1d9

Browse files
committed
fp-stability: add --force to bypass the user-case size guard
The cells/cell-steps feasibility guard protects against accidentally launching hours of Verrou runs, but offered no escape hatch for users who knowingly want a larger grid or more time steps. --force runs the case anyway, printing the expected cost multiple and a reminder to trim passes (-N 1, --no-*). Guard errors now mention the flag.
1 parent a395cb1 commit 4c1c1d9

2 files changed

Lines changed: 28 additions & 8 deletions

File tree

toolchain/mfc/cli/commands.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,12 @@
983983
default=False,
984984
dest="no_float_max",
985985
),
986+
Argument(
987+
name="force",
988+
help="Run a user case that exceeds the size feasibility guard anyway. Expect long runtimes: ~30x Verrou slowdown per run, times up to ~12 runs (trim passes with -N 1 and --no-* flags).",
989+
action=ArgAction.STORE_TRUE,
990+
default=False,
991+
),
986992
],
987993
examples=[
988994
Example("./mfc.sh fp-stability", "Auto-discover binaries and run the built-in suite"),
@@ -994,6 +1000,10 @@
9941000
Example("./mfc.sh fp-stability -N 10", "Run 10 random-rounding samples per case"),
9951001
Example("./mfc.sh fp-stability --no-vprec --no-cancellation", "Skip VPREC sweep and cancellation detection"),
9961002
Example("./mfc.sh fp-stability --no-cancellation --no-float-max", "Skip analysis passes"),
1003+
Example(
1004+
"./mfc.sh fp-stability big_case.py --force -N 1 --no-vprec --no-float-proxy",
1005+
"Run a case beyond the size guard, trimming passes to keep it tractable",
1006+
),
9971007
],
9981008
key_options=[
9991009
("--sim-binary PATH", "Serial simulation binary (debug, no-MPI)"),

toolchain/mfc/fp_stability.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545
./mfc.sh fp-stability --sim-binary PATH --pre-binary PATH
4646
4747
A user case .py is run as a single serial CPU process under Verrou, so it must be
48-
a small, short proxy (a feasibility guard rejects large grids / long runs); output
49-
is forced to serial .dat I/O and the files to diff are auto-detected.
48+
a small, short proxy (a feasibility guard rejects large grids / long runs; --force
49+
overrides it, at proportionally long runtimes); output is forced to serial .dat
50+
I/O and the files to diff are auto-detected.
5051
"""
5152

5253
import math
@@ -564,12 +565,21 @@ def _load_user_case(input_path: str) -> dict:
564565
cells = (m + 1) * (n + 1) * (p + 1)
565566
t_stop = int(params.get("t_step_stop", 0) or 0)
566567
work = cells * max(t_stop, 1)
567-
if cells > FP_CASE_MAX_CELLS:
568-
raise MFCException(f"case has {cells:,} cells - too large for Verrou (~30x slowdown, run many times). " f"Use a coarsened proxy (<= {FP_CASE_MAX_CELLS:,} cells).")
569-
if work > FP_CASE_MAX_WORK:
570-
raise MFCException(
571-
f"case is ~{work:,} cell-steps ({cells:,} cells x {t_stop} time steps) - too slow under "
572-
f"Verrou (~30x, run many times). Reduce m/n/p or t_step_stop (target <= {FP_CASE_MAX_WORK:,} cell-steps)."
568+
if not ARG("force"):
569+
if cells > FP_CASE_MAX_CELLS:
570+
raise MFCException(
571+
f"case has {cells:,} cells - too large for Verrou (~30x slowdown, run many times). " f"Use a coarsened proxy (<= {FP_CASE_MAX_CELLS:,} cells), or pass --force to run anyway."
572+
)
573+
if work > FP_CASE_MAX_WORK:
574+
raise MFCException(
575+
f"case is ~{work:,} cell-steps ({cells:,} cells x {t_stop} time steps) - too slow under "
576+
f"Verrou (~30x, run many times). Reduce m/n/p or t_step_stop (target <= {FP_CASE_MAX_WORK:,} cell-steps), or pass --force to run anyway."
577+
)
578+
elif cells > FP_CASE_MAX_CELLS or work > FP_CASE_MAX_WORK:
579+
cons.print(
580+
f" [bold yellow]--force[/bold yellow]: case is ~{work:,} cell-steps "
581+
f"(guard is {FP_CASE_MAX_WORK:,}) - expect roughly {work / FP_CASE_MAX_WORK:.0f}x the usual per-run time, "
582+
"for every enabled pass (trim with -N 1 and --no-* flags)."
573583
)
574584
stem = os.path.splitext(os.path.basename(input_path))[0]
575585
if stem == "case": # examples/<name>/case.py - the dir name is more telling

0 commit comments

Comments
 (0)