Skip to content

Commit 4fd946c

Browse files
authored
Merge pull request #1 from egraphs-good/update-readme-docker
Add Dockerfile and update README
2 parents e75638e + e61c64a commit 4fd946c

File tree

2 files changed

+27
-101
lines changed

2 files changed

+27
-101
lines changed

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# We need old ubuntu so that the package manager includes Java 6.
2+
FROM ubuntu:14.04.2
3+
4+
# Install dependencies: Java 6, build essential (to build glpk), wget (to download jd-cli)
5+
RUN apt-get update && \
6+
apt-get -y install openjdk-6-jdk build-essential wget
7+
8+
# Download the repository
9+
# FIXME: we need to make the repo public for this to work
10+
# RUN git clone [email protected]:egraphs-good/peggy-comparison.git
11+
12+
# # Install GLPK. We just need the glpsol executable.
13+
# RUN wget "https://ftp.gnu.org/gnu/glpk/glpk-5.0.tar.gz" && \
14+
# unzip glpk-5.0.tar.gz && cd glpk-5.0 && \
15+
# ./configure && make install && \
16+
# mv examples/glpsol /usr/bin/glpsol && cd glpk-5.0 && rm -rf glpk-5.0
17+
18+
# # Install jd-cli for command line decompiling. We need an old version to work with Java 6.
19+
# RUN wget "https://github.com/intoolswetrust/jd-cli/releases/download/jd-cmd-0.9.2.Final/jd-cli-0.9.2-dist.tar.gz" && tar -xzvf jd-cli-0.9.2-dist.tar.gz

README.md

Lines changed: 8 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,18 @@
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.
42

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.
64

75

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.
118

12-
## Linux
13-
?
9+
First, build the image:
1410

15-
## Mac
16-
Use a container.
1711
```
18-
docker pull ubuntu:14.04.2
12+
docker build -t peggy .
1913
```
2014

21-
Create a container:
15+
Now run the image.
2216
```
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
2418
```
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

Comments
 (0)