Integrating Odeint Time Stepping into OpenFPM for Distributed and GPU Accelerated Numerical Solvers

Abhinav Singh, Landfried Kraatz, Pietro Incardona, Ivo F. Sbalzarini

TL;DR

This paper introduces a novel integration of the Boost.Odeint time-stepping library with the OpenFPM framework, enabling efficient and scalable numerical simulations on distributed-memory systems and GPUs. This work simplifies the development of complex scientific solvers by providing access to a wide range of adaptive and high-order time integration methods within OpenFPM's expressive C++ template metaprogramming system, achieving significant performance gains.

What Problem Does This Paper Address?

Developing accurate and efficient numerical solvers for dynamical systems, especially those described by partial differential equations (PDEs), is a significant challenge. These simulations often require sophisticated time-integration schemes to accurately capture the system's evolution. Furthermore, achieving performance portability across diverse hardware architectures, from multi-core CPUs to massively parallel GPU clusters, necessitates careful management of data distribution and computation. Traditional approaches often lead to method-specific code, making it difficult to experiment with different time-stepping algorithms or adapt to new hardware. This paper addresses the need for a unified, flexible, and performant framework that simplifies the integration of advanced time-stepping methods into parallel and heterogeneous computing environments.

Methods

The core of this work lies in creating an interface between the Boost.Odeint library and the OpenFPM framework. This was achieved by:

  • Custom Odeint State Types and Algebras: Developing specialized state_type and Algebra classes for OpenFPM's distributed data structures. These classes allow Odeint to operate on OpenFPM's parallel data containers, including those for CPUs and GPUs. This leverages OpenFPM's template metaprogramming to provide hardware-abstracted data structures.
  • Template Metaprogramming Integration: Extending Odeint's concepts to work seamlessly with OpenFPM's template expression system. This enables the use of Odeint's time-integration methods directly within OpenFPM's domain-specific language for differential equations.
  • Separation of Concerns: The implementation adheres to a "separation of concerns" principle, ensuring that the time-stepping scheme is independent of the specific right-hand-side function (which encapsulates the physics and spatial discretization) and the underlying hardware architecture.

Datasets

The paper does not explicitly mention or introduce new datasets. Instead, it uses well-defined mathematical problems for benchmarking and validation:

  • Parametric Families of Exponential and Sigmoidal Dynamics: These are used to verify the correctness and convergence orders of various time-stepping schemes.
  • 3D Gray-Scott Reaction-Diffusion Problem: A standard benchmark for testing the parallel scalability of the implementation in the presence of spatial coupling.
  • "Dam Break" Scenario (Smoothed Particle Hydrodynamics - SPH): A more complex, real-world fluid mechanics problem used to evaluate performance on non-trivial geometries and free-surface flows.

Key Insights and Ideas

  • Unified Time-Stepping for Parallel & Heterogeneous Computing: The integration provides a single interface for accessing a rich set of time-stepping methods, abstracting away the complexities of distributed memory and GPU programming.
  • Performance Portability: By leveraging OpenFPM's hardware-agnostic design and Odeint's template-based approach, the developed solution offers performance portability across CPUs and GPUs without requiring architecture-specific code.
  • Simplified Solver Development: The template-expression language combined with Odeint's methods allows for more compact and less error-prone code for numerical solvers, reducing development time.
  • Odeint's Optimized Code Benefits OpenFPM: The benchmarks show that the native OpenFPM implementation can be slower than the Odeint+OpenFPM integration, suggesting that Odeint's highly optimized code for stage computations provides performance benefits.
  • Minimal Overhead for GPU Integration: Crucially, the GPU implementation does not require manual CUDA coding, as the OpenFPM backend handles the GPU targeting automatically.

Key Results

  • Correctness: The implementation correctly reproduces the expected convergence orders for various time-stepping schemes on both exponential and sigmoidal dynamics, up to machine precision.
  • Scalability:
    • CPU: Achieved approximately 80% parallel efficiency on up to 512 CPU cores for the 3D Gray-Scott problem, demonstrating good scalability in the presence of spatial coupling.
  • GPU: A single Nvidia GeForce RTX 4090 GPU achieved a five-fold speedup compared to 32 CPU cores for the tested problems.
  • Overhead: The Odeint interface introduced minimal overhead on CPUs (below 7% for the SPH dam-break case) and no significant overhead on GPUs compared to a hand-written reference implementation.

Limitations and Future Work

  • Explicit Steppers Only: The current implementation is limited to explicit time-stepping schemes available in Odeint.
  • Dimensionality Limit: The state-types currently support vector dimensions up to 6.
  • Algebra Complexity Limit: The custom algebra is limited to steppers requiring no more than 15 inline methods.
  • No Implicit/Stiff Solvers: Implicit and stiff ODE integrators are not currently supported due to their reliance on uBLAS, which lacks generic types and parallelism support.
  • Future Work: The authors suggest adding support for SUNDIALS as another time-integration backend. They also highlight the potential for extending autotuning systems to the time dimension, enabling automatic selection of optimal time steppers and step sizes. The presented framework has already been instrumental in solving complex active hydrodynamics problems, leading to new discoveries.

Summary updated

BibTeX
@article{singh2023integrating,
  author = {Abhinav Singh and Landfried Kraatz and Pietro Incardona and Ivo F. Sbalzarini and Ivo F Sbalzarini},
  title = {{Integrating Odeint Time Stepping into OpenFPM for Distributed and GPU Accelerated Numerical Solvers}},
  journal = {Journal of Open Research Software},
  year = {2023},
}
Figure