|
1 |
| -This is the documentation for the Peggy equality saturation engine and |
2 |
| -compiler. Below you will find some answers to simple questions about |
3 |
| -how to install and use Peggy. |
| 1 | +This repository runs the [peggy](https://goto.ucsd.edu/~mstepp/peggy/) equality saturation engine and compiler on several example files. Its purpose is to compare peggy's optimizations to [eggcc](https://github.com/egraphs-good/eggcc), another optimizing compiler using equality saturation, on similar example files. |
4 | 2 |
|
5 |
| -# 0. Install Java 6. |
| 3 | +For the original peggy project, please refer to the [peggy documentation](https://goto.ucsd.edu/~mstepp/peggy/). This is not the original peggy project. |
6 | 4 |
|
7 | 5 |
|
8 |
| -## Windows |
9 |
| -- Install from [Oracle Java archives](https://www.oracle.com/java/technologies/javase-java-archive-javase6-downloads.html) |
10 |
| -(requires signup). |
| 6 | +# Dockerfile Setup |
| 7 | +The Dockerfile will clone this repository and install several dependencies. |
11 | 8 |
|
12 |
| -## Linux |
13 |
| -? |
| 9 | +First, build the image: |
14 | 10 |
|
15 |
| -## Mac |
16 |
| -Use a container. |
17 | 11 | ```
|
18 |
| -docker pull ubuntu:14.04.2 |
| 12 | +docker build -t peggy . |
19 | 13 | ```
|
20 | 14 |
|
21 |
| -Create a container: |
| 15 | +Now run the image. |
22 | 16 | ```
|
23 |
| -docker run -d -v /local/path/to/peggy_1.0:/container/path/to/peggy_1.0 -w /container/path/to/peggy_1.0 --name peggy -i -t ubuntu:14.04.2 /bin/bash |
| 17 | +docker run -it peggy |
24 | 18 | ```
|
25 |
| - |
26 |
| -Within the container: |
27 |
| -``` |
28 |
| -apt-get install openjdk-6-jdk |
29 |
| -``` |
30 |
| - |
31 |
| -# 1. Installation. |
32 |
| - |
33 |
| -No installation is necessary. If you have the peggy_1.0.jar file, then |
34 |
| -you have a working copy of Peggy and all of the libraries it depends |
35 |
| -upon (from the lib/ folder). |
36 |
| - |
37 |
| - |
38 |
| -# 2. Compilation. |
39 |
| - |
40 |
| -If you wish to compile Peggy from source, you will find all the source |
41 |
| -code in the src/ folder. We use the Eclipse 3.1+ IDE to build Peggy. |
42 |
| -In Eclipse, you will need to create a new Java Project, and then add |
43 |
| -the code in the src/ folder to the project. You can do this either by |
44 |
| -copying it into the src/ folder that Eclipse creates for your new |
45 |
| -project, or by telling it to add the existing src/ folder to your |
46 |
| -project's source path. Once you have built a project and added the |
47 |
| -Peggy source code, you must add all the jars in the lib/ folder to the |
48 |
| -project's build path. Then you can refresh the project and it should |
49 |
| -compile correctly. |
50 |
| - |
51 |
| - |
52 |
| -# 3. Setup. |
53 |
| - |
54 |
| -The only setup required for Peggy is specifying the paths to a few |
55 |
| -external tools that it relies on. The optimizers need to know the path |
56 |
| -to the Pueblo, Minisat or GLPK solver program, depending on which you |
57 |
| -want to use. You can specify this on the command line with the |
58 |
| -'-minisatPath', '-puebloPath', or '-glpkPath' options. If no path is |
59 |
| -specified explicitly, the path is assumed to be |
60 |
| -$COLLIDER_ROOT/scripts/minisat/Minisat (for minisat), |
61 |
| -$COLLIDER_ROOT/scripts/pueblo/Pueblo (for Pueblo), or |
62 |
| -/usr/bin/glpsol (for GLPK). If not using minisat, you must specify which |
63 |
| -solver to use by passing `minisat`, `pueblo`, or `glpk` to the `-pb` option |
64 |
| -on the command line. |
65 |
| - |
66 |
| -The optimizers also generate some temporary files, and you may specify |
67 |
| -which folder these files are created in with the option |
68 |
| -'-tmpFolder <folder>'. The default is /tmp/. |
69 |
| - |
70 |
| - |
71 |
| -# 4. Usage. |
72 |
| - |
73 |
| -We have provided bash scripts to run the appropriate command-line |
74 |
| -class for each optimizer/translation validator for Java/LLVM. For any |
75 |
| -one of these scripts, you may call it without parameters to see a |
76 |
| -description of the command-line parameters it accepts. |
77 |
| - |
78 |
| - |
79 |
| -# 5. Quick start: Optimizing. |
80 |
| - |
81 |
| -Here's a basic example of how to optimize a Java class with Peggy. |
82 |
| -First, make a basic java file `Foo.java` and compile it using |
83 |
| -`javac Foo.java` to get the class `Foo.class`. |
84 |
| -Suppose we want to optimize a class "Foo.class", which is in the |
85 |
| -current folder. |
86 |
| - |
87 |
| -Step 1) Pick some axioms to use. There are several axiom files |
88 |
| -provided in the axioms/ folder, or you can write your own. To use a |
89 |
| -given axiom file in Peggy, simply pass the "-axioms myfile.xml" |
90 |
| -argument. To provide multiple files, you may either have multiple |
91 |
| -"-axioms myfile.xml" pairs, or you may provide several files in one go |
92 |
| -with "-axioms myfile1.xml:myfile2.xml:myfile3.xml". |
93 |
| - |
94 |
| -Step 2) To optimize Java programs, the classes you wish to optimize |
95 |
| -must be on the classpath. In the opt_java.sh script, the current path |
96 |
| -(.) is included on the classpath. We specify that we want to optimize |
97 |
| -Foo by adding '-O2 Foo' as a parameter to the script. This tells the |
98 |
| -optimizer that we want to optimize at level 2 (full optimization). |
99 |
| - |
100 |
| -Step 3) If you wish to see what axioms are applied during saturation, |
101 |
| -add the '-displayAxioms' parameter. |
102 |
| - |
103 |
| -Step 4) Run the script with the parameters we have determined above. |
104 |
| -The optimized classes will be placed in the newly-created 'optimized/' |
105 |
| -folder. (you may change the output folder with the '-o <folder>' |
106 |
| -option. |
107 |
| - |
108 |
| - |
109 |
| - |
110 |
| - |
111 |
| -If you have any questions/comments, please direct them to [email protected]. |
0 commit comments