Efficient data race detection for distributed memory parallel programs

Chang-Seo Park, Koushik Sen, Paul Hargrove, Costin IancuSC 2011

TL;DR

This paper introduces UPC-Thrille, a novel "active testing" framework for precisely detecting data races in distributed memory parallel programs. It tackles the challenge of scalability and precision in detecting these critical concurrency bugs, which are notoriously difficult to find in modern high-performance computing (HPC) applications.

What Problem Does This Paper Address?

Modern HPC applications increasingly rely on hybrid parallelism, combining shared-memory parallelism within nodes with distributed-memory parallelism across nodes. This complexity, especially with asynchronous communication and synchronization primitives, creates a fertile ground for concurrency bugs like data races. Existing tools often struggle with scalability on large distributed systems or lack precision, leading to false positives or missed bugs. This paper aims to bridge this gap by providing a precise and scalable solution for data race detection in distributed memory environments, specifically targeting languages like UPC that are representative of emerging HPC programming models.

Methods

The core of UPC-Thrille is an "active testing" methodology, which operates in two phases:

  • Phase I: Race Prediction (Imprecise Dynamic Analysis): This phase performs a dynamic analysis of a program execution to identify potential data races. It uses a modified lockset-based algorithm that is "barrier-aware." This means it accounts for the synchronization semantics of split-phase barriers and non-blocking collectives, which are common in HPC. The analysis records memory access events, the locks held, and the program phase. It then identifies pairs of statements that could access the same memory location concurrently without a common lock, even if a different thread schedule might prevent the actual race. This phase is designed to be scalable by distributing the analysis and using novel data structures like interval skip lists (IS-lists) to efficiently manage memory access information and avoid a central analysis bottleneck. Optimizations like "weaker-than" pruning and exponential backoff are employed to reduce overhead.
  • Phase II: Race Confirmation (Controlled Re-execution): This phase takes the potential data races identified in Phase I and attempts to confirm them. It re-executes the program, but this time, it actively controls the thread schedule. For each potential race pair, it tries to force an execution state where two threads are about to access the same memory location, with at least one access being a write. If successful, it reports a confirmed data race. This phase is also optimized with exponential backoff to manage the overhead of controlled execution.

Datasets

The paper evaluates UPC-Thrille on several benchmarks:

  • Custom UPC programs: Including a parallel knapsack implementation (used as a running example) and programs for fine-grained communication.
  • NAS Parallel Benchmarks (NPB): Releases 2.3, 2.4, and 3.3. These are standard benchmarks for HPC, covering both fine-grained and bulk communication patterns.

No new benchmarks were introduced; the focus was on applying the tool to existing HPC workloads.

Key Insights and Ideas

  • Distributed Analysis is Crucial for Scalability: The paper highlights that a centralized analysis approach for distributed memory programs is a major scalability bottleneck. UPC-Thrille's distributed approach, where each task manages its local access information and queries remote tasks, is key to its scalability.
  • Barrier Awareness is Essential for Reducing False Positives: Traditional lockset analysis struggles with barrier synchronization. The "barrier-aware" modification in Phase I significantly reduces false positives by understanding how barriers partition program execution.
  • Active Testing Offers Precision with Coverage: The two-phase approach is a clever way to balance precision (Phase II confirms actual races) with coverage (Phase I explores a wider range of potential interleavings than a single execution might). While Phase I can have false positives, Phase II ensures that reported races are real.
  • HPC-Specific Constructs Require Tailored Analysis: The paper demonstrates the need to handle constructs like split-phase barriers and non-blocking collectives, which are prevalent in modern HPC languages like UPC, for effective race detection.

Key Results

  • Scalability: UPC-Thrille scales to 1024 cores for NPB benchmarks, with phase I overhead generally remaining low (a few percent slowdown). Phase II overhead was also manageable, often negligible with a 10ms delay.
  • Precision: The tool confirmed previously known bugs and uncovered several unknown ones. It reported no false positives in confirmed races.
  • Overhead: Phase I (race prediction) added a small runtime overhead (up to 15% in some cases). Phase II (race confirmation) had negligible overhead when using a 10ms delay.
  • Optimization Effectiveness: Techniques like "weaker-than" pruning reduced memory accesses by up to 46%, and exponential backoff further reduced communication overhead.

Limitations and Future Work

  • Missed Races: As a dynamic analysis technique, UPC-Thrille can miss data races that occur in parts of the program not executed during the test runs.
  • False Positives from Custom Synchronization: The paper notes that Phase I can report false positives when applications use custom synchronization mechanisms not understood by the tool. Phase II might not confirm these if the custom synchronization prevents the race.
  • Future Work: The authors suggest extending the framework to other concurrency bugs and programming languages. Further work on improving the precision of Phase I and exploring more sophisticated ways to handle custom synchronization would be valuable.

Summary updated

BibTeX
@inproceedings{park2011efficient,
  author = {Chang-Seo Park and Koushik Sen and Paul Hargrove and Costin Iancu},
  title = {{Efficient data race detection for distributed memory parallel programs}},
  booktitle = {SC},
  year = {2011},
  doi = {10.1145/2063384.2063452},
}
Figure