OpenCilk: A Modular and Extensible Software Infrastructure for Fast Task-Parallel Code
This paper presents OpenCilk, an open-source software infrastructure for task-parallel programming that allows for substantial code reuse and easy exploration of design choices in language abstraction, compilation strategy, runtime mechanism, and productivity-tool development.
The OpenCilk infrastructure consists of three main components: a compiler designed to compile fork-join task-parallel code, an efficient work-stealing runtime scheduler, and a productivity-tool development framework based on compiler instrumentation designed for fork-join parallel computations. OpenCilk is \emph{modular} — modifying one component for the most part does not necessitate modifications to the other components — and \emph{easy to extend} — its construction naturally encourages code reuse. Despite being modular and easy to extend, OpenCilk produces \emph{high-performing} code.
We investigated OpenCilk’s modularity and extensibility through several case studies, including a study to extend OpenCilk to support multiple runtime systems, including Cilk Plus, OpenMP, and oneTBB. OpenCilk’s design enables quick prototyping of new compiler back ends to target different parallel-runtime ABIs. Each back end required fewer than 2000 new lines of code. To demonstrate OpenCilk’s performance, we empirically evaluated the OpenCilk runtime and found that, on 15 benchmark Cilk programs, it outperforms the other runtimes by a geometric mean of $4%$–$26%$ on 1 core and $10%$–$120%$ on 48 cores.