Skip to content

feat(lsrtm): RWI vp gradient for AcousticLSRTM (c backend, 2-D/3-D, DD) - #108

Merged
GeophyAI merged 4 commits into
devfrom
explore/lsrtm-vp-grad-3d
Oct 5, 2026
Merged

GeophyAI merged 4 commits into
devfrom
explore/lsrtm-vp-grad-3d

Conversation

@GeophyAI

@GeophyAI GeophyAI commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

impl='c' AcousticLSRTM / AcousticLSRTM3D returned vp.grad = 0. This branch adds the RWI tomographic vp gradient (Wu & Alkhalifah, 2015, terms II+III+IV) to the c backward, then domain decomposition and a docs notebook.

Commits

  • ad2babb3 vp gradient in full and boundary-saving modes: a background adjoint driven by the coupling transpose, plus the scattered field (u_tt stored in full mode, reconstructed in bs). The coupling also runs inside the CPML band (pml_field); without it vp.grad was 8–10 % off eager once mp reached the edges.
  • 3d9ede9e SWEEP_LSRTM_SPLIT_III=1 returns term III on its own (last_grad_split_iii()), for (II+IV) + β·III. New BackwardInput field; generated files regenerated.
  • dc569060 DD for AcousticLSRTM 2-D/3-D: stepped segments, cut mask, slot tables for both fields. The NOPML reconstruction guard is now per face (it skipped the cells beside every cut).
  • ca48c33a notebook 32: Acoustic vs AcousticLSRTM gradient anatomy in 2-D and 3-D, the β-III split, memory modes; gallery card and nav.

Cost follows vp.requires_grad, per call
A classic LSRTM (mp only) keeps dev's buffers and kernels. The RWI layout is allocated only when vp asks for its gradient; under DD the capture is redone the first time it does.

V100 time memory
mp only, vs dev ×1.00 ×1.00
vp + mp, vs dev ×1.47–1.82 ×1.43–1.96

Checks

  • vp.grad vs eager, mp reaching the CPML band: rel 2.4e-4 (2-D), 6.2e-4 (3-D). Consistency battery 48/48.
  • mp only vs dev: record, mp and wavelet gradients bitwise under -fmad=false; ≤7e-7 in the default build (FMA contraction).
  • (II+IV) + III equals the unsplit vp.grad to rel < 1e-7.
  • DD on 4× V100 (ibex): 18/18 configurations plus 3 layout-switch scenarios, bitwise vs one card.
  • Full test/ on KW60443: 1888 passed; the one failure, test_shipped_core, always fails with an in-place build. New test/test_lsrtm_rwi_vp_gate.py pins both layouts.
  • backend_gradient_matrix.py (acoustic_lsrtm2d/3d): 2-D passes; 3-D fails only on the wavelet gradient, as on dev.

Not covered: checkpointing modes still return vp.grad = 0 (declared in test/gradient_cases.py).

🤖 Generated with Claude Code

impl='c' AcousticLSRTM/3D returned vp.grad = 0. Full and bs now compute
terms II+III+IV (Wu & Alkhalifah 2015): a background adjoint driven by
the coupling transpose plus the scattered field (u_tt stored in full,
reconstructed in bs). Only when vp requires grad: the layout follows it
per call, so a fixed-vp LSRTM keeps the old buffers and cost (V100 x1.00;
with vp.grad x1.5-1.8 time, x1.4-2.0 memory).
vs eager, mp reaching the CPML band: rel 2.4e-4 (2-D) / 6.2e-4 (3-D).
With SWEEP_LSRTM_SPLIT_III=1 the full/bs backward writes the image-point
term III to BackwardInput.grad_split_iii_out (new ABI field, generated
files regenerated): vp.grad keeps II+IV and last_grad_split_iii() returns
III on the model grid, for (II+IV) + beta*III (eq. 18-20).
(II+IV) + III equals the unsplit vp.grad to rel <1e-7.
Forward and bs backward run stepped segments and honour the cut mask;
the slot tables let ModelParallel rotate and halo-exchange both fields
(LSRTM_DD, serial forward). The capture follows each model's
requires_grad (mp only: 3 reconstruction grids; re-captured once vp
wants its gradient). The NOPML reconstruction guard was abcn-based on
every face and skipped cells beside each cut; now per face.
Record and gradients bitwise vs one card on 4x V100, with and without vp.
Notebook 32: the paper's Fig. 1 anatomy in 2-D and 3-D, the eq. 15
identity, the beta-III split and the memory modes; gallery card and nav.
@GeophyAI
GeophyAI merged commit e588967 into dev Oct 5, 2026
1 check passed
@GeophyAI
GeophyAI deleted the explore/lsrtm-vp-grad-3d branch October 5, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant