Deepwave¶
Deepwave provides PyTorch-integrated wave propagators for forward modelling and backpropagation, for gradient calculation in inversion and optimisation tasks. It supports standard and Born modelling of the scalar, variable-density acoustic, and elastic wave equations in 1D, 2D, and 3D, with viscoacoustic attenuation in 1D–3D and VTI anisotropy in 2D and 3D. The compiled backends support CPUs and CUDA GPUs. See the capability matrix for exactly which options each propagator supports. New to seismic/wave-equation terminology? The Glossary defines the terms (PML, CFL, Born, FWI, and more) used throughout these docs.
Installation¶
Deepwave requires Python 3.9 or later and PyTorch 2.4 or later. Install PyTorch for your CPU or CUDA device by following the instructions on the PyTorch website, then install Deepwave:
python -m pip install deepwave
This method should work for most users. However, if you have an unusual system configuration, you might need to build Deepwave from source. Instructions for building from source are provided below.
macOS wheels support Apple Silicon. Intel Mac wheels are no longer built, because PyTorch 2.4 and newer do not provide Intel macOS wheels.
PyTorch is Deepwave’s only dependency. Nothing else is needed to use it. The example scripts under docs/ do import a few other packages – matplotlib to draw their figures, and, in some of them, scipy (smoothing and filter design) and torchaudio (applying those filters) – but those are needed only to run the examples, never by Deepwave itself. See Running the examples.
Deepwave is built on PyTorch, so understanding PyTorch well makes it easier to use. The PyTorch website offers many helpful tutorials, and the PyTorch page here covers the specific parts that matter most for Deepwave.
Building from source¶
Deepwave uses cibuildwheel and scikit-build-core for its build process. When you run pip install deepwave, pip will first attempt to download a precompiled wheel if one is available for your system. If a suitable precompiled wheel is not found, pip will automatically download the source distribution and attempt to compile it on your system. You will need to have a C compiler and CMake available, and a CUDA compiler if you wish to have CUDA support.
If you wish to force building from source rather than using a wheel, you can use the following command:
python -m pip install --force-reinstall --no-deps --no-binary deepwave deepwave
This replaces an existing installation with a source build, leaving your chosen PyTorch installation in place. It is the recommended fix if a precompiled wheel does not run on your CPU (see Installation troubleshooting below).
Installation troubleshooting¶
Prebuilt x86 wheels require AVX2. On a CPU without it, current wheels report the missing instruction set; older wheels may crash with Illegal instruction (core dumped). A source build uses a portable CPU baseline by default. See Troubleshooting for this and other installation and runtime problems.
Citing¶
Deepwave is archived on Zenodo with the DOI 10.5281/zenodo.3829886 (this DOI always resolves to the latest release). If you would like to cite Deepwave, I suggest:
@software{richardson_alan_2026,
author = {Richardson, Alan},
title = {Deepwave},
year = 2026,
publisher = {Zenodo},
version = {0.1.0},
doi = {10.5281/zenodo.3829886},
url = {https://doi.org/10.5281/zenodo.3829886}
}Support¶
If you encounter any issues (e.g., typos, broken links, unexpected behaviour, examples that don’t work), or have suggestions for improvement, please file an issue on GitHub or send an email.
Getting started
User guide
- Stability policy
- The stable interface
- The numerical standard
- The maturity labels
- The provisional rule
- The deprecation rule
- Deprecated today
- Removed in
0.1.0 - Every public name, and what may change
- Supported aliases
- The flat keyword rule
- The returned tuple
- Continuing a run: the auxiliary state
- Segmented runs
torch.funcandtorch.compile- What a propagator added later looks like
- Boundary conditions
- Errors and warnings
- Type annotations
- Reproducibility
- Pre-announced changes
- Reserved names
- Supporting both
v0.0.27and0.1.0
- Usage
- API reference
- Dimension order and the axis convention
- Data types
- Model parameterisations
- Batched models
- Named returns and continuing a simulation
auxiliary_stateandtorch.utils.checkpoint- Gradient checkpointing
- Differentiable intermediate snapshots
- Skipping points: the sentinel and the masks
- Specifying sources and receivers
- Off-grid sources and receivers
- DAS strain-rate receivers
- Time-dispersion correction
- Wavefield-space tools
- Backends
- Capability matrix
- Internal callback names
- Accuracy and grid design
- Boundary conditions
- Absorbing edges: the PML
- Choosing
pml_freq - Reflecting edges
- Per-propagator reflection coefficients
- First-class boundary faces
- Placing sources and receivers near a reflecting edge
- Free surface in the elastic propagator
boundary=across propagators- Which faces each propagator accepts
- Known limitations
- Practical notes
- Appendix: image-rule derivations and implementation policy
- Units and source conventions
- Material models and physical scope
- Time-dispersion correction
- Troubleshooting
- Detecting divergence (NaN) early
- Running out of memory
- Progress feedback for long runs
- Location errors (”… is out of bounds”)
- The
pml_freq/ physical-units mismatch - Large gradients at the edge of the model
- Cycle-skipping in FWI
- Numerical dispersion
- Oscillations near a fluid-solid (water-layer) interface
- “Illegal instruction (core dumped)”
- Will a Deepwave wheel keep working after I upgrade PyTorch (or Python)?
- “Compiled backend failed”
- Running inside
torch.cuda.stream() - Wrapping a propagator in
torch.compileortorch.export - “None of the inputs have requires_grad=True” from a segmented run
- Scaling 3-D FWI past a single GPU’s memory
API reference
Propagator reference
- Scalar Wave Equation
- Born Modelling with the Scalar Wave Equation
- Acoustic Wave Equation
- Born Modelling with the Variable-Density Acoustic Wave Equation
- Viscoacoustic (attenuating) wave equation
- Elastic wave equation
- Born Modelling with the Elastic Wave Equation
- Elastic VTI (anisotropic) wave equation
- Pseudo-acoustic VTI wave equation
Theory and guarantees
Derivations (developer reference)
Design notes (developer reference)
Applications and alternatives
Release reference (maintainer)