CuWave is a GPU-accelerated (single or multi), differentiable finite difference wave propagation code. Possible applications include
| nondestructive testing via full waveform inversion |
|
| transient acoustic topology optimization |
|
| analog neural networks | |
| transient photonic topology optimization |
|
- see the documentation for how the code works (AI-assisted; verify with sources for critical details)
- see examples for how to apply the code
Several GPUs take one argument, and the driver otherwise stays as it is:
Simulation(..., devices=(0, 1))splits one grid along its first axis over the listed GPUs, for grids too large or too slow for one.simulate,sensitivity,reconstruction_sensitivityandsuperposition_sensitivitythen run split and return the same result as on one GPU, bitwise. Try it with theDEVICESsetting of- examples/forward/scalarND.py, the forward problem in 2D or 3D
- examples/sensitivity/scalar2D_sensitivity.py, the gradient
misfit_gradient(..., devices=[0, 1])(andmeasure,misfit) deals the shots of an inversion out over the GPUs, which needs no communication and is the faster choice whenever one shot fits one GPU.
Scalar & acoustic wave equations have been developed over the last 2 years and are thoroughly validated. The elastic wave and electromagnetic wave equations were developed with AI assistance (Claude). The first is validated on experimental data, while the latter are cross-validated against the independent FDTD code FDTDX.
CuWave's runtime for identical discretizations is comparable to that of other established wave propagation finite difference codes. Speedups in 2D with reflecting boundaries (a ratio above 1 means CuWave is that many times faster) compared to the following frameworks:
- scalar wave equation
- Deepwave (forward: ~1.1x, sensitivity: ~1x)
- NVIDIA Warp (forward: ~2.1x, sensitivity: ~1.8x)
- SeismicWaves.jl (forward: ~4.4x, sensitivity: ~4x)
- Devito on CPU (forward: ~3.6x, sensitivity: ~3.8x)
- elastic wave equation
- Deepwave (forward: ~1.1x, sensitivity: ~1.3x)
- SeismicWaves.jl (forward: ~4x, sensitivity: ~5x)
Tested on one NVIDIA RTX PRO 500 Blackwell laptop GPU (6 GB) on the largest possible grids with CuWave's
superposition_sensitivityas reference for the sensitivities. The specific numbers need to be taken with a grain of salt, as they are subject to specific hardware and simulation setup. All implementations operate on the same order of magnitude.
Additional benefits of CuWave are
- the built-in higher order finite difference schemes, allowing for fewer grid points
- a sensitivity analysis whose memory is independent of the number of timesteps, allowing for orders of magnitude larger grids
pip install cuwaveRequires an NVIDIA GPU and CuPy matching your CUDA toolkit (e.g. pip install cupy-cuda12x), which is not pulled in automatically. For the full installation, including the optional PyTorch and running the tests, see docs/install.md.
If you use our code for your scientific research, please acknowledge this by referring to the following publication:
Herrmann, L., Bürchner, T., Kudela, L., Kollmannsberger, S., 2026, A memory-efficient adjoint method to enable billion parameter optimization on a single GPU in dynamic problems, Structural and Multidisciplinary Optimization, Volume 69, 52 (2026), DOI: 10.1007/s00158-025-04237-y
Ideas adapted from FDTDX (Mahlau, Schubert, Berg & Rosenhahn 2026), which also serves as the reference for validating the electromagnetic solvers.
For questions, bug reports, or collaboration inquiries, please don't hesitate to contact Leon Herrmann at herrmann.leon@pm.me.
MIT; see LICENSE.