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.
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:
- 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.
- Abstraction Layers: pyRevolve provides a clean Python API that separates the scheduling logic from the physical data movement. Users interact with abstract classes like
CheckpointandOperator, allowing the library to be agnostic of the underlying simulation data. - 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."
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