Skip to content

Commit 600fd02

Browse files
authored
Merge pull request #465 from herbie-fp/release-1.6
Release 1.6
2 parents 8dbedf3 + 6142850 commit 600fd02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2309
-9
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
# Builds output under /herbie/egg-herbie
77
FROM rust:1.61.0 as egg-herbie-builder
88
WORKDIR /herbie
9-
COPY . .
9+
COPY egg-herbie egg-herbie
1010
RUN cargo build --release --manifest-path=egg-herbie/Cargo.toml
1111

1212
# Production image
1313
FROM racket/racket:8.5-full AS production
1414
MAINTAINER Pavel Panchekha <[email protected]>
1515
COPY --from=egg-herbie-builder /herbie/egg-herbie /src/egg-herbie
1616
RUN raco pkg install /src/egg-herbie
17-
ADD src /src/herbie
17+
COPY src /src/herbie
1818
RUN raco pkg install --auto /src/herbie
1919
ENTRYPOINT ["racket", "/src/herbie/herbie.rkt"]
2020
EXPOSE 80

egg-herbie/info.rkt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#lang info
22

33
(define collection "egg-herbie")
4-
(define version "1.5")
4+
(define version "1.6")
55

66
(define pkg-desc "Racket bindings for simplifying math expressions using egg")
7-
87
(define pkg-authors
98
`("Oliver Flatt"))
9+
10+
(define build-deps
11+
'("rackunit-lib"))

src/config.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
(if (equal? out "") default out))
109109
default))
110110

111-
(define *herbie-version* "1.5")
111+
(define *herbie-version* "1.6")
112112

113113
(define *hostname* (run-command "hostname"))
114114

src/info.rkt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#lang info
22

33
(define collection "herbie")
4-
(define version "1.5")
4+
(define version "1.6")
55

66
;; Packaging information
77

@@ -23,13 +23,14 @@
2323
;; Dependencies
2424

2525
(define deps
26-
'(("base" #:version "7.0")
26+
'(("base" #:version "8.0")
2727
"math-lib"
2828
"plot-lib"
2929
"profile-lib"
3030
"rackunit-lib"
3131
"web-server-lib"
32-
("egg-herbie" #:version "1.5")
32+
"draw-lib"
33+
("egg-herbie" #:version "1.6")
3334
("rival" #:version "1.4")
3435
("fpbench" #:version "2.0.3")))
3536

src/syntax/read.rkt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,15 @@
113113
(unless (set=? vars used)
114114
(define unused (set-subtract vars used))
115115
(warn 'unused-variable
116+
#:url "faq.html#unused-variable"
116117
"unused ~a ~a" (if (equal? (set-count unused) 1) "variable" "variables")
117118
(string-join (map ~a unused) ", "))))
118119

119120
(define (check-weird-variables vars)
120121
(for* ([var vars] [const (all-constants)])
121122
(when (string-ci=? (symbol->string var) (symbol->string const))
122123
(warn 'strange-variable
124+
#:url "faq.html#strange-variable"
123125
"unusual variable ~a; did you mean ~a?" var const))))
124126

125127
(define (our-read-syntax port name)

www/doc/1.6/faq.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ <h3 id="unsound-rules">Unsound rule application detected</h3>
111111
failed to simplify the output.
112112
</p>
113113

114+
<h3 id="unused-variable">Unused variable <var>var</var></h3>
115+
116+
<p>
117+
The input FPCore contains a variable that is not
118+
used in the body expression.
119+
</p>
120+
121+
<h3 id="strange-variable">Strange variable <var>var</var></h3>
122+
123+
<p>
124+
The input expression contains a variable that is similar in name
125+
to named constants, e.g. <var>e</var> instead of <var>E</var>.
126+
</p>
114127

115128
<h2>Known bugs</h2>
116129

www/doc/1.7/diagrams.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Diagrams</title>
6+
<link rel='stylesheet' type='text/css' href="../../main.css">
7+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
8+
<meta name="viewport" content="width=device-width, initial-scale=1" />
9+
</head>
10+
<body>
11+
<header>
12+
<a href="../.."><img class="logo" src="../../logo.png" /></a>
13+
<h1>Diagrams</h1>
14+
</header>
15+
16+
<figure>
17+
<img width="100%" src="system-1.6.png" alt="System diagram of Herbie" />
18+
</figure>
19+
20+
<p>
21+
High-level system diagram of Herbie. It highlights Herbie's core architecture,
22+
external libraries, and user interactions.
23+
Basic flow: Herbie passes user input (expression, precondition, etc.) to the
24+
mainloop (scheduler) which alternates between generate and test phases multiple times,
25+
maintaining and improving a set of accurate expressions at each iteration.
26+
Once the generate-and-test phase is complete, Herbie extracts either
27+
one or many output expressions using an algorithm called regime inference.
28+
Regime inference chooses the "best" (usually most accurate)
29+
generated candidate expression or combines multple candidates,
30+
each "best" on a smaller part of the input range, with a branch condition.
31+
</p>
32+
33+
</body>
34+
</html>

www/doc/1.7/docker.html

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Herbie on Docker</title>
6+
<link rel='stylesheet' type='text/css' href='../../main.css'>
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<script type="text/javascript" src="toc.js"></script>
9+
</head>
10+
<body>
11+
<header>
12+
<a href="../.."><img class="logo" src="../../logo.png" /></a>
13+
<h1>Installing with Docker</h1>
14+
</header>
15+
16+
<p>
17+
<a href="../../">Herbie</a> is available
18+
through <a href="https://www.docker.com/">Docker</a>, which is
19+
sort of like a virtual machine. This page describes how to install
20+
the <a href="https://hub.docker.com/r/uwplse/herbie">official Docker
21+
image</a> for Herbie.
22+
</p>
23+
24+
<p>
25+
Herbie can also be <a href="installing.html">installed from
26+
package or source</a>. Herbie via Docker is only recommended if
27+
you already have Docker experience.
28+
</p>
29+
30+
<h2>Installing Herbie via Docker</h2>
31+
32+
<p>
33+
First, <a href="https://docs.docker.com/installation/">install
34+
Docker</a>. Docker supports Windows, macOS, and Linux. Depending
35+
on how you install Docker, you may need to prefix
36+
the <code>docker</code> commands with <code>sudo</code> or run them
37+
as the administrative user.
38+
</p>
39+
40+
<p>With Docker installed, you can run the <a href="using-cli.html">Herbie shell</a> with:</p>
41+
42+
<pre>docker run -it uwplse/herbie shell</pre>
43+
44+
<p>This will read input from the standard input.</p>
45+
46+
<p>Note that Herbie in Docker is more limited; for example, it will
47+
not recognize plugins installed outside the Docker container.</p>
48+
49+
<h2>Running the web interface</h2>
50+
51+
<p>
52+
You can run the Herbie web server locally with
53+
54+
<pre class="shell">docker run -it --rm -p 8000:80 uwplse/herbie</pre>
55+
56+
and access the server at <a href="http://localhost:8000">http://localhost:8000</a>.
57+
</p>
58+
<p>
59+
(Herbie's Docker image binds to port 80 by
60+
default; this command uses the <code>-p &lt;hostport&gt;:80</code> option to expose Herbie on port 8000.)
61+
</p>
62+
63+
<p>
64+
If you are using the <code>--log</code>
65+
or <code>--save-session</code> flags for the web shell,
66+
you will also need to mount the relevant directories into the
67+
Docker container using the <code>-v</code> Docker option, as in
68+
the examples below.
69+
</p>
70+
71+
<h2>Generating files and reports</h2>
72+
73+
<p>
74+
To use Herbie in <a href="using-cli.html">batch mode</a>, you will
75+
need to mount the input in the Docker container. Do that with:
76+
</p>
77+
78+
<pre class="shell">docker run -it --rm \
79+
-v <var>in-dir</var>:/in \
80+
-v <var>out-dir</var>:/out \
81+
-u $USER \
82+
uwplse/herbie improve /in/<var>in-file</var> /out/<var>out-file</var></pre>
83+
84+
<p>
85+
In this command, you are asking Herbie to read input
86+
from <var>in-file</var> in <var>in-dir</var>, and write output
87+
to <var>out-file</var> in <var>out-dir</var>. The command looks
88+
the same if you want Herbie to read input from a directory;
89+
just leave <var>in-file</var> blank.
90+
</p>
91+
92+
<p>
93+
To generate reports from Herbie, you can run:
94+
</p>
95+
96+
<pre class="shell">docker run -it --rm \
97+
-v <var>in-dir</var>:/in \
98+
-v <var>out-dir</var>:/out \
99+
-u $USER \
100+
uwplse/herbie report /in/<var>in-file</var> /out/</pre>
101+
102+
<p>
103+
As before, the input and output directories must be mounted inside
104+
the Docker container. Note that both here and above, the user is
105+
set to the current user. This is to ensure that the files Herbie creates
106+
have the correct permissions set.
107+
</p>
108+
109+
<h2>For developers: updating the Docker image + Dockerfile</h2>
110+
111+
<p>
112+
For building and testing, first clone the repo and confirm that Herbie builds correctly with <code>make install</code>.
113+
</p>
114+
<p>
115+
Next, examine the Dockerfile and Makefile together. The Dockerfile should follow a process exactly like the Makefile, except a clean initial environment is assumed. The build may be split into 2 or more stages to limit the size of the resulting image. Each stage consists of a <code>FROM</code> command and a series of further commands to build up the desired environment, and later stages can refer to earlier stages by name--for example, <code>COPY --from=earlier-stage ...</code> can copy files compiled in earlier images. You may need to do things like bumping the version of Rust used for binary compilation or the version of Racket used in production, or adjusting paths to match the newest version of the repo.
116+
</p>
117+
<p>
118+
Once you are ready to build:
119+
<pre class="shell">docker build -t herbie-testbuild .</pre>
120+
from the repo's main directory will build a new test image with the tag <code>herbie-testbuild</code>. You can run this image with
121+
<pre class="shell">docker run -p 8000:80 -it herbie-testbuild</pre>
122+
and see the web demo in the host machine's browser at <code>http://localhost:8000</code>.
123+
</p>
124+
125+
<p>
126+
To open a shell in a running container for testing, first get the container ID with
127+
<pre class="shell">docker ps</pre>
128+
and then open a shell in the container as root with
129+
<pre class="shell">docker exec -it &lt;CONTAINER ID&gt; sh</pre>
130+
131+
The code and egg-herbie binaries should be under <code>/src</code>.
132+
</p>
133+
134+
</body>
135+
</html>
762 KB
Loading

0 commit comments

Comments
 (0)