DeepGPR 0.1.0__tar.gz → 0.1.1__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.
- {deepgpr-0.1.0 → deepgpr-0.1.1}/CHANGELOG.md +85 -0
- {deepgpr-0.1.0/src/DeepGPR.egg-info → deepgpr-0.1.1}/PKG-INFO +7 -4
- {deepgpr-0.1.0 → deepgpr-0.1.1}/README.md +6 -3
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/__init__.py +3 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/_version.py +1 -1
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/config/constants.py +45 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/config/defaults.py +9 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/lib/deepgpr.cu +1696 -672
- deepgpr-0.1.1/src/DeepGPR/lib/deepgpr.dll +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/lib/deepgpr.h +19 -0
- deepgpr-0.1.1/src/DeepGPR/lib/deepgpr.so +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/lib/deepgpr_cpu.c +174 -74
- deepgpr-0.1.1/src/DeepGPR/lib/deepgpr_cpu.dll +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/lib/deepgpr_cpu.dylib +0 -0
- deepgpr-0.1.1/src/DeepGPR/lib/deepgpr_cpu.so +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/native/abi.py +3 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/solver/__init__.py +3 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/solver/autograd.py +114 -11
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/solver/memory.py +65 -12
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/solver/modeling.py +175 -12
- deepgpr-0.1.1/src/DeepGPR/solver/sampling.py +169 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/solver/storage.py +157 -1
- {deepgpr-0.1.0 → deepgpr-0.1.1/src/DeepGPR.egg-info}/PKG-INFO +7 -4
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR.egg-info/SOURCES.txt +1 -0
- deepgpr-0.1.0/src/DeepGPR/lib/deepgpr.dll +0 -0
- deepgpr-0.1.0/src/DeepGPR/lib/deepgpr.so +0 -0
- deepgpr-0.1.0/src/DeepGPR/lib/deepgpr_cpu.dll +0 -0
- deepgpr-0.1.0/src/DeepGPR/lib/deepgpr_cpu.so +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/MANIFEST.in +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/license +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/pyproject.toml +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/requirements.txt +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/setup.cfg +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/common.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/compute2.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/config/__init__.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/inversion/__init__.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/inversion/regularization.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/lib/libomp.dylib +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/multiscale.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/native/__init__.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/native/bridge.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/native/loader.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/postprocessing/__init__.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/postprocessing/filters.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/postprocessing/io.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/preprocessing/__init__.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/preprocessing/grid.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/preprocessing/model_setup.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/preprocessing/stability.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/preprocessing/wavelets.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/py.typed +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/solver/fields.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/solver/pml.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/utils/__init__.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/utils/devices.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/utils/exceptions.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/utils/formatting.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/utils/logger.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/utils/tensor_checks.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/utils/validators.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/visualization/__init__.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/visualization/plotting.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR/wavelet.py +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR.egg-info/dependency_links.txt +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR.egg-info/requires.txt +0 -0
- {deepgpr-0.1.0 → deepgpr-0.1.1}/src/DeepGPR.egg-info/top_level.txt +0 -0
|
@@ -4,6 +4,91 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [Unreleased] — History memory and CUDA adjoint performance
|
|
8
|
+
|
|
9
|
+
Measurements, protocol and per-item decisions:
|
|
10
|
+
[`tests/profiling_results/history_adjoint_gpu_report.md`](tests/profiling_results/history_adjoint_gpu_report.md).
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `model_gradient_sampling_interval="auto"` selects
|
|
15
|
+
`S = max(1, floor(1 / (4 f_max dt)))`, with `f_max` the highest frequency at
|
|
16
|
+
which the source amplitude spectrum exceeds `3e-3` of its peak (about
|
|
17
|
+
`3 f_peak` for a Ricker wavelet; several waveforms use the smallest `S`).
|
|
18
|
+
`DeepGPR.recommended_sampling_interval` and `DeepGPR.source_max_frequency`
|
|
19
|
+
expose the bound so segmented/checkpointed runs can evaluate it once on the
|
|
20
|
+
full waveform. The default stays `1`.
|
|
21
|
+
- `wavefield_rhs_history` (`"auto"`, `"stored"`, `"reconstructed"`). With
|
|
22
|
+
sampling interval 1 the adjoint rebuilds `R^n = (E^(n+1) - ca E^n) / cb` from
|
|
23
|
+
consecutive saved E frames, so only E is stored (plus one internal final
|
|
24
|
+
frame). The default `"auto"` does this for uncompressed `float32` histories:
|
|
25
|
+
history memory halves, the forward no longer runs the R-snapshot kernel, and
|
|
26
|
+
gradients are unchanged (bitwise on CPU). Low-precision and INT8 histories
|
|
27
|
+
keep E+R by default (rebuilding from two rounded frames was measurably less
|
|
28
|
+
accurate in some cases) and can opt in with `"reconstructed"`. New native
|
|
29
|
+
capability probe `deepgpr_supports_rhs_reconstruction` (ABI 6 unchanged);
|
|
30
|
+
older libraries fall back to E+R.
|
|
31
|
+
- `wavefield_history_region` (`"extended"` default, `"physical"`). `"physical"`
|
|
32
|
+
stores E/R histories only on the physical model cells (CPML cells never get
|
|
33
|
+
a material gradient), so history memory falls with the cell count and
|
|
34
|
+
gradients are unchanged. INT8 histories widen the box to whole tiles of the
|
|
35
|
+
full-grid tiling so tiles and scales are identical to `"extended"`. New probe
|
|
36
|
+
`deepgpr_supports_physical_history`; saved files record the region.
|
|
37
|
+
|
|
38
|
+
### Performance
|
|
39
|
+
|
|
40
|
+
- CUDA full-grid kernels (E/H update and adjoint) take the shot from
|
|
41
|
+
`blockIdx.y` and decode `(i, j, k)` from a 32-bit per-shot index with a
|
|
42
|
+
multiply-high divider instead of four 64-bit `/` and `%` per thread. Grids
|
|
43
|
+
above `2^31 - 1` cells per shot are rejected explicitly.
|
|
44
|
+
- CUDA 2D TM fast path: for 2D models with an Ez source and zero Ex/Ey/Hz
|
|
45
|
+
states the solver launches only the `k = 0` layer and updates/transposes
|
|
46
|
+
only Ez, Hx and Hy (probe `deepgpr_supports_tm2d_fast_path`). Receiver data
|
|
47
|
+
is bitwise unchanged; initial-state gradients of Ex/Ey/Hz are zero on this
|
|
48
|
+
path. Other calls use the general kernels.
|
|
49
|
+
|
|
50
|
+
- CUDA 2D TM adjoint as a gather (AUDIT N-7): on the 2D TM fast path the
|
|
51
|
+
transposed curl and CPML updates no longer scatter with `atomicAdd`; every
|
|
52
|
+
target point gathers its source stencil in a fixed order with CPML
|
|
53
|
+
derivative weights from phi-sized scratch (2D backward about 30 % faster,
|
|
54
|
+
bitwise reproducible). Receiver and source-waveform adjoints add coincident
|
|
55
|
+
points in a fixed order on every path. The general (3D) CUDA adjoint keeps
|
|
56
|
+
the atomic scatter, which measured faster than a gather there;
|
|
57
|
+
`deepgpr_deterministic_adjoint()` stays 0. Gradients differ from the
|
|
58
|
+
previous release at rounding level only.
|
|
59
|
+
- CUDA kernel fusion on the 2D TM fast path: each cell's CPML corrections run
|
|
60
|
+
inside `update_e_gpu` / `update_h_gpu` right after its base update (same
|
|
61
|
+
face order and arithmetic; the other field is read only), and float32 /
|
|
62
|
+
float16 / bfloat16 E histories are written by `update_h_gpu`, where E is not
|
|
63
|
+
modified. Forward launches per time step drop from 6 to 3 (2D forward
|
|
64
|
+
11-18 % faster; with INT8 histories 6-10 %). INT8 and `native_vec2`
|
|
65
|
+
histories and the stored-R snapshot keep their own kernels. The general
|
|
66
|
+
(3D) forward keeps separate CPML and snapshot kernels: fused, it was faster
|
|
67
|
+
on small 3D grids but up to 8 % slower on a 140^3 grid. The general scatter
|
|
68
|
+
adjoint applies the CPML transposes inside `adjoint_e_gpu` /
|
|
69
|
+
`adjoint_h_gpu` (6 to 4 launches per reverse step; 3D fp32 backward about
|
|
70
|
+
3.5 % faster, other storage modes within noise). Receiver data, states and
|
|
71
|
+
histories are bitwise unchanged; 2D TM gradients are bitwise unchanged, 3D
|
|
72
|
+
gradients change at atomic-ordering level only. The material-gradient
|
|
73
|
+
kernel stays separate (it reduces over shots per cell in a fixed order and
|
|
74
|
+
runs only every `S` steps).
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- An explicit `model_gradient_sampling_interval > 1` no longer always raises a
|
|
79
|
+
`RuntimeWarning`; it warns (and states the bound) only above
|
|
80
|
+
`floor(1 / (4 f_max dt))`. Intervals inside the bound are logged at INFO.
|
|
81
|
+
- **Default history layout:** float32 histories at sampling interval 1 no
|
|
82
|
+
longer allocate `R_saved`; pass `wavefield_rhs_history="stored"` to restore
|
|
83
|
+
the previous layout. `estimate_compute_memory` gained `reconstruct_rhs` and a
|
|
84
|
+
`final_e_frame` entry; `print_parameters` reports the R-history mode.
|
|
85
|
+
- The native `storage_type` argument reserves bits 4-7 for history flags (the
|
|
86
|
+
storage kind now uses bits 0-3).
|
|
87
|
+
- Documentation: README, `docs/API.md`, `docs/BUILDING.md` (new capability
|
|
88
|
+
probes) and the website describe the new history options; the website now
|
|
89
|
+
links to `docs/API.md` instead of a README anchor that moved in 0.1.0 and no
|
|
90
|
+
longer lists SciPy as a runtime dependency.
|
|
91
|
+
|
|
7
92
|
## [0.1.0] — Structural refactor and numerical fixes
|
|
8
93
|
|
|
9
94
|
This release reorganises the Python package into a layered, typed and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DeepGPR
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: PyTorch and CUDA for GPR FWI
|
|
5
5
|
Author-email: Lei Liu <liulei990222@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -47,7 +47,7 @@ DeepGPR provides a wave propagation module for PyTorch, designed for application
|
|
|
47
47
|
- Automatic extension of the physical model into a CPML with an independent thickness on every face. Supply only air and the target region; material gradients keep the input model shape.
|
|
48
48
|
- CUDA GPU backend and a C/OpenMP CPU backend (selected automatically with `device='cpu'`).
|
|
49
49
|
- Spatial FDTD order 2, 4 or 8 (`fdtd_order`), and gradient mode 2 (Ez only) or 3 (Ex, Ey, Ez).
|
|
50
|
-
- Large models: checkpointing, DDP, temporal sub-sampling, FP16/BF16 or GPU-native INT8 wavefield histories and asynchronous offload to host memory.
|
|
50
|
+
- Large models: checkpointing, DDP, temporal sub-sampling (fixed or `"auto"` from the source spectrum), E-only float32 histories (default; half the memory of E+R), histories restricted to the physical model (`wavefield_history_region="physical"`), FP16/BF16 or GPU-native INT8 wavefield histories and asynchronous offload to host memory. See [`docs/API.md`](docs/API.md) §4.3-4.6.
|
|
51
51
|
|
|
52
52
|
## System requirements
|
|
53
53
|
|
|
@@ -162,6 +162,7 @@ The figures show the true model, the initial model and the inverted result.
|
|
|
162
162
|
| `DeepGPR.apply_filter`, `DeepGPR.hilbert_transform` | low-pass FIR and envelope for multi-scale FWI |
|
|
163
163
|
| `DeepGPR.max_stable_time_step(...)` | largest CFL-stable `dt` for a grid, order and material |
|
|
164
164
|
| `DeepGPR.estimate_compute_memory(...)` | memory estimate (also printed by `print_parameters=True`) |
|
|
165
|
+
| `DeepGPR.recommended_sampling_interval(...)`, `DeepGPR.source_max_frequency(...)` | gradient sampling interval bound `floor(1 / (4 f_max dt))` from a source waveform (what `model_gradient_sampling_interval="auto"` uses) |
|
|
165
166
|
| `DeepGPR.decompress_wavefield_history(...)` | decode a packed INT8 history for diagnostics |
|
|
166
167
|
| `DeepGPR.visualization.plot_*` | models, radargrams, traces, true/initial/inverted comparison |
|
|
167
168
|
| `DeepGPR.configure_logging(level)` | enable DeepGPR log output |
|
|
@@ -224,8 +225,10 @@ Run the notebooks `00` to `09` in numeric order, followed by
|
|
|
224
225
|
the complete matrix and CUDA options.
|
|
225
226
|
|
|
226
227
|
**Reproducibility.** The CPU backend gives bitwise identical forward results
|
|
227
|
-
and gradients for any `OMP_NUM_THREADS`.
|
|
228
|
-
|
|
228
|
+
and gradients for any `OMP_NUM_THREADS`. On CUDA, 2D Ez-TM runs (the 2D fast
|
|
229
|
+
path) gather their adjoint without atomics and are bitwise reproducible; the
|
|
230
|
+
general (3D) CUDA adjoint accumulates with atomics and can differ in the last
|
|
231
|
+
bits between runs.
|
|
229
232
|
|
|
230
233
|
**Reproducing results from DeepGPR ≤ 0.0.20.** 0.1.0 corrects the FIR design
|
|
231
234
|
for even filter lengths, the envelope for odd trace lengths and the isotropic
|
|
@@ -11,7 +11,7 @@ DeepGPR provides a wave propagation module for PyTorch, designed for application
|
|
|
11
11
|
- Automatic extension of the physical model into a CPML with an independent thickness on every face. Supply only air and the target region; material gradients keep the input model shape.
|
|
12
12
|
- CUDA GPU backend and a C/OpenMP CPU backend (selected automatically with `device='cpu'`).
|
|
13
13
|
- Spatial FDTD order 2, 4 or 8 (`fdtd_order`), and gradient mode 2 (Ez only) or 3 (Ex, Ey, Ez).
|
|
14
|
-
- Large models: checkpointing, DDP, temporal sub-sampling, FP16/BF16 or GPU-native INT8 wavefield histories and asynchronous offload to host memory.
|
|
14
|
+
- Large models: checkpointing, DDP, temporal sub-sampling (fixed or `"auto"` from the source spectrum), E-only float32 histories (default; half the memory of E+R), histories restricted to the physical model (`wavefield_history_region="physical"`), FP16/BF16 or GPU-native INT8 wavefield histories and asynchronous offload to host memory. See [`docs/API.md`](docs/API.md) §4.3-4.6.
|
|
15
15
|
|
|
16
16
|
## System requirements
|
|
17
17
|
|
|
@@ -126,6 +126,7 @@ The figures show the true model, the initial model and the inverted result.
|
|
|
126
126
|
| `DeepGPR.apply_filter`, `DeepGPR.hilbert_transform` | low-pass FIR and envelope for multi-scale FWI |
|
|
127
127
|
| `DeepGPR.max_stable_time_step(...)` | largest CFL-stable `dt` for a grid, order and material |
|
|
128
128
|
| `DeepGPR.estimate_compute_memory(...)` | memory estimate (also printed by `print_parameters=True`) |
|
|
129
|
+
| `DeepGPR.recommended_sampling_interval(...)`, `DeepGPR.source_max_frequency(...)` | gradient sampling interval bound `floor(1 / (4 f_max dt))` from a source waveform (what `model_gradient_sampling_interval="auto"` uses) |
|
|
129
130
|
| `DeepGPR.decompress_wavefield_history(...)` | decode a packed INT8 history for diagnostics |
|
|
130
131
|
| `DeepGPR.visualization.plot_*` | models, radargrams, traces, true/initial/inverted comparison |
|
|
131
132
|
| `DeepGPR.configure_logging(level)` | enable DeepGPR log output |
|
|
@@ -188,8 +189,10 @@ Run the notebooks `00` to `09` in numeric order, followed by
|
|
|
188
189
|
the complete matrix and CUDA options.
|
|
189
190
|
|
|
190
191
|
**Reproducibility.** The CPU backend gives bitwise identical forward results
|
|
191
|
-
and gradients for any `OMP_NUM_THREADS`.
|
|
192
|
-
|
|
192
|
+
and gradients for any `OMP_NUM_THREADS`. On CUDA, 2D Ez-TM runs (the 2D fast
|
|
193
|
+
path) gather their adjoint without atomics and are bitwise reproducible; the
|
|
194
|
+
general (3D) CUDA adjoint accumulates with atomics and can differ in the last
|
|
195
|
+
bits between runs.
|
|
193
196
|
|
|
194
197
|
**Reproducing results from DeepGPR ≤ 0.0.20.** 0.1.0 corrects the FIR design
|
|
195
198
|
for even filter lengths, the envelope for odd trace lengths and the isotropic
|
|
@@ -66,6 +66,7 @@ from .preprocessing.stability import max_stable_time_step
|
|
|
66
66
|
from .solver.autograd import DeepGPR
|
|
67
67
|
from .solver.modeling import compute
|
|
68
68
|
from .solver.memory import estimate_compute_memory
|
|
69
|
+
from .solver.sampling import recommended_sampling_interval, source_max_frequency
|
|
69
70
|
from .solver.storage import decompress_wavefield_history
|
|
70
71
|
from .utils.exceptions import (
|
|
71
72
|
CFLConditionError,
|
|
@@ -122,10 +123,12 @@ __all__ = [
|
|
|
122
123
|
"pmlthick_revert",
|
|
123
124
|
"postprocessing",
|
|
124
125
|
"preprocessing",
|
|
126
|
+
"recommended_sampling_interval",
|
|
125
127
|
"ricker",
|
|
126
128
|
"set_library_fdtd_order",
|
|
127
129
|
"sine_burst",
|
|
128
130
|
"solver",
|
|
131
|
+
"source_max_frequency",
|
|
129
132
|
"utils",
|
|
130
133
|
"visualization",
|
|
131
134
|
"wavelet",
|
|
@@ -101,6 +101,17 @@ CPML_PHI_TENSOR_COUNT: Final[int] = CPML_FACE_COUNT * CPML_PHI_TENSORS_PER_FACE
|
|
|
101
101
|
#: Human readable CPML face names in native order.
|
|
102
102
|
CPML_FACE_NAMES: Final[Tuple[str, ...]] = ("x0", "xm", "y0", "ym", "z0", "zm")
|
|
103
103
|
|
|
104
|
+
# ---------------------------------------------------------------------------
|
|
105
|
+
# Temporal sampling of the gradient history
|
|
106
|
+
# ---------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
#: Relative amplitude at which a source spectrum counts as decayed when
|
|
109
|
+
#: ``model_gradient_sampling_interval="auto"`` locates ``f_max``. For a Ricker
|
|
110
|
+
#: wavelet ``|W(f)| / |W(f_peak)| = (f/f_peak)^2 exp(1 - (f/f_peak)^2)`` equals
|
|
111
|
+
#: 3.0e-3 at ``f ~= 3 f_peak``, so the recommended interval is
|
|
112
|
+
#: ``floor(1 / (12 f_peak dt))``.
|
|
113
|
+
SOURCE_SPECTRUM_CUTOFF_FRACTION: Final[float] = 3.0e-3
|
|
114
|
+
|
|
104
115
|
# ---------------------------------------------------------------------------
|
|
105
116
|
# Native library ABI
|
|
106
117
|
# ---------------------------------------------------------------------------
|
|
@@ -120,6 +131,32 @@ WAVEFIELD_STORAGE_FLOAT16: Final[int] = 1
|
|
|
120
131
|
WAVEFIELD_STORAGE_BFLOAT16: Final[int] = 2
|
|
121
132
|
WAVEFIELD_STORAGE_INT8: Final[int] = 3
|
|
122
133
|
|
|
134
|
+
#: Bits 0-3 of ``storage_type`` hold the storage code; bits 4-7 are history flags.
|
|
135
|
+
WAVEFIELD_STORAGE_KIND_MASK: Final[int] = 0x0F
|
|
136
|
+
|
|
137
|
+
#: History flag: store only E^n (sampling interval 1). ``R_saved`` receives the
|
|
138
|
+
#: final E^nt frame and the adjoint rebuilds R^n = (E^(n+1) - ca E^n) / cb.
|
|
139
|
+
#: Only set when the library reports ``deepgpr_supports_rhs_reconstruction``.
|
|
140
|
+
WAVEFIELD_RHS_FROM_E: Final[int] = 1 << 4
|
|
141
|
+
|
|
142
|
+
#: History flag: E/R frames cover only the physical model cells (no CPML).
|
|
143
|
+
#: Only set when the library reports ``deepgpr_supports_physical_history``.
|
|
144
|
+
WAVEFIELD_PHYSICAL_HISTORY: Final[int] = 1 << 5
|
|
145
|
+
|
|
146
|
+
#: Solver flag: 2D Ez-TM fast path (CUDA). Set only for nz = 1, an Ez source
|
|
147
|
+
#: and zero Ex/Ey/Hz states and when ``deepgpr_supports_tm2d_fast_path`` is 1.
|
|
148
|
+
SOLVER_TM2D: Final[int] = 1 << 6
|
|
149
|
+
|
|
150
|
+
#: Indices of the CPML auxiliary arrays (in the 24-array native order) that
|
|
151
|
+
#: couple only Ex, Ey and Hz in 2D: x0/xm/y0/ym E-phi1 and H-phi2.
|
|
152
|
+
TM2D_INACTIVE_PHI_INDICES: Final[Tuple[int, ...]] = (0, 3, 4, 7, 8, 11, 12, 15)
|
|
153
|
+
|
|
154
|
+
#: Accepted values of ``wavefield_history_region``.
|
|
155
|
+
WAVEFIELD_HISTORY_REGIONS: Final[Tuple[str, ...]] = ("extended", "physical")
|
|
156
|
+
|
|
157
|
+
#: Accepted values of ``wavefield_rhs_history``.
|
|
158
|
+
WAVEFIELD_RHS_HISTORY_MODES: Final[Tuple[str, ...]] = ("auto", "stored", "reconstructed")
|
|
159
|
+
|
|
123
160
|
#: Bit offsets and mask of the INT8 block shape inside ``storage_type``.
|
|
124
161
|
INT8_BLOCK_X_SHIFT: Final[int] = 8
|
|
125
162
|
INT8_BLOCK_Y_SHIFT: Final[int] = 14
|
|
@@ -219,17 +256,25 @@ __all__ = [
|
|
|
219
256
|
"MIN_RELATIVE_PERMITTIVITY",
|
|
220
257
|
"NATIVE_ABI_VERSION",
|
|
221
258
|
"PEC_CONDUCTIVITY_THRESHOLD",
|
|
259
|
+
"SOLVER_TM2D",
|
|
260
|
+
"SOURCE_SPECTRUM_CUTOFF_FRACTION",
|
|
222
261
|
"SPEED_OF_LIGHT",
|
|
223
262
|
"SUPPORTED_FDTD_ORDERS",
|
|
224
263
|
"SUPPORTED_GRADIENT_MODES",
|
|
264
|
+
"TM2D_INACTIVE_PHI_INDICES",
|
|
225
265
|
"TV_ISOTROPIC_EPSILON",
|
|
226
266
|
"VACUUM_PERMEABILITY",
|
|
227
267
|
"VACUUM_PERMITTIVITY",
|
|
228
268
|
"WAVEFIELD_CONVERSION_BACKENDS",
|
|
229
269
|
"WAVEFIELD_CONVERSION_SHIFT",
|
|
230
270
|
"WAVEFIELD_HISTORY_DISABLED",
|
|
271
|
+
"WAVEFIELD_HISTORY_REGIONS",
|
|
272
|
+
"WAVEFIELD_PHYSICAL_HISTORY",
|
|
273
|
+
"WAVEFIELD_RHS_FROM_E",
|
|
274
|
+
"WAVEFIELD_RHS_HISTORY_MODES",
|
|
231
275
|
"WAVEFIELD_STORAGE_BFLOAT16",
|
|
232
276
|
"WAVEFIELD_STORAGE_FLOAT16",
|
|
233
277
|
"WAVEFIELD_STORAGE_FLOAT32",
|
|
234
278
|
"WAVEFIELD_STORAGE_INT8",
|
|
279
|
+
"WAVEFIELD_STORAGE_KIND_MASK",
|
|
235
280
|
]
|
|
@@ -30,6 +30,13 @@ DEFAULT_GRADIENT_SAMPLING_INTERVAL: Final[int] = 1
|
|
|
30
30
|
#: Saved-history compression mode.
|
|
31
31
|
DEFAULT_WAVEFIELD_COMPRESSION: Final[str] = "none"
|
|
32
32
|
|
|
33
|
+
#: Storage of the electric right-hand-side history R^n ("auto": rebuilt from
|
|
34
|
+
#: consecutive E frames when the sampling interval is 1).
|
|
35
|
+
DEFAULT_WAVEFIELD_RHS_HISTORY: Final[str] = "auto"
|
|
36
|
+
|
|
37
|
+
#: Cells covered by the saved E/R history ("extended": whole grid incl. CPML).
|
|
38
|
+
DEFAULT_WAVEFIELD_HISTORY_REGION: Final[str] = "extended"
|
|
39
|
+
|
|
33
40
|
#: CUDA FP16/BF16 conversion backend selector.
|
|
34
41
|
DEFAULT_CONVERSION_BACKEND: Final[str] = "auto"
|
|
35
42
|
|
|
@@ -67,6 +74,8 @@ __all__ = [
|
|
|
67
74
|
"DEFAULT_TV_WEIGHT_CONDUCTIVITY",
|
|
68
75
|
"DEFAULT_TV_WEIGHT_PERMITTIVITY",
|
|
69
76
|
"DEFAULT_WAVEFIELD_COMPRESSION",
|
|
77
|
+
"DEFAULT_WAVEFIELD_HISTORY_REGION",
|
|
78
|
+
"DEFAULT_WAVEFIELD_RHS_HISTORY",
|
|
70
79
|
"DEFAULT_WAVELET_CYCLES",
|
|
71
80
|
"FIR_TAPS_PER_PERIOD",
|
|
72
81
|
"FORWARD_WAVEFIELD_PREFIX",
|