A 2D Parallel Triangle Counting Algorithm for Distributed-Memory Architectures

Ancy Sarah Tom, George KarypisIcpp 2019

TL;DR

This paper introduces a novel 2D cyclic decomposition algorithm for efficiently counting triangles in massive graphs on distributed-memory systems. By optimizing communication and computation patterns, their approach achieves significant speedups over previous methods, making large-scale graph analysis more feasible.

What Problem Does This Paper Address?

Triangle counting is a fundamental graph analysis task crucial for understanding network structure, community detection, and identifying influential entities. As real-world graphs grow exponentially in size, analyzing them on distributed-memory systems (where data is spread across multiple machines) becomes essential. However, existing distributed-memory algorithms face challenges with high communication overhead and load imbalance, limiting their scalability. This paper aims to overcome these limitations by developing a more efficient and scalable distributed-memory triangle counting algorithm.

Methods

The core of this paper is a new triangle counting algorithm that employs a 2D cyclic decomposition of the graph data and computations across a square grid of processors (√p × √p). This approach is inspired by Cannon's parallel matrix multiplication algorithm, leveraging its communication patterns to efficiently distribute and process graph data.

Key methodological aspects include:

  • 2D Cyclic Decomposition: Instead of a simple 1D partitioning, data is distributed cyclically in two dimensions. This helps balance the workload and reduce communication costs by ensuring that processors involved in computations have access to the necessary data in a structured manner.
  • Set Intersection Approach: The algorithm builds upon a map-based set intersection method for identifying triangles, which is generally faster than list-based approaches.
  • Degree-Based Vertex Reordering: Vertices are reordered based on their degree in non-decreasing order. This is a standard optimization in triangle counting that significantly reduces computation time by processing sparser adjacency lists first.
  • Optimizations for Sparsity: The algorithm incorporates several optimizations to handle the inherent sparsity of real-world graphs:
  • Modified Hashing: A heuristic approach to modify hashing for sparser vertices, reducing collisions and speeding up lookups.
  • Doubly Sparse Traversal: An optimization to efficiently skip vertices with empty adjacency lists, avoiding unnecessary computations.
  • Eliminating Unnecessary Intersections: A technique to prune the search space during intersection operations by leveraging the degree ordering and the structure of the data.
  • Communication Pattern: The algorithm utilizes a communication pattern similar to Cannon's algorithm, involving a series of shifts to move data blocks among processors, which is memory-scalable and reduces communication overhead.

Datasets

The authors evaluated their algorithm on a mix of large-scale synthetic and real-world graphs:

  • Synthetic Graphs:
    • g500-s26, g500-s27, g500-s28, g500-s29 (generated using the graph500 generator)
  • Real-World Graphs:
    • twitter
    • friendster

These datasets vary significantly in size (number of vertices and edges) and triangle counts, providing a robust testbed for the algorithm's performance.

Key Insights and Ideas

  • 2D Decomposition is Key for Scalability: The paper strongly suggests that a 2D decomposition, especially a cyclic one, is crucial for achieving good scalability in distributed-memory triangle counting. It effectively balances computation and communication, which are major bottlenecks in larger systems.
  • Leveraging Matrix Multiplication Patterns: Adapting communication patterns from established algorithms like Cannon's matrix multiplication can be highly effective for other graph problems, demonstrating a powerful cross-domain application of algorithmic techniques.
  • Sparsity is a Double-Edged Sword: While sparsity is inherent to large graphs, it also presents opportunities for optimization. The paper shows that specific techniques tailored to sparse data structures (like CSR) and optimized intersection strategies can yield substantial performance gains.
  • Pre-processing Matters: The significant time spent in pre-processing (vertex reordering, data distribution) highlights its importance. While it adds to the overall runtime, it lays the groundwork for efficient triangle counting, and the paper shows that triangle counting itself scales better than pre-processing.

Key Results

  • Significant Speedup: The algorithm achieved an average relative speedup ranging from 3.24 to 7.22 when scaling from 16 to 169 MPI ranks.
  • Outperforms Previous Methods: The paper reports an average speedup of 10.2 times compared to previously developed distributed-memory parallel algorithms, specifically mentioning Havoq.
  • Scalability: The triangle counting phase scales better than the pre-processing phase, with a relative speedup on 169 ranks being, on average, 1.71 times higher than that achieved by pre-processing.
  • Efficiency: Efficiency plots show that the triangle counting phase maintains better efficiency as the number of ranks increases compared to the pre-processing phase.
  • Super-linear Speedup: For some datasets, a super-linear speedup was observed at 25 ranks compared to 16 ranks, attributed to better cache utilization with more processors.

Limitations and Future Work

  • Load Imbalance: While the 2D cyclic decomposition helps, some degree of load imbalance still exists, particularly in the triangle counting phase. The paper quantifies this imbalance (e.g., 1.05 for 25 ranks, 1.14 for 36 ranks on g500-s29).
  • Redundant Work: Despite optimizations, some redundant computations remain, especially as the number of ranks increases. The paper notes an increase in tasks by 25% and 20% when scaling from 16 to 25 and 25 to 36 ranks, respectively, for the g500-s29 dataset.
  • Communication Overhead Growth: While the algorithm aims to reduce communication, the fraction of time spent on communication increases as the number of ranks grows.
  • Future Work: The authors suggest that the algorithm can be extended to handle rectangular processor grids using algorithms like SUMMA. Further algorithmic and data structure improvements could potentially better balance work and reduce redundant computations.

Summary updated

BibTeX
@inproceedings{tom2019d,
  author = {Ancy Sarah Tom and George Karypis},
  title = {{A 2D Parallel Triangle Counting Algorithm for Distributed-Memory Architectures}},
  booktitle = {Icpp},
  year = {2019},
  doi = {10.1145/3337821.3337853},
}
Figure