test: add bounded dense-root Jet CV temporal diagnostics
This commit is contained in:
1 parent
9805383f9c
commit
80546a0d95
5 files changed
+430
-25
No files matched your search
@@ -350,6 +350,10 @@ def run_case(c, ctx, output, provenance, continuation=False):
|
||||
for name in ("uniform_adapter", "amr_api")
|
||||
}
|
||||
|
||||
from jet_cv_measurements import absolute_aperture_interval_mass
|
||||
|
||||
cumulative_absolute_aperture_mass = np.zeros(2)
|
||||
|
||||
def capture(step):
|
||||
ug = uniform.download()
|
||||
levels = amr.download()
|
||||
@@ -381,6 +385,10 @@ def run_case(c, ctx, output, provenance, continuation=False):
|
||||
for name in ("uniform_adapter", "amr_api")
|
||||
]
|
||||
)
|
||||
if c.get("dense_root", False):
|
||||
recorder.records[-1][
|
||||
"raw_absolute_aperture_mass_cumulative"
|
||||
] = cumulative_absolute_aperture_mass.copy()
|
||||
return data, error, aperture
|
||||
|
||||
previous, _, previous_aperture = capture(0)
|
||||
@@ -427,7 +435,17 @@ def run_case(c, ctx, output, provenance, continuation=False):
|
||||
np.testing.assert_allclose(
|
||||
ar.sum(axis=0)[:2], obs["total"]["impulse"], atol=1e-13, rtol=1e-13
|
||||
)
|
||||
for name, rr in [("uniform_adapter", ur), ("amr_api", ar)]:
|
||||
np.testing.assert_allclose(
|
||||
ar[:, 3].sum(), obs["total"]["mass_into_fluid"], atol=1e-13, rtol=1e-13
|
||||
)
|
||||
for backend_index, (name, rr) in enumerate(
|
||||
[("uniform_adapter", ur), ("amr_api", ar)]
|
||||
):
|
||||
cumulative_absolute_aperture_mass[
|
||||
backend_index
|
||||
] += absolute_aperture_interval_mass(
|
||||
rr, masks["blowing"], masks["suction"]
|
||||
)
|
||||
for k, mask in masks.items():
|
||||
subtotal = rr[mask].sum(axis=0)
|
||||
accumulated[name][k] += subtotal
|
||||
@@ -519,8 +537,12 @@ def run_case(c, ctx, output, provenance, continuation=False):
|
||||
physics_validation_pass=False,
|
||||
precision="FP32 evolution, FP64 host diagnostics",
|
||||
)
|
||||
(output / f"re{c['re_d']}_s{c['scale']}.json").write_text(
|
||||
json.dumps(payload, indent=2) + "\n"
|
||||
from jet_cv_measurements import write_evidence_text
|
||||
|
||||
write_evidence_text(
|
||||
output / f"re{c['re_d']}_s{c['scale']}.json",
|
||||
json.dumps(payload, indent=2) + "\n",
|
||||
dense_root=c.get("dense_root", False),
|
||||
)
|
||||
print(
|
||||
json.dumps(
|
||||
@@ -552,12 +574,22 @@ def main():
|
||||
action="store_true",
|
||||
help="Fixed measurement campaign: Re100, scale1/2, 3200 reference steps",
|
||||
)
|
||||
p.add_argument(
|
||||
"--dense-root",
|
||||
action="store_true",
|
||||
help="Bounded ref0..800 scalar diagnostics at every root interval; sparse rays/fields",
|
||||
)
|
||||
p.add_argument("--plan", action="store_true")
|
||||
a = p.parse_args()
|
||||
if a.steps <= 0 or a.steps > 3200:
|
||||
p.error("steps must be 1..3200")
|
||||
if a.re == 400 and not a.allow_re400:
|
||||
p.error("Re400 requires explicit conditional-campaign opt-in")
|
||||
if a.dense_root:
|
||||
if a.continuation or a.scale not in (1, 2) or a.re != 100 or a.steps != 800:
|
||||
p.error(
|
||||
"--dense-root requires --re 100 --scale 1/2 --steps 800, without --continuation"
|
||||
)
|
||||
if a.continuation:
|
||||
if a.scale not in (1, 2) or a.re != 100 or a.steps != 3200:
|
||||
p.error("--continuation requires --re 100 --scale 1/2 --steps 3200")
|
||||
@@ -575,12 +607,28 @@ def main():
|
||||
post_ready_budget_seconds=1200 if a.scale == 1 else 5400,
|
||||
runtime_estimate_seconds=[210, 500] if a.scale == 1 else [900, 3200],
|
||||
)
|
||||
if a.dense_root:
|
||||
from jet_cv_measurements import sample_steps, old_sample_steps, factors
|
||||
|
||||
c.update(
|
||||
dense_root=True,
|
||||
measurement_schema=2,
|
||||
reference_conversion=factors(a.scale),
|
||||
post_ready_budget_seconds=1200 if a.scale == 1 else 5400,
|
||||
runtime_estimate_seconds=[60, 240] if a.scale == 1 else [600, 2400],
|
||||
)
|
||||
c.update(
|
||||
sample_count=len(sample_steps(c)),
|
||||
sparse_ray_sample_count=len(old_sample_steps(c)),
|
||||
scalar_sample_dt_reference=1 / a.scale**2,
|
||||
raw_interval_dt_reference=1 / a.scale**2,
|
||||
)
|
||||
plan = dict(
|
||||
case=c,
|
||||
required_revision=PIN,
|
||||
required_free_device_mib=1024,
|
||||
estimated_peak_device_mib=128 * a.scale**2,
|
||||
estimated_output_mib=64 if a.continuation else 2,
|
||||
estimated_output_mib=32 if a.dense_root else (64 if a.continuation else 2),
|
||||
max_steps=c["steps"],
|
||||
gpu_launch_owner="root; this runner does not select or reserve a GPU",
|
||||
)
|
||||
@@ -612,7 +660,9 @@ def main():
|
||||
free, total = cuda.mem_get_info()
|
||||
if free < max(1024, 2 * plan["estimated_peak_device_mib"]) * 1024**2:
|
||||
raise RuntimeError("Insufficient free device memory")
|
||||
run_case(c, ctx, a.output, provenance, continuation=a.continuation)
|
||||
run_case(
|
||||
c, ctx, a.output, provenance, continuation=a.continuation or a.dense_root
|
||||
)
|
||||
print(
|
||||
json.dumps(
|
||||
dict(status="COMPLETE_DIAGNOSTIC_ONLY", physics_validation_pass=False)
|
||||
|
||||
Reference in new issue
Block a user