Title
Automatic parallelization of recursive functions with rewriting rules
Abstract
Functional programming languages, since their early days, have been regarded as the holy grail of parallelism. And, in fact, the absence of race conditions, coupled with algorithmic skeletons such as map and reduce, have given developers the opportunity to write many different techniques aimed at the automatic parallelization of programs. However, there are many functional programs that are still difficult to parallelize. This difficulty stems from many factors, including the complex syntax of recursive functions. This paper provides new equipment to deal with this problem. Such instrument consists of an insight, plus a code transformation that is enabled by this insight. Concerning the first contribution, we demonstrate that many recursive functions can be rewritten as a combination of associative operations. We group such functions into two categories, which involve monoid and semiring operations. Each of these categories admits a parallel implementation. To demonstrate the effectiveness of this idea, we have implemented an automatic code rewriting tool for Haskell, and have used it to convert six well-known recursive functions to algorithms that run in parallel. Our tool is totally automatic, and it is able to deliver non-trivial speedups upon the sequential version of the programs that it receives. In particular, the automatically generated parallel code delivers good scalability when varying the number of threads or the input size.
Year
DOI
Venue
2019
10.1016/j.scico.2018.01.004
Science of Computer Programming
Keywords
Field
DocType
Recursive functions,Parallel computing,Functional programming,Algebraic framework,Abstract algebra
Programming language,Functional programming,Computer science,Algorithmic skeleton,Theoretical computer science,Rewriting,Haskell,Code (cryptography),Scalability,Semiring,Automatic parallelization
Journal
Volume
ISSN
Citations 
173
0167-6423
0
PageRank 
References 
Authors
0.34
26
3