• Aucun résultat trouvé

Rigorous enclosure of round-off errors in floating-point computations

N/A
N/A
Protected

Academic year: 2022

Partager "Rigorous enclosure of round-off errors in floating-point computations"

Copied!
24
0
0

Texte intégral

(1)

Rigorous enclosure of round-off errors in

floating-point computations

NSV 2020

Rémy Garcia Claude Michel Michel Rueher

Université Côte d’Azur, CNRS, I3S, France

July 20, 2020

(2)

Outline

Motivation

Floating-point numbers

A constraint system to bound round-off errors Rigorous enclosure of round-off errors

Experimentation Conclusion

(3)

Motivation

Motivation 1/22

Program on F written with the semantic ofR F‰R

Computation overF produceerrors

Error analysis tools (Fluctuat, FPTaylor, PRECiSA, . . .) compute an over-approximation of the error

Ñ Computed bounds of error are rarely reachable Other tools (S3FP, FPSDP, . . .) compute an

under-approximation of the largest absolute error Ñ Possibleover-approximation of bounds

None of these tools provides an enclosure of the largest absolute error

(4)

Motivating example

Motivation 2/22

Consider the following program that computez and use a conditional to raise an alarm or proceed without it

z = ( 3 ∗ x+y ) /w ;

i f ( z − 10 <= δ) { p r o c e e d ( ) ;

} e l s e {

r a i s e A l a r m ( ) ; }

Critical issue

Is the error on z small enough to avoid raising the alarm when the value ofz isless than or equal to10 onR?

(5)

Motivating example (cont.)

Motivation 3/22

Computation is done over 64-bit floating-point numbers with xP r7,9s,yP r3,5s,wP r2,4s, andδ set to 5.32e´15

FPTaylor PRECiSA Fluctuat FErA ez 5.15e-15 5.08e-15 6.28e-15 4.96e-15

Bounds are smallerthanδÑ no alarm for zď10

FErA output an enclosure ofr3.55e´15,4.96e´15s forez with

x“8.99999999999996624922 ex“ ´8.88178419700125232339e´16 y“4.99999999999994848565 ey “ ´4.44089209850062616169e´16 w“3.19999999999998419042 ew “ `2.22044604925031308085e´16 z“10.0000000000000035527 ez “ ´3.55271367880050092936e´15

(6)

Motivating example (cont.)

Motivation 4/22

Let us changeδ to 3.55e´15

FErA provides one case where the else branch is taken and input valuesexercising it

x“8.99999999999996624922 ex“ ´8.88178419700125232339e´16 y“4.99999999999994848565 ey “ ´4.44089209850062616169e´16 w“3.19999999999998419042 ew “ `2.22044604925031308085e´16 z“10.0000000000000035527 ez “ ´3.55271367880050092936e´15

Fluctuat, FPTaylor, and PRECiSA areunableto do so, as they only compute anover-approximationof errors

(7)

Floats – definition

Floating-point numbers 5/22

F is a finite subset of R 0

´8 `8

R(horizontal line)and F(vertical lines) IEEE 754 floats are represented by

asign amantissa an exponent

p´1qsˆ1.mˆ2e

p´1q0ˆ1.00010001101011010..0ˆ2´1«0.53452301025390625

(8)

Floats – rounding

Floating-point numbers 6/22

Problem: x, yPFÑx¨y RF, where¨is an operation onR Require rounding ˝ of the result to theclosest float

Loss of precision˝pxq usually not equal to x Root of thedivergence between RandF

˝p0.1q “0.100000001490116119384765625 Rounding accumulation

Rounding onall operations˝p˝px¨yq ¨zq Increase thedivergencebetween Rand F

Reduce or cancel an error with error compensation

˝p˝p0.1`0.2q`0.2q“0.5 e“´e«7.4505805969238281e´09

(9)

Constraint Programming: overview

A constraint system to bound round-off errors 7/22

Constraint Programming (CP) is a paradigm used for solving NP-completecombinatorial problems

Explicit separation between

modelling, which is a formalisation of the problem, andsolving, that uses dedicated techniques to find a solution

(10)

How does CP works?

A constraint system to bound round-off errors 8/22

Modelling

ACSP pX,D,Cq is defined by:

X is the set of variables D is the set of domains

§ A domain is the set of all possible values for eachxPX C is the set of constraints

§ A constraint is a relation between variables Solving

Filtering, removestrivially inconsistant values from domains of variables in a constraint

§ Propagateto other constraints with common variables Search,selectsa variable andsplits its domain, according to asearch strategy

Ñ The solving process is repeated until a solution is found or when the search space is fully explored

(11)

Domain of errors over Q Q Q

A constraint system to bound round-off errors 9/22

Letx be a floating-point variable of a CSP

Domain of values Dx Interval of F Cannot represent the associated error (R F)

Domain of errorsDex Interval of Q Correctly

represents an error For `,´,ˆ,˜

x

Dx Dex

(12)

Filtering – error computation

A constraint system to bound round-off errors 10/22

Compute errors over Q

Exact computationof errors e“ pxR¨yRq ´ pxFdyFq

