DIVA: A Declarative and Reactive Language for in situ Visualization

Qi Wu, Tyson Neuroth, Oleg Igouchkine, Aditya Konduri, Jacqueline H. Chen, Kwan-Liu Ma

TL;DR

DIVA is a new domain-specific language that brings Functional Reactive Programming (FRP) to high-performance scientific simulations. It allows researchers to build complex, adaptive in situ visualization workflows—like "only save data if an anomaly is detected"—using simple, declarative code that is as fast as hand-optimized C++.

What Problem Does This Paper Address?

Modern supercomputers produce data at a rate that far outstrips our ability to save it to disk (the "I/O bottleneck"). To solve this, scientists use in situ visualization, where data is processed and visualized while the simulation is still running in memory.

The challenge arises when workflows need to be adaptive. For example, a scientist might want the simulation to automatically increase visualization frequency or "zoom in" only when a specific physical phenomenon (like an auto-ignition kernel in a combustion engine) appears. Programming these "triggers" in traditional languages like C++ or Python is a nightmare: the logic gets fragmented across different stages of the simulation, leading to "callback hell," memory leaks, and synchronization errors in parallel environments.

Methods

The authors introduce DIVA (Declarative and Reactive Language), which consists of three main parts:

  1. A Declarative DSL: An FRP-based language where time-varying simulation data are treated as "signals." Instead of writing loops and if-statements to manage state, users define the relationship between data and actions (e.g., Trigger(temp > 1000) { save_image(vol) }).
  2. A Workflow Manager: This component translates the high-level code into a Directed Acyclic Graph (DAG). it uses lazy evaluation and caching to ensure that expensive visualization tasks are only performed when absolutely necessary.
  3. A Low-Level C++ API: This allows DIVA to be extensible. Developers can write custom, high-performance modules in C++ that the high-level DSL can then orchestrate.

Crucially, DIVA handles the complexities of parallel computing (MPI). It distinguishes between "global" functions (which require all processor ranks to sync up) and "non-global" functions, preventing the simulation from deadlocking when different processors try to trigger different actions.

Datasets

The system was evaluated using S3D, a world-class Direct Numerical Simulation (DNS) solver used for combustion research.

  • Case Study: Anomaly detection in a turbulent premixed auto-ignition problem.
  • Hardware: Benchmarks were performed on the Summit supercomputer at Oak Ridge National Laboratory, scaling up to 1,024 nodes (32,768 MPI ranks) using IBM POWER9 CPUs and NVIDIA V100 GPUs.

Key Insights and Ideas

  • Signals over Callbacks: By treating simulation data as a continuous "signal" rather than a series of discrete updates, DIVA allows users to process time-sequences using array-like operations. This removes the need for users to manually manage "static storage" to remember what happened in previous timesteps.
  • Impure Functions for State: To avoid the massive memory footprint of classical FRP, DIVA introduces "Window" functions. These allow the system to keep a small, user-defined history of data (e.g., the last 10 timesteps) specifically for feature tracking without saving everything.
  • Automatic Synchronization: One of the biggest "aha" moments is DIVA’s ability to automatically handle MPI barriers. In traditional C++, if one processor triggers a visualization and another doesn't, the whole simulation crashes. DIVA tracks these dependencies and ensures all ranks participate in global operations correctly.

Key Results

  • Conciseness: Complex workflows that require dozens of lines of boilerplate in C++ or Python can be expressed in just a few lines of DIVA code.
  • Performance: Despite the high-level abstraction, DIVA introduces negligible overhead. In scaling tests on Summit, DIVA’s total execution time was within ±6% of a highly optimized, hand-written C++ reference implementation.
  • Efficiency: In some high-resolution tests (512³ grid), DIVA was actually faster than the reference C++ code because its internal DAG manager optimized the calculation of feature metrics more effectively than the manual implementation.

Limitations and Future Work

  • Language Constraints: The declarative DSL currently does not support native loops or user-defined functions; these must still be implemented via the low-level C++ API.
  • In-Transit Support: DIVA is currently designed for in situ (same nodes as simulation) workflows. The authors note that "in-transit" (moving data to separate visualization nodes) support is a goal for future versions.
  • Static Graphs: Once a DIVA workflow is compiled, the data dependencies cannot be modified on the fly. While you can change parameters, you can't redefine the entire workflow logic without a restart.
  • Safety: While DIVA protects against logical flow errors, it doesn't yet have strict "sandboxing" for custom C++ modules, meaning a poorly written low-level module can still cause issues.

Summary updated

Abstract

The use of adaptive workflow management for in situ visualization and analysis has been a growing trend in large-scale scientific simulations. However, coordinating adaptive workflows with traditional procedural programming languages can be difficult because system flow is determined by unpredictable scientific phenomena, which often appear in an unknown order and can evade event handling. This makes the implementation of adaptive workflows tedious and error-prone. Recently, reactive and declarative programming paradigms have been recognized as well-suited solutions to similar problems in other domains. However, there is a dearth of research on adapting these approaches to in situ visualization and analysis. With this paper, we present a language design and runtime system for developing adaptive systems through a declarative and reactive programming paradigm. We illustrate how an adaptive workflow programming system is implemented using our approach and demonstrate it with a use case from a combustion simulation.
BibTeX
@inproceedings{wu2020diva,
  author = {Qi Wu and Tyson Neuroth and Oleg Igouchkine and Aditya Konduri and Jacqueline H. Chen and Kwan-Liu Ma},
  title = {{DIVA: A Declarative and Reactive Language for in situ Visualization}},
  booktitle = {LDAV},
  year = {2020},
  url = {https://openreview.net/forum?id=nreuEd5UKSY},
}
Figure