Repository navigation
sem: 3-D acoustic CUDA without C-PML solves the c^2 Laplacian - #132
Merged
Merged
Conversation
The sem3d_acoustic forward/adjoint kernels put c^2 inside the stiffness, i.e. div(c^2 grad u). They now use the c^2-free stiffness and apply c^2 per node (adjoint K0 C M^-1, c^2 gradient by a nodal kernel); the imaging kernels are gone. Struct layout unchanged: c2_node is per node, its gradient comes back in grad_c2_jx. impl='c' routes the bare pair again. Test: two-layer c vs eager (old kernel cos 0.603). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Follow-up to #131. The 3-D acoustic SEM CUDA kernels without C-PML (
sem3d_acoustic, flat and deformed) solved the wrong equation: c² was folded into the stiffness integral, i.e. they solved div(c² grad u) instead of c²∇²u, which flips the reflection polarity at velocity contrasts. #131 fixed the eager classes and temporarily rejectedimpl='c'for this case; this PR fixes the kernels themselves and restores the route.Kernels (
src/sweep/csrc/cuda/equations/sem3d/)sem3d_accum_grad_c2accumulates the c² gradient.sem3d_acoustic_imaging,sem3d_acoustic_imaging_deformed) are removed.abi.py/layout.curegenerate with no diff):c2_nodenow holds per-node c², its gradient comes back ingrad_c2_jx, andc2_j{x,y,z}hold the c²-free weights.Python routing
impl='c'routes both no-C-PML paths again (rejected in sem: acoustic c² Laplacian without C-PML, one-copy node materials #131).sem/drivers/bare.py; the material input is a single copy ofvp_squared_node. The old deformed path passed per-element nodal c², which amplified the gradient at shared nodes.Tests
test_sem_acoustic_reflection_polarity.py: the old kernel gives cos 0.603, the new kernel passes (threshold 1 − 1e-5).PropSEMwithabcn=0, c vs eager: forward and mesh gradient cos 1.0000000.test/sem: 946 passed. The one failure,test_sem_dd_elastic::test_dd_elastic_per_family_store_dtype, also fails ondev.The CPU CI does not build the core, so the CUDA tests above are skipped there; the GPU validation was done locally. A local replica of the CPU CI (clean venv, CPU torch, 4 cores) passes.
🤖 Generated with Claude Code