refinement: free-memory preflight for every level before any device work

Restores the PeriodicBlockStepper safeguard dropped in 8e1feff, for all
FixedPatchStepper levels: both G buffers, halo pairs and boundary columns
of every level are compared with cuda.mem_get_info() before the stream,
any module or any buffer exists, raising MemoryError('level buffers exceed
free device memory'). Transfer tables are not counted (lower bound).

Tests: the single-level MemoryError case is back beside the param-layout
check (no stream, no allocation); host test_single_level covers depth 1
and depth 2 (no stream, build or allocation) and the wait failure after a
good step (count stays 1). Driver-mocking fixtures report ample free memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-10-27 01:10:15 +00:00
co-authored by Claude Opus 5.5
parent 8c776309c9
commit 19db7d362f
9 changed files with 57 additions and 8 deletions
@@ -28,6 +28,7 @@ def host_module():
from CelerisLab.body.jets import surface_link_velocity
module.__dict__.update(cuda=Mock(),compiler=Mock(),
surface_link_velocity=surface_link_velocity)
module.cuda.mem_get_info.return_value=(1<<40,1<<40) # free-memory preflight passes
exec(compile(tree,str(path),'exec'),module.__dict__)
return module