Efficient Resource Oblivious Algorithms for Multicores

Richard Cole, Vijaya RamachandranarXiv 2011

Abstract

In multicore computing, achieving high performance requires minimizing data movement costs, specifically cache misses and false sharing. This paper presents a formal framework for "resource-oblivious" algorithms that achieve near-optimal performance across diverse multicore architectures without prior knowledge of hardware-specific parameters such as cache size ($M$) or block size ($B$). We introduce Hierarchical Balanced Parallel (HBP) computations and the Priority Work Stealing (PWS) scheduler, demonstrating that deterministic scheduling and refined data layouts can effectively bound the overhead of memory block transfers.

Introduction

Modern multicore processors present a significant challenge for algorithm designers: performance is often dominated by memory hierarchy effects rather than raw computational work. Two primary bottlenecks are cache misses, where a processor lacks data in its local fast memory, and false sharing (or block misses), where multiple cores contend for different variables residing on the same memory block. While cache-oblivious algorithms have been successful for single-core systems, extending these benefits to parallel environments has historically required hardware-specific tuning or complex, often randomized, scheduling.

The Resource-Oblivious Framework

The authors propose a two-pronged approach to achieve resource obliviousness, ensuring algorithms remain efficient regardless of the underlying hardware's $M$ and $B$.

Hierarchical Balanced Parallel (HBP) Computations

HBP computations are a class of divide-and-conquer algorithms designed to minimize data contention. They employ two key techniques:

  1. Limited Access Writes: By restricting the number of times variables are written, the framework reduces the frequency of expensive cache invalidations.
  2. Gapping Technique: To mitigate false sharing, the authors introduce "gaps"—intentional empty spaces in data layouts. This ensures that tasks executed on different cores are less likely to access the same memory block, effectively isolating their memory footprints.

Priority Work Stealing (PWS) Scheduler

Unlike traditional randomized work-stealing schedulers (e.g., Cilk), the PWS scheduler is deterministic. It assigns priorities based on the depth of tasks within the computation tree. This prioritization ensures that when a core "steals" work, it acquires a sufficiently large task to amortize the cost of warming up its local cache. This deterministic approach allows for tighter, worst-case bounds on memory block transfers between cores.

Key Results and Analysis

The effectiveness of the HBP framework and PWS scheduler is demonstrated through the analysis of several fundamental algorithms. The authors prove that these algorithms achieve optimal or near-optimal cache complexity while maintaining efficient work and span (critical path) bounds.

Complexity bounds for various resource-oblivious algorithms under the HBP framework and PWS scheduler.

As shown in the table above, algorithms such as Scans, Matrix Transposition (MT), and Strassen's matrix multiplication achieve optimal cache misses ($Q(n, M, B)$). For instance, Scans and MT achieve $O(n/B)$ misses, accounting for both traditional cache misses and false sharing. More complex tasks like the Fast Fourier Transform (FFT) and List Ranking (LR) also exhibit strong performance, provided the "tall cache" assumption (e.g., $M \ge B^2$) holds.

The runtime for Type 1 and Type 2 HBP algorithms under the PWS scheduler is bounded by $O(\frac{W}{p} + b \cdot \frac{Q}{p} + s_P \cdot T_\infty)$, where $W$ is total work, $Q$ is sequential cache complexity, $p$ is the number of processors, and $T_\infty$ is the span.

Discussion and Limitations

While the framework provides a robust theoretical foundation, certain practical considerations remain. Many optimal bounds rely on the "tall cache" assumption, which may not be satisfied at all levels of a real-world cache hierarchy. Additionally, the PWS scheduler introduces a $O(\log p)$ overhead for distributed implementation, which could be significant in practice. Future work involves extending these formal proofs to $N$-level hierarchies and exploring the empirical performance of these algorithms on physical multicore hardware.

Conclusion

This research provides the first formal framework for resource-oblivious parallel algorithms that accounts for false sharing. By combining HBP computations with a deterministic PWS scheduler, the authors demonstrate that it is possible to write parallel code that is both portable and highly efficient across varying multicore architectures.

Summary updated

BibTeX
@misc{cole2011efficient,
  author = {Richard Cole and Vijaya Ramachandran},
  title = {{Efficient Resource Oblivious Algorithms for Multicores}},
  year = {2011},
  eprint = {1103.4071},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1103.4071},
}
Figure