High-level python abstractions for optimal checkpointing in inversion problems

Navjot Kukreja, Jan Hückelheim, Michael Lange, Mathias Louboutin, Andrea Walther, Simon W. Funke, Gerard Gorman

Abstract

Seismic imaging and other PDE-constrained optimization problems rely on the adjoint-state method, which presents significant memory challenges due to the need for forward simulation states during the reverse pass. This paper introduces pyRevolve, a Python library that provides high-level abstractions for optimal checkpointing. By wrapping the C++ Revolve library and integrating with the Devito DSL, pyRevolve enables large-scale simulations on memory-constrained hardware while maintaining mathematical correctness and minimizing computational overhead.

Introduction: The Memory Bottleneck in Seismic Inversion

In geophysics, the adjoint-state method is the standard approach for calculating gradients in seismic imaging. However, this method requires the state of the forward simulation at every time step to compute the gradient during the backward pass. For realistic 3D models, storing every time step can require terabytes of RAM, far exceeding the capacity of modern high-performance computing (HPC) nodes.

A typical seismic survey setup illustrating the complexity of subsurface imaging and the need for efficient data processing.

To mitigate this, researchers use checkpointing: storing a subset of simulation states ("snapshots") and recomputing the missing intervals. The challenge lies in determining an optimal schedule—deciding which steps to save and which to recompute—to minimize the total runtime for a fixed memory budget. Manually implementing these schedules is notoriously difficult and error-prone.

The pyRevolve Framework

The authors present pyRevolve, a library designed to bridge the gap between complex C++ checkpointing algorithms and high-level Python simulation environments. The framework is built on three pillars:

  1. Optimal Scheduling: It utilizes the Revolve algorithm, which employs a binomial strategy to find the mathematically optimal recomputation schedule for a given number of memory slots.
  2. Abstraction Layers: pyRevolve provides a clean Python API that separates the scheduling logic from the physical data movement. Users interact with abstract classes like Checkpoint and Operator, allowing the library to be agnostic of the underlying simulation data.
  3. DSL Integration: A key feature is its integration with Devito, a Domain-Specific Language for finite-difference solvers. This allows users to implement optimal checkpointing in complex seismic workflows with minimal "glue code."
The pyRevolve software stack, showing the layering from low-level C++ algorithms to high-level Python applications.

Evaluation and Results

The system was evaluated using synthetic seismic models and a large-scale $230^3$ grid simulation. Key findings include:

  • Mathematical Correctness: The implementation passed the "gradient test" (a Taylor series convergence test), proving that the checkpointing and recomputation logic did not introduce numerical errors.
  • Scalability: The library successfully managed a simulation that would otherwise require ~80 GB of RAM, demonstrating its utility for memory-constrained environments.
  • Performance Trade-offs: While the scheduling is optimal, the authors noted practical overheads stemming from Python/C boundary crossings and NumPy "deep copies," which slightly reduce performance compared to theoretical limits.

Conclusion and Future Work

pyRevolve lowers the barrier to entry for using optimal checkpointing in HPC workflows by providing a high-level Python interface. By automating the complex orchestration of forward and reverse passes, it enables researchers to focus on physics rather than memory management. Future developments aim to support parallel adjoint calculations, multi-stage checkpointing (swapping to disk), and adaptive time-stepping for more dynamic simulations.

Summary updated

BibTeX
@misc{kukreja2018high,
  author = {Navjot Kukreja and Jan Hückelheim and Michael Lange and Mathias Louboutin and Andrea Walther and Simon W. Funke and Gerard Gorman},
  title = {{High-level python abstractions for optimal checkpointing in inversion problems}},
  year = {2018},
  eprint = {1802.02474},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1802.02474},
}
Figure