soarlab / fptaylor Goto Github PK
View Code? Open in Web Editor NEWTool for Rigorous Estimation of Round-Off Floating-Point Errors
License: MIT License
Tool for Rigorous Estimation of Round-Off Floating-Point Errors
License: MIT License
This is a bug report filed against FPTuner:
soarlab/FPTuner#2
I have tried compiling FPTaylor on Ubuntu 17.10 using the provided OCaml, and OCaml versions 4.00 to 4.05 provided with opam.
The problem appears to be related to building linking non-pic objects:
/usr/bin/ld: chcw.o: relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
The main fptaylor target is also unable to build (after removing INTERVAL's ocamlfpu target) with a similar error.
Use hexadecimal floating-point numerals for external optimization tools. Use "%h"
in OCaml printf
functions. OCaml >= 4.03 is required.
I am experimenting with FPTaylor by trying to estimate the round-off error that accumulates over a loop. Consider the (Matlab) loop below:
x = single(0); % Initialize x to a single precision floating-point variable with value 0.
for i=1:10000
x = x + 0.0001; % After 10,000 iteration, x should theoretically be equal to x = 1.
end
x % Display x, which shows that x = 1.0001
To generate the FPTaylor definitions I unrolled this loop.
Variables
float32 x in [1.0, 2.0]
;
Definitions
defx0 = x + 0.1,
defx1 = defx0 + 0.1,
defx2 = defx1 + 0.1,
defx3 = defx2 + 0.1,
defx4 = defx3 + 0.1,
...
defx9999 = defx9998 + 0.1
;
Expressions
defx9999
;
FPTaylor hangs on "Corresponding original subexpressions".
Has FPTaylor been tested on expressions as large as this?
I'm wondering if anyone has tried this on MacOSX? I would like to use FPTaylor with Gelapia on MacOSX.
Thoughts?
Correctly handle subnormal constants in binary_float.ml
and taylor_form.ml
.
When given a constant query on the edge of a function's valid range FPTaylor currently overapproximates the function input, thus leading to a range error. Treating constants as exact could alleviate this issue.
For example, the query "sqrt(0)" will lead to an error that the square root function cannot take in a negative value.
The link to the first publication: http://soarlab.org/2015/04/fm2015-sjrg/ yields an error
@Thanhson89, who is a PhD student at Utah, has been investing a lot of time to understand the source code of FPTaylor. He is documenting his findings along the way, and I thought it would be a good idea for this effort not to go to waste and that he turns this into nice comments in the code.
@monadius what do you think? If this sounds like it would be a potential improvement of FPTaylor for future users, please let us know and we'll create pull requests to add these comments in. Thanks!
Integrate Travis CI
Add custom floating-point rounding modes. At least add arbitrary precision floating-point rounding modes which behave as IEEE 754 modes.
This is the output I get:
cd INTERVAL; make
make[1]: Entering directory '/home/vagrant/FPTaylor/INTERVAL'
File "fpu.ml", line 24, characters 0-52:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 25, characters 0-54:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 26, characters 0-60:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 24, characters 0-52:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 25, characters 0-54:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
File "fpu.ml", line 26, characters 0-60:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
/usr/bin/ld: chcw.o: relocation R_X86_64_32S against `.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
File "_none_", line 1:
Error: Error while building custom runtime system
Makefile:23: recipe for target 'ocamlfpu' failed
make[1]: *** [ocamlfpu] Error 2
make[1]: Leaving directory '/home/vagrant/FPTaylor/INTERVAL'
Makefile:128: recipe for target 'compile-interval' failed
make: *** [compile-interval] Error 2
Hi Alexey,
this might be just a question rather than an issue. I'm debugging FPTaylor (to double-check the results from my probabilistic tool).
In the case of the inverse operator, the coefficient for the first-order error terms is -1/f(x)*f(x)
Thus, should be the line 422 (link below)
let mk_v1 v0 e = mk_neg (mk_div const_1 (mk_mul v0 v0)) in
rather than
let mk_v1 v0 e = mk_neg (mk_div e (mk_mul v0 v0)) in
Thank you and sorry again for this very debugging question.
Line 422 in efbbc83
Several people asked me about this, given the recent trend in ML (and other areas) to use low, custom bit-widths for floating-points.
I suspect this would not be that hard to add as long as they are still IEEE compliant and it would amount to setting up machine epsilons appropriately. But maybe I am wrong here.
If you compile with e.g. ocamlc 4.06 you get a bunch of warnings like this:
If you need to stay compatible with OCaml < 4.07, you can use the
stdlib-shims library: https://github.com/ocaml/stdlib-shims
Then an error:
ocamlc -c -I b_and_b -I INTERVAL more_num.mli
File "more_num.mli", line 13, characters 16-23:
13 | val numerator : Num.num -> Big_int.big_int
^^^^^^^
Error: Unbound module Num
make: *** [Makefile:183: more_num.cmi] Error 2
I got around this by doing ocaml switch create 4.05.0
, which then built successfully. You may want to update the README.md. This was on Ubuntu 20.04.
Add fixed precision rounding modes and fixed-precision variables.
I'm trying to bound this program, which crosses two vectors and then crosses those results to get the sin of the angle between them:
Variables
real x0 in [0,1.0000000000000004];
real y0 in [0,1.0000000000000004];
real z0 in [0,1.0000000000000004];
real x1 in [0,1.0000000000000004];
real y1 in [0,1.0000000000000004];
real z1 in [0,1.0000000000000004];
real x2 in [0,1.0000000000000004];
real y2 in [0,1.0000000000000004];
real z2 in [0,1.0000000000000004];
real x3 in [0,1.0000000000000004];
real y3 in [0,1.0000000000000004];
real z3 in [0,1.0000000000000004];
Expressions
c00 rnd64= +(y0*z1-z0*y1); // |i j k |
c01 rnd64= -(x0*z1-z0*x1); // |x0 y0 z0|
c02 rnd64= +(x0*y1-y0*x1); // |x1 y1 z1|
c10 rnd64= +(y2*z3-z2*y3); // |i j k |
c11 rnd64= -(x2*z3-z2*x3); // |x2 y2 z2|
c12 rnd64= +(x2*y3-y2*x3); // |x3 y3 z3|
c0 rnd64 = +(c01*c12-c02*c11); // |i j k |
c1 rnd64 = -(c00*c12-c02*c10); // |c00 c01 c02|
c2 rnd64 = +(c00*c11-c01*c10); // |c10 c11 c12|
norm2 = c0*c0+c1*c1+c2*c2;
norm = sqrt(c0*c0+c1*c1+c2*c2);
It seems to do fine until it gets to norm() and then it errors out with:
**ERROR**: num_of_float: inf
But I don't think those terms should ever be infinite, so I'm wondering if I'm doing something obviously wrong.
The improved rounding model can be rewritten as
rnd_b(x) = p_2(x, b) * eps(b)
where p_2(x, b) = p_2(x)
if |x| = 0
or |x|
is in the normal range and p_2(x, b) = min_pos_float(b) / eps(b)
when |x|
is subnormal (and not 0
).
/usr/bin/ld: INTERVAL/chcw.o: relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
I have tried adding -fPIC
to the makefile without success. Also tried crosscompiling to 32 bit (using gcc -m32
) which didn't work.
The four expressions marked in the red box in the picture are all expressions with functions. I don’t know how s3fp measures the error with function expressions. I would like to ask how s3fp operates to obtain expressions with functions. formula error? Thank you very much if you can answer my question
`
ubuntu@test-1:~/FPTaylor⟫ make
cd INTERVAL; make
make[1]: Entering directory '/home/ubuntu/FPTaylor/INTERVAL'
make[1]: Leaving directory '/home/ubuntu/FPTaylor/INTERVAL'
ocamlc -c -I INTERVAL version.mli
ocamlc -c -I INTERVAL version.ml
ocamlc -c -I INTERVAL lib.mli
ocamlc -c -I INTERVAL lib.ml
File "lib.ml", line 198, characters 2-27:
Error: Unbound value Format.pp_flush_formatter
Makefile:148: recipe for target 'lib.cmo' failed
make: *** [lib.cmo] Error 2
2 ubuntu@test-1:~/FPTaylor⟫
`
Could you help me?
Thank you very much!
I have been playing with the arcsine operator in FPTaylor. FPTaylor does not like when the argument of arcsine is a fresh variable bounded in [-1, 1].
Program causing the error:
Variables
real X in [-1, 1];
Expressions
latitude rnd64 = asin(X);
I suspect the reason is X=[-1, 1] implies Round(X)=[-1-err, +1+err] thus the domain of the arcsine is violated thus the error message: Potential exception detected: Arcsine of an invalid argument at: asin(rnd64(angle)).
On the other hand, this is a very specific scenario where also Round(X) is bounded between [-1 ,1]. So the error might be because of the over-approx. introduced by FPTaylor.
--Rocco
Add a custom error function for expressions in the form expr +/- const
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.