Skip to content

Commit c406ffa

Browse files
author
Afnan Attar
committed
first commit
0 parents  commit c406ffa

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# APReF: Automatic Parallelizer of REcursive Functions
2+
3+
This is a source-to-source Haskell compiler that automatically identifies and rewrites recursive functions in a parallel form.
4+
5+
Optimizations implemented:
6+
* Automatic parallelization
7+
* Constant folding
8+
* Reassociation of terms for commutative operations
9+
* Symbolic simplification of scan operations
10+
11+
### References
12+
13+
[**Automatic Parallelization of Recursive Functions with Rewriting Rules**](https://doi.org/10.1016/j.scico.2018.01.004)
14+
Rodrigo C. O. Rocha, Luís F. W. Góes, Fernando M. Q. Pereira
15+
Journal of Science of Computer Programming, 2018
16+
17+
[An Algebraic Framework for Parallelizing Recurrence in Functional Programming](http://dx.doi.org/10.1007/978-3-319-45279-1_10)
18+
Rodrigo C. O. Rocha, Luís F. W. Góes, Fernando M. Q. Pereira
19+
SBLP 2016 - Brazilian Symposium on Programming Languages
20+
21+
22+
### Example
23+
24+
Given the following sequential recursive function:
25+
```
26+
f :: Integer -> [Integer]
27+
f 0 = []
28+
f n = [n] ++ f(n-1) ++ [n]
29+
```
30+
the source-to-source compiler is able to rewrite it as in the following parallel version:
31+
```
32+
f_g_1 :: Integer -> [Integer]
33+
f_g_1 i = [i]
34+
f_g_2 :: Integer -> [Integer]
35+
f_g_2 i = [i]
36+
f :: Integer -> [Integer]
37+
f 0 = []
38+
f n = let k = n
39+
in (parFoldr (++) (map f_g_1 (reverse [1..k]))) ++ [] ++
40+
(parFoldr (++) (map f_g_2 [1..k]))
41+
```
42+
43+
### Usage
44+
45+
By passing a Haskell file to the source-to-source compiler,
46+
any parallelizable function will be rewritten in their parallel counterparts.
47+
Auxiliary packages and functions will also be added.
48+
49+
```
50+
python apref.py -f <haskell-file> --scan --constfold
51+
```
52+
53+
The flag '--scan' enables a scan-based optimization.
54+
Similarly, the '--constfold' enables a constant folding optimization.
55+
56+
"# APReF-using-python3"

0 commit comments

Comments
 (0)