Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Herbie 1.2 does not work on Ubuntu 18.10 (Racket 7.1) #211

Closed
bozherbie opened this issue Dec 31, 2018 · 9 comments
Closed

Herbie 1.2 does not work on Ubuntu 18.10 (Racket 7.1) #211

bozherbie opened this issue Dec 31, 2018 · 9 comments

Comments

@bozherbie
Copy link

Hello,

I just tried to install herbie on Ubuntu 18.10 (somehow, the very first expression I tried is too complex for the web demo and times out).
I installed racket 7.1 from the indicated ppa:

racket -v
Welcome to Racket v7.1.

When running the tests, all failed:

~/.racket/7.1/bin/herbie report bench/tutorial.fpcore graphs/
Starting Herbie on 3 problems (seed: 1537437092)...
  1/3   [   CRASH   ]   Expanding a square
  2/3   [   CRASH   ]   Commute and associate
  3/3   [   CRASH   ]   Cancel like terms

I also tried to install from sources, but with similar results:

git clone https://github.com/uwplse/herbie
cd herbie/
racket src/herbie.rkt report bench/tutorial.fpcore graphs/
Starting Herbie on 3 problems (seed: 1855190789)...
  1/3   [   CRASH   ]   Expanding a square
  2/3   [   CRASH   ]   Commute and associate
  3/3   [   CRASH   ]   Cancel like terms

See below the infos from the report.html:

herbie shell --seed 1855190789 
(FPCore (x)
  :name "Expanding a square"
  (- (* (+ x 1) (+ x 1)) 1))
herbie shell --seed 1855190789 
(FPCore (x y z)
  :name "Commute and associate"
  (- (+ (+ x y) z) (+ x (+ y z))))
herbie shell --seed 1855190789 
(FPCore (x)
  :name "Cancel like terms"
  (- (+ 1 x) x))

and the backtrace from the first one:

mpfr_set_nan: implementation not found; arguments: #<_mpfr> | L | C
-- | -- | --
new-mpfr | /usr/share/racket/pkgs/math-lib/math/private/bigfloat/mpfr.rkt | 335 | 0
bf | /usr/share/racket/pkgs/math-lib/math/private/bigfloat/mpfr.rkt | 601 | 2
(unnamed) | /usr/share/racket/collects/racket/contract/private/arrow-higher-order.rkt | 357 | 33
f140 | unknown
f140 | unknown
f140 | unknown
eval-prog | /home/myhome/softs/herbie/src/programs.rkt | 150 | 0
make-exacts* | /home/myhome/softs/herbie/src/points.rkt | 138 | 0
loop | /home/myhome/softs/herbie/src/points.rkt | 158 | 2
prepare-points | /home/myhome/softs/herbie/src/points.rkt | 214 | 0
setup-prog!32 | /home/myhome/softs/herbie/src/mainloop.rkt | 72 | 0
run-improve41 | /home/myhome/softs/herbie/src/mainloop.rkt | 234 | 0
.../more-scheme.rkt:261:28 | unknown
(unnamed) | /usr/share/racket/collects/racket/private/more-scheme.rkt | 261 | 28

Do not hesitate to ask for more tests...

@pavpanchekha
Copy link
Contributor

Hi @bozherbie, thanks for writing. I heard of this bug recently, but haven't yet tried to reproduce it. What version of MPFR do you have on your machine? I believe the Ubuntu package is libmpfr6. In particular, is that package installed? If not, can you install it and try Herbie again?

MPFR is a GNU library for arbitrary-precision floating-point numbers. Herbie uses it heavily to figure out what the accurate value for an expression is. The error message suggests that some MPFR functions aren't present on your system; it could be a version issue or it could be a missing dependency issue.

@bozherbie
Copy link
Author

Hello,
libmpfr6 seems to be installed:

Sorting... Done
Full Text Search... Done
libmpfr6/cosmic,now 4.0.1-1 amd64 [installed,automatic]
  multiple precision floating-point computation

I believe it was installed for some other softs I use (Julia, ...) and that are working just fine on this machine.

Any idea on how I can troubleshoot this issue?

@pavpanchekha
Copy link
Contributor

Hi, thanks for getting me the version number. Since you do have MPFR, I'm wondering whether Racket in general is having MPFR troubles or whether it is Herbie specifically. One way to check would be to run racket, and try some basic operations in the shell:

$ racket
Welcome to Racket v7.1.
> (require math/bigfloat)
> (bf 1)
(bf 1)
> (bf+ 1.bf 2.bf)
(bf 3)
> (bfsin pi.bf)
(bf #e1.883041077660785116745909548456034940273e-39)
> +nan.bf
+nan.bf

That's what I see on my machine; do you see the same, or do you get an error message? If an error message, there's something wrong with the Racket installation, and you may have better luck filing a bug in Racket. If you don't see an error message, there's something Herbie's doing that's the problem, and I'll continue looking.

@bozherbie
Copy link
Author

Hello,

OK, it seems to be a problem between racket and libmpfr6:

racket 
Welcome to Racket v7.1.
> (bf 1)
; bf: undefined;
;  cannot reference an identifier before its definition
;   in module: top-level
; [,bt for context]

I had to install racket using this ppa : https://launchpad.net/~plt/+archive/ubuntu/racket maybe it's related?

@pavpanchekha
Copy link
Contributor

Ah, no, for that, you need to (require math/bigfloat). That's the Racket package that does MPFR bindings.

@bozherbie
Copy link
Author

bozherbie commented Jan 3, 2019

I tried to downgrade to the official ubuntu version, but I still have the same problem (or I don't know how to use racket):

 racket 
Welcome to Racket v6.12.
> (require math/bigfloat)
> (bf 1)
; mpfr_set_nan: implementation not found; arguments: #<_mpfr> [,bt for context]
>  (exit)

@bozherbie
Copy link
Author

I just tried with the ppa version and got the same error:

racket 
Welcome to Racket v7.1.
> (require math/bigfloat)
> (bf 1)
; mpfr_set_nan: implementation not found; arguments: #<_mpfr> [,bt for context]
> 

Any idea where I could report that?
By the way, any chance I can try to test my expression just to see whether herbie could be useful for us? I got down the rabbit hole of bug/troubleshooting, but I am still not sure herbie is something I really need! :-)

@pavpanchekha
Copy link
Contributor

Ok, yeah, that looks like a Racket bug—I've heard it before on 18.10. It doesn't seem to have been reported yet; report it on the Racket issue tracker: https://github.com/racket/racket/issues; if you report there, drop a link on this issue.

Totally got you w.r.t. rabbit holes. Happens to me too! You can try the Herbie demo or, if that won't work for you (you want to try different flags or it times out or something) email me privately (check my profile) and I'll run it for you.

I'm closing as "not Herbie's fault" but if you have further questions I'll continue responding to this issue.

@bozherbie
Copy link
Author

Here we go: I reported the issue to racket : https://github.com/racket/racket/issues/2444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants