Efficient Parallel Functional Programming with Effects

被引:5
作者
Arora, Jatin [1 ]
Westrick, Sam [1 ]
Acar, Umut A. [1 ]
机构
[1] Carnegie Mellon Univ, Pittsburgh, PA 15213 USA
来源
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL | 2023年 / 7卷 / PLDI期
基金
美国国家科学基金会;
关键词
functional programming; memory management; parallel; concurrent; HIERARCHICAL MEMORY MANAGEMENT;
D O I
10.1145/3591284
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Although functional programming languages simplify writing safe parallel programs by helping programmers to avoid data races, they have traditionally delivered poor performance. Recent work improved performance by using a hierarchical memory architecture that allows processors to allocate and reclaim memory independently without any synchronization, solving thus the key performance challenge afflicting functional programs. The approach, however, restricts mutation, or memory effects, so as to ensure "disentanglement", a low-level memory property that guarantees independence between different heaps in the hierarchy. This paper proposes techniques for supporting entanglement and for allowing functional programs to use mutation at will. Our techniques manage entanglement by distinguishing between disentangled and entangled objects and shielding disentangled objects from the cost of entanglement management. We present a semantics that formalizes entanglement as a property at the granularity of memory objects, and define several cost metrics to reason about and bound the time and space cost of entanglement. We present an implementation of the techniques by extending the MPL compiler for Parallel ML. The extended compiler supports all features of the Parallel ML language, including unrestricted effects. Our experiments using a variety of benchmarks show that MPL incurs a small time and space overhead compared to sequential runs, scales well, and is competitive with languages such as C++, Go, Java, OCaml. These results show that our techniques can marry the safety benefits of functional programming with performance.
引用
收藏
页码:1558 / 1583
页数:26
相关论文
共 85 条
[1]   The data locality of work stealing [J].
Acar, UA ;
Blelloch, GE ;
Blumofe, RD .
THEORY OF COMPUTING SYSTEMS, 2002, 35 (03) :321-347
[2]  
Acar UA, 2018, PROCEEDINGS OF THE 39TH ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION, PLDI 2018, P769, DOI [10.1145/3192366.3192391, 10.1145/3296979.3192391]
[3]  
Acar UA, 2017, ACM SIGPLAN NOTICES, V52, P75, DOI [10.1145/3155284.3018762, 10.1145/3155284.3018762, 10.1145/3018743.3018762]
[4]   Dag-Calculus: A Calculus for Parallel Computation [J].
Acar, Umut A. ;
Chargueraud, Arthur ;
Rainey, Mike ;
Sieczkowski, Filip .
ACM SIGPLAN NOTICES, 2016, 51 (09) :18-32
[5]   Oracle-guided scheduling for controlling granularity in implicitly parallel languages [J].
Acar, Umut A. ;
Chargueraud, Arthur ;
Rainey, Mike .
JOURNAL OF FUNCTIONAL PROGRAMMING, 2016, 26
[6]   Technical Perspective Data Races are Evil with No Exceptions [J].
Adve, Sarita .
COMMUNICATIONS OF THE ACM, 2010, 53 (11) :84-84
[7]  
Alpern B., 1995, Proceedings 1995. Programming Models for Massively Parallel Computers (Cat. No.95TB8112), P10, DOI 10.1109/PMMPC.1995.504336
[8]   Poster: The Problem-Based Benchmark Suite PBBS), V2 [J].
Anderson, Daniel ;
Blelloch, Guy E. ;
Dhulipala, Laxman ;
Dobson, Magdalen ;
Sun, Yihan .
PPOPP'22: PROCEEDINGS OF THE 27TH ACM SIGPLAN SYMPOSIUM ON PRINCIPLES AND PRACTICE OF PARALLEL PROGRAMMING, 2022, :445-447
[9]  
[Anonymous], 2011, FIN PROT AGN RPC SYS
[10]  
[Anonymous], 2015, FOLL FAC OP SOURC LI