Avalanche: a fine-grained flow graph model for irregular applications on distributed-memory systems

Jeremiah J. Willcock, Ryan R. Newton, Andrew LumsdaineFHPC@ICFP 2012 · DOI

TL;DR

This paper introduces Avalanche, a C++ library that simplifies programming for complex, irregular parallel applications on distributed systems. It achieves this by using a fine-grained flow graph model that automatically generates efficient active-message handlers, enabling optimizations like kernel fusion that were previously difficult to achieve.

What Problem Does This Paper Address?

Modern high-performance computing increasingly relies on irregular applications, such as graph algorithms, which are notoriously difficult to parallelize efficiently on distributed-memory systems. Existing flow-graph models often require specialized languages or are limited to coarse-grained applications. While active messages offer a way to handle fine-grained parallelism, they introduce complexity by separating control flow between the main program and message handlers. This paper aims to bridge this gap by providing a unified, library-based flow graph model that simplifies the expression of fine-grained, irregular computations while maintaining high performance through automatic optimization.

Methods

Avalanche is a C++ library built on top of the Active Pebbles programming model, which itself uses MPI for communication. The core innovation is a fine-grained flow graph model constructed using combinators at compile-time. This compile-time construction allows for significant optimizations, most notably kernel fusion and deforestation, similar to techniques used in functional programming.

Key techniques include:

  • Compile-time graph construction: Combinators are used to build the flow graph structure, allowing the C++ compiler to analyze and optimize it.
  • Automatic active-message handler generation: Avalanche automatically generates the necessary handlers for communication, abstracting away much of the complexity.
  • Continuation-Passing Style (CPS): The implementation heavily utilizes CPS, enabling nodes to be composed and optimized by the compiler.
  • Type-erasure and metaprogramming: C++ template metaprogramming and type-erasure techniques are employed to achieve flexibility and enable compiler optimizations like inlining.
  • Dynamic graph capabilities: While primarily compile-time focused, Avalanche also offers limited run-time graph rewiring capabilities using dynamic_sender and dynamic_receiver nodes, albeit with a performance penalty.

Datasets

The paper evaluates Avalanche using two example programs:

  • Permutation: A benchmark involving data redistribution and lookup operations.
  • Breadth-First Search (BFS): A graph algorithm that requires synchronization and fine-grained communication.

These examples were adapted from previous work using the Active Pebbles model, allowing for direct comparison with manual active message implementations and MPI. No new datasets were introduced.

Key Insights and Ideas

  • Compile-time flow graphs unlock performance: By constructing flow graphs at compile-time, Avalanche enables aggressive optimizations like kernel fusion and deforestation, which are crucial for achieving high performance on fine-grained, irregular applications.
  • Abstraction of active messages simplifies development: Automatically generating active-message handlers significantly reduces the burden on the programmer, who can focus on the application logic rather than low-level communication details.
  • Functional programming techniques in C++ are powerful for parallelism: The paper demonstrates how concepts like continuation-passing style and template metaprogramming, when applied within C++, can lead to expressive and efficient parallel programming models.
  • Trade-offs between static and dynamic graphs: While compile-time graph construction offers performance benefits, the paper acknowledges the need for dynamic graph capabilities for certain applications, highlighting the inherent trade-off between flexibility and optimization.

Key Results

Avalanche introduces some overhead compared to direct AM++ or MPI implementations, but this overhead is generally modest.

  • Permutation: Avalanche showed an overhead of 4.5% on one node, increasing to 9.7% on 32 nodes.
  • BFS: The overhead was higher at 12.9% on one node but reduced to 2.7%-5.9% on larger node counts.
  • Relative to manually written MPI, Avalanche performed better on Permutation and worse on BFS.
  • The paper notes that a collective-based MPI implementation ran out of memory on 512 nodes, suggesting Avalanche's approach might be more scalable for certain problems.

Limitations and Future Work

  • Limited dynamic graph capabilities: The current implementation of dynamic graph rewiring has a performance penalty.
  • Side effects for subgraph communication: The prototype uses side effects to communicate information out of subgraphs and loops, which the authors suggest could be reduced.
  • Need for more combinators: The authors suggest adding more pipeline combinators, including those for arbitrary graph structures and more sophisticated data distribution.
  • Intra-process parallelism: While Avalanche targets distributed-memory systems, it doesn't inherently exploit shared-memory parallelism within a process. The authors suggest integrating work-stealing systems like Cilk or TBB.
  • Functional programming limitations in C++: The paper points out that despite C++11 improvements, lambda functions still have limitations for polymorphic functions, requiring manual class definitions or std::bind for certain scenarios.
  • Future work includes: adding more combinators, supporting arbitrary graph structures at compile-time, improving intra-process parallelism, and reducing reliance on side effects for subgraph communication.

Summary updated

BibTeX
@inproceedings{willcock2012avalanche,
  author = {Jeremiah J. Willcock and Ryan R. Newton and Andrew Lumsdaine},
  title = {{Avalanche: a fine-grained flow graph model for irregular applications on distributed-memory systems}},
  booktitle = {FHPC@ICFP},
  year = {2012},
  doi = {10.1145/2364474.2364479},
}
Figure