with ¨an operation over Randd an operation overF (operations are restricted to `,´,ˆ,˜)

Signed errors

Possible compensationof errors

(13)

Filtering – domains of variables

A constraint system to bound round-off errors 11/22

Domain of values Dx

Projection functions from [Michel02],[BotellaGM06], and [MarreM10]

Domain of errorsDex Projection functions based onpxR¨yRq ´ pxFdyFq

Error filtering on which constraints?

Arithmetic constraints: `,´,ˆ,˜

Assignement constraint: propagation of the error Example forzx´y

ezÐezX pex´ey`eaq exÐexX pez`ey´eaq eyÐeyX pex´ez`eaq ea ÐeaX pez´ex`eyq

(14)

Filtering – operation error

A constraint system to bound round-off errors 12/22

Considerzxdy

IEEE 754, operations correctly rounded: ‘,a,b,m

pxdyq ´1

2ulppxdyq ďx¨yď pxdyq `1

2ulppxdyq ulp: distance between two consecutive floats

Error on the operation

´1

2ulppxdyq ďedď `1

2ulppxdyq

(15)

Constraint over errors

A constraint system to bound round-off errors 13/22

New notation for constraints over errors errpxq ě ϵ

errpxq represent the domain of errors of variablex errpxq PQ,the constraint is overQQQ

Modelize a program as an optimization problem max|errpxq |

(16)

Branch-and-bound – schema

Rigorous enclosure of round-off errors 14/22

(branch-and-bound is restricted to`,´,ˆ,˜operations) Computes two bounds of errors:

Dual: upper boundof error,e¯(filtering)

§ over-approximation

Primal: lower boundof error,e˚ (generate-and-test)

§ reachableÑprovides input values

Error maximization directed by search on values explore finite search space inFÑinfer error A maximal error is in general hardto find

Anytime algorithm Ñprovides input values, e˚, and e¯

(17)

Stopping criteria

Rigorous enclosure of round-off errors 15/22

Operation error: ed and z result of operation ed ď 1

2ulppzq

Ñhighly dependent on the distribution of floats Consider intervalp2n,2n`1q

Distance between two floats is the same All floats have the sameulp

Ñcannotimproveed by means of projection functions

Once results for all operations satisfy this criteria, stop the exploration of this part of the search space

(18)

Branch-and-bound – boxes

Rigorous enclosure of round-off errors 16/22

A boxB can be in one of the following three states:

unexplored

discarded, s.t.eB ďe˚

sidelined, s.t. stopping criteria is true

¯

eS is max eB of sidelined boxes

(19)

Bounding – dual computation

Rigorous enclosure of round-off errors 17/22

Computation based on constraint programmingfiltering projection functions

ezÐezX pex´ey`eaq exÐexX pez`ey´eaq eyÐeyX pex´ez`eaq ea ÐeaX pez´ex`eyq

For a boxB

Propagate constraints to filter domains Update e with max between:

eof all boxes

eS of sidelined boxes

(20)

Bounding – primal computation

Rigorous enclosure of round-off errors 18/22

Generate-and-test: random instantiation of input variables For each boxB repeatntimes

Randomly instantiate input variables with respect to domains of values

Compute fQpq ´fFpq Local search (m steps):

explore floats around input values

§ guided by the best local value of the error ComputefQpq ´fFpq

ÑUpdatee˚ with best computed error

(21)

Branching – explore boxes

Rigorous enclosure of round-off errors 19/22

Variable selection

Choose in round-robinorder a variable xthat is not a singleton

Domain splitting

Apply a bisection on the domain of values of x to generate two subboxes

Box selection

Use best-first searchto select a box B with the greatest upper bound of error

(22)

Experimentation – FPBench

Experimentation 20/22

FErA vs.

Fluctuat, Gappa, PRECiSA, Real2Float, Daisy, Rosa, FPTaylor (¯e)

S3FP (e˚)

FErA over-approximation bound Best twice

Second 6 times Never the worst

FErAe˚ ande¯arealmost alwaysin the same order of magnitude FErAsolving timeis reasonable for most of benchmarks

only one bench timeout at 10 minutes

(23)

Conclusion

Conclusion 21/22

Rigorous enclosure of round-off errors in floating-point computations

Enclosure of a largest absolute error

Reachable primal Ñprovide inputs values exercising the error

Provides a tighter ¯eÑremoves some false positives

(24)

Further work

Conclusion 22/22

Tighter representation of round-off errors on elementary operations

Experimentations with different search strategies More efficient local search to speed up the primal computation procedure

Références

Documents relatifs

In such case, and considering that all parallel regions (the ones within the cadna init call and the ones in the CADNA instrumented code) have the same number of threads

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des

For this purpose, on one hand, we establish in Section IV-A upper bounds on the error of approximating a discarded sample with atoms of a dictionary obtained by the distance or

The table shows results from a standard execution in IEEE-754 single precision (float) with rounding to nearest, as well as results obtained with the same program (i.e. the exact

result the number of signiant digits whih are not aeted by

in situ survey off the southwest Grand Banks of Newfoundland in 2007: (a) outcrop, (b) dense large coral cover with Sebastes sp., (c) boulder field with... insolitus field,

This set of optimal bounds is then applied to the rounding error analysis of various numerical algorithms: in all cases, we obtain significantly shorter proofs of the best-known

There are two principal voting methods for electing presidents : one round plurality elections whereby the candidate with the most votes wins, and two round majority runoff