Skip to content

Commit 7c32f81

Browse files
authored
Merge pull request #166 from uwplse/develop
Release Herbie 1.1
2 parents ac06a5d + dac56f3 commit 7c32f81

File tree

179 files changed

+5983
-7060
lines changed

Some content is hidden

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

179 files changed

+5983
-7060
lines changed

.travis.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,29 @@ env:
1515
HERBIE_SEED="#(2749829514 1059579101 312104142 915324965 966790849 1349306526)"
1616
- RACKET_VERSION="6.5"
1717
HERBIE_SEED="#(2749829514 1059579101 312104142 915324965 966790849 1349306526)"
18-
- RACKET_VERSION="6.5"
18+
- RACKET_VERSION="6.6"
19+
HERBIE_SEED="#(2749829514 1059579101 312104142 915324965 966790849 1349306526)"
20+
- RACKET_VERSION="6.7"
21+
HERBIE_SEED="#(2749829514 1059579101 312104142 915324965 966790849 1349306526)"
22+
- RACKET_VERSION="6.7"
1923
HERBIE_SEED="#f"
2024
matrix:
2125
allow_failures:
22-
- env: RACKET_VERSION="6.5"
26+
- env: RACKET_VERSION="6.7"
2327
HERBIE_SEED="#f"
2428
before_install:
2529
- git clone https://github.com/greghendershott/travis-racket.git ../travis-racket
2630
- cat ../travis-racket/install-racket.sh | bash
2731
- export PATH="${RACKET_DIR}/bin:${PATH}"
28-
- docker load -i docker-images/herbie.image || true
32+
# - docker load -i docker-images/herbie.image || true
2933
install:
3034
- raco pkg install --auto $TRAVIS_BUILD_DIR/src
31-
- docker build -t herbie .
35+
# - docker build -t herbie .
3236
script:
3337
- raco test src
3438
- racket $TRAVIS_BUILD_DIR/infra/travis.rkt --seed "${HERBIE_SEED}" bench/tutorial.fpcore bench/hamming/
35-
before_cache:
36-
- docker save -o docker-images/herbie.image herbie
39+
#before_cache:
40+
# - docker save -o docker-images/herbie.image herbie
3741
notifications:
3842
slack:
3943
secure: QB8ib/gxZWZ8rY9H54BktIgx8LfjdqabSAkmWip0VHlUhrh2ULG566XgmB5h75eNzCil2cw76ma5wfSC0MNIQ1iDHKCxAgTE0+gcPcZAYGfucQ28sKGBG2wcuJfvBLG6lVDxj+luGUh3XohouTLYI9cg509JBgTgpcrXVexYAaE=

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM jackfirth/racket
1+
FROM jackfirth/racket:6.8
22
MAINTAINER Pavel Panchekha <[email protected]>
33
RUN apt-get update \
44
&& apt-get install -y libcairo2-dev libjpeg62 libpango1.0-dev \
55
&& rm -rf /var/lib/apt/lists/*
66
ADD src /src/herbie
77
RUN raco pkg install --auto /src/herbie
8-
ENTRYPOINT ["raco", "herbie"]
8+
ENTRYPOINT ["racket", "/src/herbie/herbie.rkt"]

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22

33
all:
44
@echo "Type 'make install' to install Herbie as a Racket package,"
5-
@echo "just run 'racket src/herbie.rkt' to run Herbie."
5+
@echo "Run 'racket src/herbie.rkt shell' to run Herbie."
66

77
install:
8-
raco pkg install --auto $TRAVIS_BUILD_DIR/src
8+
raco pkg install --name herbie src/
9+
10+
update:
11+
raco pkg update --name herbie src/
12+
13+
herbie.zip herbie.zip.CHECKSUM:
14+
raco pkg create src/
15+
mv src.zip herbie.zip
16+
mv src.zip.CHECKSUM herbie.zip.CHECKSUM
917

1018
clean:
1119
rm -f cost
@@ -16,7 +24,10 @@ publish:
1624
bash infra/publish.sh index
1725

1826
start-server:
19-
racket src/web/demo.rkt >> infra/server.log
27+
racket src/herbie.rkt web --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' --timeout 60 --demo --prefix /demo/ --port 4053 --save-session www/demo/ --log infra/server.log --quiet 2>&1
28+
29+
package:
30+
raco pkg
2031

2132
loc:
2233
find herbie/ -type f -exec cat {} \; | wc -l

README.md

Lines changed: 56 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,113 +2,107 @@
22

33
Herbie synthesizes floating-point programs from real-number programs,
44
automatically handling simple numerical instabilities.
5+
Visit [our website](https://herbie.uwplse.org) for tutorials,
6+
documentation, and an online demo.
57

68
Current Status
79
--------------
810

911
[![Build Status](https://travis-ci.org/uwplse/herbie.svg?branch=master)](https://travis-ci.org/uwplse/herbie)
1012

11-
Herbie can improve the accuracy of many real-world programs,
12-
and is used by scientists in many disciplines.
13-
It has lead to two patches
14-
(for complex [square roots](https://github.com/josdejong/mathjs/pull/208)
15-
and [trigonometric functions](https://github.com/josdejong/mathjs/pull/247)),
13+
Herbie can improve the accuracy of many real-world programs, and is
14+
used by scientists in many disciplines. It has lead to two patches
15+
(for
16+
complex [square roots](https://github.com/josdejong/mathjs/pull/208)
17+
and
18+
[trigonometric functions](https://github.com/josdejong/mathjs/pull/247)),
1619
in [math.js](http://mathjs.org/) an open-source mathematics library.
20+
Herbie has semi-regular releases twice a year, maintains backwards
21+
compatibility, and uses standardized formats.
1722

1823
Helping Out
1924
-----------
2025

21-
Herbie is organized on
22-
[Github](https://github.com/uwplse/herbie) and
23-
[Trello](https://trello.com/b/lh7b33Dr/herbie).
24-
We also have a
26+
Herbie development is organized on our
2527
[mailing list](https://mailman.cs.washington.edu/mailman/listinfo/herbie)
26-
where we discuss Herbie's development and announce major improvements.
27-
Our test results are on
28-
[uwplse.org](http://herbie.uwplse.org/reports/).
28+
where we discuss work in progress and announce major improvements.
29+
[Email us](mailto:[email protected]) to get involved!
2930

30-
Email [Zach Tatlock](mailto:[email protected]) to get involved.
31-
He’ll set you up with access to these tools.
31+
We use [Github](https://github.com/uwplse/herbie)
32+
and [Trello](https://trello.com/b/lh7b33Dr/herbie) to organize some
33+
development goals Our test results
34+
are [archived](http://herbie.uwplse.org/reports/).
3235

3336
Installing
3437
----------
3538

36-
Herbie requires Racket 6.3 or later, and works best on Linux.
39+
For full details on installing Herbie, please see the
40+
[tutorial](http://herbie.uwplse.org/doc/latest/installing-herbie.html).
3741

38-
No installation is needed; just download the source code and you're
39-
ready to go.
42+
Herbie requires Racket 6.3 or later, and supports Linux and OS X.
43+
Install it with:
4044

41-
Upgrading
42-
---------
45+
raco pkg install herbie
4346

44-
Herbie 1.0 differs from previous versions by having a new input
45-
format. Herbie now uses the FPCore standard for floating point tools.
46-
To convert existing files to the new format, use:
47-
48-
racket infra/convert.rkt [file].rkt > [file].fpcore
47+
This will install a `herbie` binary to somewhere in your home
48+
directory. You can also run `src/herbie.rkt` directly instead of using
49+
the `herbie` command, for example if you'd like to download the source
50+
directly instead of through the package manager.
4951

5052
Running Herbie
5153
--------------
5254

53-
For details on how to run Herbie, please see the
54-
[tutorial](http://herbie.uwplse.org/doc/latest/using-herbie.html).
55+
For full details on running Herbie, please see the
56+
[tutorial](http://herbie.uwplse.org/doc/latest/using-web.html).
5557

56-
The format of input files is a Scheme-based language;
57-
you can find several examples in `bench/`.
58-
For example, consider this simple cancellation test
58+
Herbie's input is a Scheme-based language called [FPCore](http://fpbench.org/spec/fpcore-1.0.html);
59+
you can several examples in `bench/`.
60+
For example, consider this simple expression:
5961

6062
(FPCore (x)
6163
(- (+ 1 x) x))
6264

63-
Run Herbie from the top-level directory of the repo:
65+
Run Herbie from the top-level directory of the repo, and enter the
66+
cancellation test:
6467

65-
$ racket src/herbie.rkt
68+
$ herbie shell
6669
Seed: #(1046809171 2544984934 1871826185 4237421819 4093186437 162666889)
70+
herbie> (FPCore (x) (- (+ 1 x) x))
71+
(FPCore (x) 1)
6772

68-
You can now enter the cancellation test:
69-
70-
$ racket src/herbie.rkt
71-
Seed: #(1046809171 2544984934 1871826185 4237421819 4093186437 162666889)
72-
(FPCore (x)
73-
(- (+ 1 x) x))
74-
[ 1673.401ms] (29→ 0) Cancel like terms
75-
(λ (x) 1)
76-
77-
The final is Herbie's improved, more-accurate expression, in this case
73+
The output is Herbie's improved, more-accurate expression, in this case
7874
the constant `1`.
7975

80-
You can also save expressions to a file and run them with
81-
82-
racket src/herbie.rkt [file]
76+
Besides the `shell`, Herbie also has a `web` interface, and can run on
77+
files of FPCore expressions with the `improve` and `report` commands.
78+
Consult the
79+
[documentation](http://herbie.uwplse.org/doc/latest/options.html).
80+
for more.
8381

8482
Running Tests
8583
-------------
8684

87-
Herbie draws its test suite from open source projects, examples emailed
88-
to the developers, and from numerical analysis textbooks. Whenever
89-
possible, we try to *extract all possible tests* from a source, to
90-
avoid biasing our selection of tests. To run the tests, go to the
91-
project root and run
85+
Herbie contains unit tests to test basic functionality, though
86+
coverage is far from complete. You can run the test suite with:
9287

93-
racket infra/travis.rkt [file]
88+
raco test src/
9489

95-
Herbie's main tests are integration tests that test Herbie end-to-end.
96-
They are the benchmarks that ship in the `bench/` directory.
90+
Herbie also contains a large integration suite from open source
91+
projects, examples emailed to the developers, and from numerical
92+
analysis textbooks. This suite is found in `bench/`. The full test can
93+
be run with
9794

98-
We often test Herbie on basic but representative examples with:
95+
herbie report bench/
9996

100-
racket infra/travis.rkt bench/hamming/
97+
This full test can take several hours to run. We often test Herbie on
98+
basic but representative examples with:
10199

102-
This takes approximately 15 minutes.
103-
To run all of the default benchmarks, use:
100+
herbie report bench/hamming/
104101

105-
racket infra/travis.rkt bench/
106-
107-
This can take a few hours or more.
102+
This takes approximately 15 minutes.
108103

109104
Test results are collected on
110-
[uwplse.org](http://herbie.uwplse.org/reports/).
111-
If you have an account on this server, you can publish your test
112-
report with
105+
[uwplse.org](http://herbie.uwplse.org/reports/). If you have an
106+
account on this server, you can publish your test results with
113107

114108
make publish
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
(FPCore
2-
(a x)
3-
:name
4-
"NMSE section 3.5"
1+
; -*- mode: scheme -*-
2+
3+
(FPCore (a x)
4+
:name "expax (section 3.5)"
55
:target
66
(if (< (fabs (* a x)) 1/10)
77
(* (* a x) (+ 1 (+ (/ (* a x) 2) (/ (sqr (* a x)) 6))))
88
(- (exp (* a x)) 1))
9+
910
(- (exp (* a x)) 1))

bench/hamming/machine-decide.rkt

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
(FPCore
2-
(x)
3-
:name
4-
"NMSE section 3.11"
1+
; -*- mode: scheme -*-
2+
3+
(FPCore (x)
4+
:name "expq2 (section 3.11)"
55
:target
66
(/ 1 (- 1 (exp (- x))))
7+
78
(/ (exp x) (- (exp x) 1)))

bench/hamming/overflow-underflow.rkt

Lines changed: 0 additions & 6 deletions
This file was deleted.

bench/hamming/quadratic.fpcore

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
(FPCore
2-
(a b c)
3-
:name
4-
"NMSE p42, positive"
1+
; -*- mode: scheme -*-
2+
3+
(FPCore (a b c)
4+
:name "quadp (p42, positive)"
55
:target
6-
(let ((d (sqrt (- (sqr b) (* 4 (* a c))))))
7-
(let ((r1 (/ (+ (- b) d) (* 2 a))))
8-
(let ((r2 (/ (- (- b) d) (* 2 a)))) (if (< b 0) r1 (/ c (* a r2))))))
9-
(let ((d (sqrt (- (sqr b) (* 4 (* a c)))))) (/ (+ (- b) d) (* 2 a))))
10-
(FPCore
11-
(a b c)
12-
:name
13-
"NMSE p42, negative"
6+
(let ([d (sqrt (- (sqr b) (* 4 (* a c))))])
7+
(let ([r1 (/ (+ (- b) d) (* 2 a))]
8+
[r2 (/ (- (- b) d) (* 2 a))])
9+
(if (< b 0) r1 (/ c (* a r2)))))
10+
11+
(let ([d (sqrt (- (sqr b) (* 4 (* a c))))])
12+
(/ (+ (- b) d) (* 2 a))))
13+
14+
(FPCore (a b c)
15+
:name "quadm (p42, negative)"
1416
:target
1517
(let ((d (sqrt (- (sqr b) (* 4 (* a c))))))
16-
(let ((r1 (/ (+ (- b) d) (* 2 a))))
17-
(let ((r2 (/ (- (- b) d) (* 2 a)))) (if (< b 0) (/ c (* a r1)) r2))))
18-
(let ((d (sqrt (- (sqr b) (* 4 (* a c)))))) (/ (- (- b) d) (* 2 a))))
19-
(FPCore
20-
(a b/2 c)
21-
:name
22-
"NMSE problem 3.2.1, negative"
23-
(let ((d (sqrt (- (sqr b/2) (* a c))))) (/ (- (- b/2) d) a)))
24-
(FPCore
25-
(a b/2 c)
26-
:name
27-
"NMSE problem 3.2.1, positive"
28-
(let ((d (sqrt (- (sqr b/2) (* a c))))) (/ (+ (- b/2) d) a)))
18+
(let ([r1 (/ (+ (- b) d) (* 2 a))] [r2 (/ (- (- b) d) (* 2 a))])
19+
(if (< b 0) (/ c (* a r1)) r2)))
20+
21+
(let ([d (sqrt (- (sqr b) (* 4 (* a c))))])
22+
(/ (- (- b) d) (* 2 a))))
23+
24+
(FPCore (a b/2 c)
25+
:name "quad2m (problem 3.2.1, negative)"
26+
(let ([d (sqrt (- (sqr b/2) (* a c)))])
27+
(/ (- (- b/2) d) a)))
28+
29+
(FPCore (a b/2 c)
30+
:name "quad2p (problem 3.2.1, positive)"
31+
(let ([d (sqrt (- (sqr b/2) (* a c)))])
32+
(/ (+ (- b/2) d) a)))

bench/hamming/quadratic.rkt

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)