Repository navigation
perf(eager): CPML on strips; boundary saving for more equations; async cpu and disk storage - #118
Merged
Merged
Conversation
EagerOptions(cpml_strips=True) keeps each CPML memory field only on its absorbing strips. Equations mark FieldSpec.cpml_axis and pass the field the derivative is taken from to cpml_update / cpml_axis_update (_cpml.py); the eager propagator lays out the strips, boundary saving included. Also: a one-time notice while torch.compile builds the step, and an eager-strips column in the gradient matrix. Off by default and bit-identical to 317eb62 when off; strips vs full grid bit-identical uncompiled, gradient matrix 58/58.
…torage - Elastic3D step split into velocity / stress substeps; interior_substeps gives it eager boundary saving (free surface kept, APM refused). - BS ring storage: one row per step. 'cpu' copies through pinned memory on a side stream and prefetches the reverse pass, as fast as keeping the ring on the GPU; new 'disk' storage writes 4 temp files from background threads, I/O errors raise. - pinned_memory / disk_dir / transfer_interval / ring_buffers now reach eager. Gradients bit-identical across storages and to the previous storage code.
- DASMu/DASMu3D steps split into velocity | stress + strain halves and ElasticVRR into momentum | stress halves; func and interior_substeps share them, free surface kept. - Elastic 2D refuses eager BS with APM topography (bf16/int8 slipped past the self-check with a wrong gradient). - Docs: eager BS storage includes 'disk'. Default path bit-identical; BS vs full tape 3e-5 to 3e-4, with or without FS.
…adient - New equation flag supports_boundary_saving_eager, the eager/PropJax twin of supports_boundary_saving_c. ViscoAcoustic, AcousticVTI and AcousticTTI set it False (their BS gradients came out 2-10% off), so a boundary request raises. - Notebooks 07 and 19: eager boundary saving also stores to disk.
Forward, full-storage and boundary-saving gradients on eager, eager with CPML strips and c, for 2-D/3-D acoustic and elastic cases on one V100: steady-state time, compile time, peak memory and gradient agreement. Added to the HPC examples.
Every new eager propagator compiled its step on the CPU runner (5-40 s), and the FD tests build one per perturbation: CI went from ~4 to ~17 min. CPU physics tests now pass use_compile=False; test_compiled_stencil_slices compiles each case once and adds per-edge, topography and DASMu cases. Local CPU suite 787 s -> 377 s, all passing.
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.
Six commits on the eager propagator: CPML memory on the absorbing strips, boundary saving for more equations, faster host storage and a new disk storage for the boundary ring, a notebook that compares eager and
c, and a faster CPU test suite.Changes
EagerOptions(cpml_strips=True); off by default.FieldSpec.cpml_axisand pass the field the derivative comes from tocpml_update/cpml_axis_update(equations/_cpml.py).torch.compileis building the step.funcandinterior_substeps. Eager boundary saving therefore covers them, free surface included.supports_boundary_saving_eager, is the eager/PropJax counterpart ofsupports_boundary_saving_c. ViscoAcoustic, AcousticVTI and AcousticTTI set it toFalse, so a boundary request raises. Their boundary-saving gradients came out 2–10% off.storage='cpu'copies through pinned memory on a side stream and prefetches for the reverse pass.storage='disk'is new for eager. It stages the ring in pinned slots, and background threads write and read four temp files. I/O errors raise.pinned_memory,disk_dir,transfer_intervalandring_buffersnow reach the eager backend; before, they were dropped silently.con forward, full-storage and boundary-saving runs. It reports time, compile time, peak memory and gradient agreement.test_compiled_stencil_slicescompiles each case once and checks three things on it: no conv, one graph, and a match with the uncompiled step. It now also covers per-edge free surfaces, image topography and DASMu.Validation
On a V100, the cpu ring storage now runs at GPU-storage speed while keeping the ring off the device: Elastic3D 192³ goes from 11.8 s to 7.8 s, against 7.7 s with GPU storage.
🤖 Generated with Claude Code