Automatic parallelization of recursive functions with rewriting rules
Autor: | Fernando Magno Quintão Pereira, Luís F. W. Góes, Rodrigo C. O. Rocha |
---|---|
Rok vydání: | 2019 |
Předmět: |
Functional programming
Syntax (programming languages) Programming language Computer science 020207 software engineering 02 engineering and technology computer.software_genre Semiring Automatic parallelization 020204 information systems Scalability 0202 electrical engineering electronic engineering information engineering Haskell Rewriting Algorithmic skeleton computer Software computer.programming_language |
Zdroj: | Science of Computer Programming. 173:128-152 |
ISSN: | 0167-6423 |
DOI: | 10.1016/j.scico.2018.01.004 |
Popis: | 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. |
Databáze: | OpenAIRE |
Externí odkaz: |