Skip to content

Repository files navigation

k-wave-python

Support Documentation Status codecov

A Python implementation of k-Wave — an acoustics toolbox for time-domain simulation of acoustic wave fields. Includes a pure NumPy/CuPy solver (backend="python", supports any CUDA-capable GPU) and an interface to the pre-compiled k-Wave C++ binaries (backend="cpp") with NVIDIA GPU support for compute capability 7.5 (Turing) and newer — covers every consumer/datacenter GPU since 2018, including all shipping Blackwell variants (B200/GB200, B300/GB300, Jetson Thor, RTX 50xx, RTX PRO 6000 Blackwell, GB10/DGX Spark).

Mission

Increase the accessibility and reproducibility of k-Wave simulations for medical imaging, algorithmic prototyping, and testing.

Getting started

A collection of examples covers common simulation scenarios. Run any example locally:

uv run examples/ivp_homogeneous_medium.py

No GPU required — all examples run on CPU with NumPy.

Benchmarks

Reference runtimes for the 3D scaling benchmark in benchmarks/benchmark.py. Values are total elapsed seconds for a single default run (3D initial-value problem, heterogeneous absorbing medium, 1000 timesteps, averaged over 3 repeats).

Backend OS Accelerator k-wave-python Binary 64³ 128³ 256³ Hardware
python Linux CPU 0.6.3rc1 127 GCP n1-highmem-8, 8 vCPU
python Linux NVIDIA GPU 0.6.3rc1 6 71 382 NVIDIA T4, 15 GB (GCP n1-highmem-8)
python macOS (Apple Silicon) CPU 81 Apple M1, 8 GB
python Windows CPU 0.6.3rc1 341 GCP n1-highmem-8, 8 vCPU
python Windows NVIDIA GPU 0.6.3rc1 6 44 751 NVIDIA T4, 15 GB (GCP n1-highmem-8)
cpp Linux CPU (OMP) 0.6.3rc1 v1.4.2 6 46 669 GCP n1-highmem-8, 8 vCPU
cpp Linux NVIDIA GPU (CUDA) 0.6.3rc1 v1.4.2 2 7 51 NVIDIA T4, 15 GB (GCP n1-highmem-8)
cpp macOS (Apple Silicon) CPU (OMP) 0.6.3rc1 v1.4.2
cpp Windows CPU (OMP) 0.6.3rc1 v1.4.2 18 157 1243 GCP n1-highmem-8, 8 vCPU
cpp Windows NVIDIA GPU (CUDA) 0.6.3rc1 v1.4.2 2 8 57 NVIDIA T4, 15 GB (GCP n1-highmem-8)

Contributions welcome — open a PR filling a row with your k-wave-python version, and (for cpp backend) BINARY_VERSION. See benchmarks/README.md for the reproducer command.

Installation

Using uv (recommended):

uv add k-wave-python

Or with pip:

pip install k-wave-python

Older GPUs (Maxwell, Pascal, Volta)

The backend="cpp" binaries shipped in v0.6.3+ require compute capability 7.5 (Turing) or newer. CUDA Toolkit 13.0 removed offline-compilation support for older architectures, so the following hardware is not covered by the bundled binaries:

  • Maxwell (GTX 9xx, Titan X Maxwell, Tesla M-series, Jetson Nano)
  • Pascal (GTX 10xx, P100, P40, Titan X(p)/Xp, Jetson TX2)
  • Volta (V100, Titan V, Quadro GV100, Jetson AGX Xavier)

Use backend="python" instead (NumPy/CuPy works on every CUDA-capable GPU), or build the C++ backend from source against CUDA Toolkit 12.x.

Development

Development instructions can be found here.

Related Projects

  1. k-Wave: A MATLAB toolbox for the time-domain simulation of acoustic wave fields.
  2. j-wave: Differentiable acoustic simulations in JAX.
  3. ADSeismic.jl: a finite difference acoustic simulator with support for AD and JIT compilation in Julia.
  4. stride: a general optimisation framework for medical ultrasound tomography.

Documentation

The documentation for k-wave-python can be found here.

Citation

@software{k-Wave-Python,
author = {Yagubbayli, Farid and Sinden, David and Simson, Walter},
license = {GPL-3.0},
title = {{k-Wave-Python}},
url = {https://github.com/waltsims/k-wave-python}
}

Contact

e-mail walter.a.simson@gmail.com.

About

A Python interface to k-Wave GPU accelerated binaries

Topics

Resources

Contributing

Stars

220 stars

Watchers

5 watching

Forks

Releases

Used by

Contributors

Languages