Devito: a scalable and portable stencil DSL and compiler

Figure 1: 3D TTI imaging on a custom overthrust-salt model (Witte et al. 2020). This image was computed using Devito and high-level abstraction for Cloud Computing. Images courtesy of SLIM @ GeorgiaTech.

Devito is a Python package to implement optimized stencil computation (e.g., finite differences, image processing, machine learning) from high-level symbolic problem definitions. Devito builds on SymPy and employs automated code generation and just-in-time compilation to execute optimized computational kernels on several computer platforms, including CPUs, GPUs, and clusters thereof.

Symbolic computation is a powerful tool that allows users to:

Devito is primarily designed to create wave propagation kernels for use in seismic inversion problems. A tutorial for the generation of a modelling operator using an acoustic wave equation can be found here. A paper outlining the symbolic API and the verification procedures of the acoustic operator can be found here (Louboutin et al. 2019) and the internals of the compiler are described in this paper (Luporini et al. 2020).

Key Features

  • A functional language to express finite difference operators.
  • Straightforward mechanisms to adjust the discretization.
  • Constructs to express sparse operators (e.g., interpolation), classic linear operators (e.g., convolutions), and tensor contractions.
  • Seamless support for boundary conditions and adjoint operators.
  • A flexible API to define custom stencils, sub-domains, sub-sampling, and staggered grids.
  • Generation of highly optimized parallel code (SIMD vectorization, CPU and GPU parallelism via OpenMP and OpenACC, multi-node parallelism via MPI, blocking, aggressive symbolic transformations for FLOP reduction, etc.).
  • Distributed NumPy arrays over multi-node (MPI) domain decompositions.
  • Inspection and customization of the generated code.
  • Autotuning framework to ease performance tuning.
  • Smooth integration with popular Python packages such as NumPy, SymPy, Dask, and SciPy, as well as machine learning frameworks such as TensorFlow and PyTorch.

You can find below an introductory tutorial to Devito.

(Disclosed) Software using Devito

Back to top


Louboutin, M., M. Lange, F. Luporini, N. Kukreja, P. A. Witte, F. J. Herrmann, P. Velesko, and G. J. Gorman. 2019. “Devito (V3.1.0): An Embedded Domain-Specific Language for Finite Differences and Geophysical Exploration.” Geoscientific Model Development 12 (3): 1165–87.
Luporini, Fabio, Mathias Louboutin, Michael Lange, Navjot Kukreja, Philipp Witte, Jan Hückelheim, Charles Yount, Paul H. J. Kelly, Felix J. Herrmann, and Gerard J. Gorman. 2020. “Architecture and Performance of Devito, a System for Automated Stencil Computation.” ACM Trans. Math. Softw. 46 (1).
Witte, Philipp A., Mathias Louboutin, Charles Jones, and Felix J. Herrmann. 2020. “Serverless Seismic Imaging in the Cloud.”