cuwave 0.6.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cuwave-0.6.0 → cuwave-0.7.0}/PKG-INFO +1 -1
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/sensitivity.py +27 -7
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/utils.py +3 -1
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave.egg-info/PKG-INFO +1 -1
- {cuwave-0.6.0 → cuwave-0.7.0}/pyproject.toml +1 -1
- {cuwave-0.6.0 → cuwave-0.7.0}/LICENSE +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/README.md +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/__init__.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/anisotropic.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/boundary.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/decomposition.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/elastic.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/evals.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/geometry.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/__init__.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/anisotropic.cu +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/anisotropic_sensitivity.cu +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/common.cuh +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/elastic.cu +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/elastic_sensitivity.cu +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/maxwell.cu +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/maxwell_sensitivity.cu +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/scalar.cu +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/kernels/scalar_sensitivity.cu +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/maxwell.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/nn.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/optimization.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/postprocessing.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/regularization.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/scalar.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/signals.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/stencils.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave/wave.py +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave.egg-info/SOURCES.txt +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave.egg-info/dependency_links.txt +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave.egg-info/requires.txt +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/cuwave.egg-info/top_level.txt +0 -0
- {cuwave-0.6.0 → cuwave-0.7.0}/setup.cfg +0 -0
|
@@ -637,11 +637,9 @@ def reconstruction_sensitivity(
|
|
|
637
637
|
p = adjoint_step(P[m % 2], P[1 - m % 2], P[m % 2]) # lambda^n
|
|
638
638
|
adjoint_excitation(p, signal, row)
|
|
639
639
|
bc_step(p)
|
|
640
|
-
|
|
641
|
-
gradient_step(*triplet(m), p)
|
|
640
|
+
return p
|
|
642
641
|
|
|
643
|
-
def
|
|
644
|
-
adjoint(m, row, signal)
|
|
642
|
+
def reverse(m, row, source_rows, strip_rows=None):
|
|
645
643
|
a, b, c = triplet(m)
|
|
646
644
|
# read backwards, so the source rides two steps ahead of the state it rebuilds
|
|
647
645
|
c = reverse_step(b, a, c)
|
|
@@ -650,6 +648,28 @@ def reconstruction_sensitivity(
|
|
|
650
648
|
replay_strip(c, strip_rows, row)
|
|
651
649
|
bc_step(c)
|
|
652
650
|
|
|
651
|
+
# the reverse and the adjoint march meet only in the gradient, so they may overlap
|
|
652
|
+
side = cp.cuda.Stream(non_blocking=True)
|
|
653
|
+
forked = cp.cuda.Event(disable_timing=True)
|
|
654
|
+
joined = cp.cuda.Event(disable_timing=True)
|
|
655
|
+
# past L2 the two would evict each other's fields
|
|
656
|
+
carried = U.nbytes + P.nbytes + sum(field.nbytes for field in grads.values())
|
|
657
|
+
overlap = carried <= cp.cuda.Device().attributes["L2CacheSize"]
|
|
658
|
+
|
|
659
|
+
# reverse step m on the side stream, beside adjoint step m + 1
|
|
660
|
+
def backward(m, row, signal, source_rows, strip_rows=None):
|
|
661
|
+
main = cp.cuda.get_current_stream()
|
|
662
|
+
lane = side if overlap else main
|
|
663
|
+
forked.record(main)
|
|
664
|
+
lane.wait_event(forked)
|
|
665
|
+
with lane:
|
|
666
|
+
reverse(m, row, source_rows, strip_rows)
|
|
667
|
+
joined.record(lane)
|
|
668
|
+
p = adjoint(m + 1, row, signal)
|
|
669
|
+
main.wait_event(joined)
|
|
670
|
+
# inertia pairs lambda^n with the whole triplet, stiffness with its middle slot
|
|
671
|
+
gradient_step(*triplet(m + 1), p)
|
|
672
|
+
|
|
653
673
|
def leaf(k):
|
|
654
674
|
s, e = starts[k], starts[k + 1]
|
|
655
675
|
# row t - s + 2 is u^t, the two the segment starts from read off the slots
|
|
@@ -666,8 +686,9 @@ def reconstruction_sensitivity(
|
|
|
666
686
|
if not s:
|
|
667
687
|
# the forward rotation left the last three states live, which is the seed
|
|
668
688
|
state["seed"] = float(cp.linalg.norm(triplet(m0)[2] * valid))
|
|
669
|
-
|
|
670
|
-
|
|
689
|
+
gradient_step(*triplet(m0), adjoint(m0, m0, signal))
|
|
690
|
+
# row k is reverse step m0 + k and adjoint step m0 + 1 + k, as kernels index rows
|
|
691
|
+
windows = [Window(signal[m0 + 1 : m1])]
|
|
671
692
|
windows.append(Window(source.signal[s : e - 1][::-1].copy()))
|
|
672
693
|
if num_strip:
|
|
673
694
|
windows.append(Window(buffer[: e - s - 1][::-1].copy(), dtype=sim.dtype))
|
|
@@ -680,7 +701,6 @@ def reconstruction_sensitivity(
|
|
|
680
701
|
windows,
|
|
681
702
|
[U, P, *adjoint_memory],
|
|
682
703
|
)
|
|
683
|
-
adjoint(m1 - 1, m1 - 1, signal)
|
|
684
704
|
|
|
685
705
|
for action, *segments in checkpoint_schedule(len(starts) - 1, checkpoints or 0):
|
|
686
706
|
if action == "advance":
|
|
@@ -428,7 +428,9 @@ def misfit_gradient(
|
|
|
428
428
|
adjoint: which variant computes each shot, `reconstruction_sensitivity`
|
|
429
429
|
where the stored history no longer fits.
|
|
430
430
|
devices: GPUs to spread the shots over, every `len(devices)`-th on each, or
|
|
431
|
-
None for the current one.
|
|
431
|
+
None for the current one. A GPU listed twice runs two shots at once,
|
|
432
|
+
which pays only while the fields of both fit in its L2 cache together
|
|
433
|
+
and slows a larger grid down.
|
|
432
434
|
|
|
433
435
|
Returns:
|
|
434
436
|
(cost, gradient), the gradient a field over the padded grid, already
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|