• Aucun résultat trouvé

Tight interval inclusions with compensated algorithms

N/A
N/A
Protected

Academic year: 2022

Partager "Tight interval inclusions with compensated algorithms"

Copied!
37
0
0

Texte intégral

(1)

Tight interval inclusions with compensated algorithms

Stef Graillat & Fabienne Jézéquel

Sorbonne Université, Laboratoire d’Informatique de Paris 6 (LIP6), France

18th international symposium on Scientific Computing, Computer Arithmetic and Validated Numerics (SCAN 2018)

Tokyo, Japan, 10-15 September 2018

(2)

Introduction

Exascale barrier broken in June 2018: 1.8 1018 floating-point operations per second. (Oak Ridge National Laboratory, analysis of genomic data)

Increasing power of current computers

GPU accelerators, Intel Xeon Phi processors, etc.

Enable to solve more complex problems

Quantum field theory, supernova simulation, etc.

A high number of floating-point operations performed

Each of them can lead to a rounding error

Need for accuracy and validation

(3)

Introduction

Exascale barrier broken in June 2018: 1.8 1018 floating-point operations per second. (Oak Ridge National Laboratory, analysis of genomic data)

Increasing power of current computers

GPU accelerators, Intel Xeon Phi processors, etc.

Enable to solve more complex problems

Quantum field theory, supernova simulation, etc.

A high number of floating-point operations performed

Each of them can lead to a rounding error

Need for accuracy and validation

(4)

Key tools for accurate computation

fixed length expansions libraries: double-double (Briggs, Bailey, Hida, Li), quad-double (Bailey, Hida, Li)

arbitrary length expansions libraries: Priest, Shewchuk, Joldes-Muller-Popescu

arbitrary precision libraries: ARPREC, MPFR, MPIR

compensated algorithms(Kahan, Priest, Ogita-Rump-Oishi,...) based on EFTs (Error Free Transformations)

EFTs: properties and algorithms to compute the generated elementary rounding errors

Leta, bF, for the basic operation ◦ ∈ {+,−,×}, with rounding to nearest,

ab= fl(ab) +e with eF

(5)

Key tools for accurate computation

fixed length expansions libraries: double-double (Briggs, Bailey, Hida, Li), quad-double (Bailey, Hida, Li)

arbitrary length expansions libraries: Priest, Shewchuk, Joldes-Muller-Popescu

arbitrary precision libraries: ARPREC, MPFR, MPIR

compensated algorithms(Kahan, Priest, Ogita-Rump-Oishi,...) based on EFTs (Error Free Transformations)

EFTs: properties and algorithms to compute the generated elementary rounding errors

Leta, bF, for the basic operation ◦ ∈ {+,−,×}, with rounding to nearest,

ab= fl(ab) +e with eF

(6)

Numerical validation with interval arithmetic

Principle: replace numbers by intervals and compute.

Fundamental theorem of interval arithmetic: the exact result belongs to the computed interval.

No result is lost, the computed interval is guaranteed to contain every possible result.

How to compute tight interval inclusions with compensated algorithms?

Assume floating-point arithmetic adhering to IEEE 754 with rounding unit u (no underflow nor overflow).

(7)

Numerical validation with interval arithmetic

Principle: replace numbers by intervals and compute.

Fundamental theorem of interval arithmetic: the exact result belongs to the computed interval.

No result is lost, the computed interval is guaranteed to contain every possible result.

How to compute tight interval inclusions with compensated algorithms?

Assume floating-point arithmetic adhering to IEEE 754 with rounding unit u (no underflow nor overflow).

(8)

Numerical validation with interval arithmetic

Principle: replace numbers by intervals and compute.

Fundamental theorem of interval arithmetic: the exact result belongs to the computed interval.

No result is lost, the computed interval is guaranteed to contain every possible result.

How to compute tight interval inclusions with compensated algorithms?

Assume floating-point arithmetic adhering to IEEE 754 with rounding unit u (no underflow nor overflow).

(9)

Outline

1 Error-free transformations (EFT) with rounding to nearest

2 Error-free transformations (EFT) with directed rounding

3 Compensated algorithm for summation with directed rounding

4 Compensated dot product with directed rounding

5 Compensated Horner scheme with directed rounding

(10)

Outline

1 Error-free transformations (EFT) with rounding to nearest

2 Error-free transformations (EFT) with directed rounding

3 Compensated algorithm for summation with directed rounding

4 Compensated dot product with directed rounding

5 Compensated Horner scheme with directed rounding

(11)

EFT for addition

x=ab a+b =x+y with yF Algorithm of Dekker (1971) and Knuth (1974)

Algorithm (EFT of the sum of 2 floating-point numbers with |a| ≥ |b|)

function[x, y] =FastTwoSum(a, b) x=ab

y= (a x)b

Algorithm (EFT of the sum of 2 floating-point numbers)

function[x, y] =TwoSum(a, b) x=ab

z =x a

y= (a (x z))(b z)

(12)

EFT for the product (1/3)

x=ab a×b =x+y with yF AlgorithmTwoProduct by Veltkamp and Dekker (1971)

a=x+y and x and y non overlapping with |y| ≤ |x|.

Algorithm (Error-free split of a floating-point number into two parts)

function[x, y] =Split(a)

factor = 2s+ 1 %u = 2−p , s=dp/2e c=factora

x=c (c a) y=a x

(13)

EFT for the product (2/3)

Algorithm (EFT of the product of 2 floating-point numbers)

function[x, y] =TwoProduct(a, b) x=ab

[a1, a2] = Split(a) [b1, b2] =Split(b)

y = a2b2 (((x a1b1) a2b1) a1b2)

(14)

EFT for the product (3/3)

x=ab a×b =x+y with yF Givena, b, cF,

FMA(a, b, c) is the nearest floating-point number to a×b+c

Algorithm (EFT of the product of 2 floating-point numbers)

function[x, y] =TwoProdFMA(a, b) x=ab

y=FMA(a, b,−x)

FMAis available for example on PowerPC, Itanium, Cell, Xeon Phi, AMD and Nvidia GPU, Intel (Haswell), AMD (Bulldozer)

processors.

(15)

Outline

1 Error-free transformations (EFT) with rounding to nearest

2 Error-free transformations (EFT) with directed rounding

3 Compensated algorithm for summation with directed rounding

4 Compensated dot product with directed rounding

5 Compensated Horner scheme with directed rounding

(16)

EFT for addition with directed rounding

x= fl*(a+b) a+b=x+e but possibly e /F

Algorithm (EFT of the sum of 2 floating-point numbers with |a| ≥ |b|)

function[x, y] =FastTwoSum(a, b) x= fl*(a+b)

y= fl*((ax) +b)

Proposition

We have y= fl*(e) and so |ey| ≤2u|e|. It yields |ey| ≤4u2|x|

and |ey| ≤4u2|a+b|. Moreover if = ∆, ey

if =∇, ye

(17)

EFT for addition with directed rounding

x= fl*(a+b) a+b=x+e but possibly e /F

Algorithm (EFT of the sum of 2 floating-point numbers)

function[x, y] =TwoSum(a, b) x= fl*(a+b)

z = fl*(xa)

y= fl*((a(xz)) + (bz))

Proposition

We have |ey| ≤4u2|a+b| and |ey| ≤4u2|x|. Moreover if = ∆, ey

if =∇, ye

(18)

EFT for the product with directed rounding

x= fl*(a×b) a×b=x+y with yF Givena, b, cF,

FMA(a, b, c) is the nearest floating-point number to a×b+c

Algorithm (EFT of the product of 2 floating-point numbers)

function[x, y] =TwoProdFMA(a, b) x= fl*(a×b)

y=FMA(a, b,−x)

(19)

EFT for the product with directed rounding

a =x+y and xand y non overlapping with |y| ≤ |x|

Algorithm (Error-free split of a floating-point number into two parts)

function[x, y] =Split(a)

factor = 2s+ 1 %u = 2−p , s=dp/2e c= fl*(factor×a)

x= fl*(c(ca)) y= fl*(ax)

Proposition

We have a=x+y. Moreover,

the significand of x fits in ps bits;

the significand of y fits in s bits.

(20)

EFT for the product with directed rounding

x= fl*(a×b) a×b=x+e with eF

Algorithm (EFT of the product of 2 floating-point numbers)

function[x, y] =TwoProduct(a, b) x= fl*(a×b)

[a1, a2] = Split(a) ;[b1, b2] =Split(b)

y = fl*(a2×b2(((xa1×b1)a2×b1)a1×b2))

Proposition

We have |ey| ≤8u2|a×b| and |ey| ≤8u2|x|. Moreover if = ∆, ey

if =∇, ye

(21)

Outline

1 Error-free transformations (EFT) with rounding to nearest

2 Error-free transformations (EFT) with directed rounding

3 Compensated algorithm for summation with directed rounding

4 Compensated dot product with directed rounding

5 Compensated Horner scheme with directed rounding

(22)

Compensated algorithm for summation

Letp={pi} be a vector of n floating-point numbers.

Algorithm (Ogita, Rump, Oishi (2005))

functionres =CompSum(p) π1 =p1 ;σ1 = 0

for i= 2 :n

i, qi] =TwoSum(πi−1, pi) σi = fl*i−1+qi)

res= fl*n+σn)

Proposition

Let us suppose CompSum is applied, with directed rounding, to pi F, 1in. Let s:=P

pi and S :=P

|pi|. If nu< 12, then

|ress| ≤2u|s|+ 2(1 + 2u)γn2(2u)S with γn(u) = nu 1nu.

(23)

Compensated algorithm for summation

Algorithm (Tight inclusion using INTLAB)

s e t r o u n d ( -1)

Sinf = C o m p S u m p ( p ) s e t r o u n d (1)

Ssup = C o m p S u m p ( p )

Proposition

Letp= {pi} be a vector of n floating-point numbers. Then we have

Sinf

n

X

i=1

pi Ssup.

(24)

Numerical experiments

100 105 1010 1015 1020 1025 1030 1035 1040

Condition number 10-20

10-15 10-10 10-5 100 105

Radius/midpoint

Conditioning and radius/midpoint

classic summation compensated summation

(25)

Outline

1 Error-free transformations (EFT) with rounding to nearest

2 Error-free transformations (EFT) with directed rounding

3 Compensated algorithm for summation with directed rounding

4 Compensated dot product with directed rounding

5 Compensated Horner scheme with directed rounding

(26)

Compensated dot product

Algorithm (Ogita, Rump and Oishi 2005)

functionres=CompDot(x, y) [p, s] =TwoProduct(x1, y1) for i= 2 :n

[h, r] =TwoProduct(xi, yi) [p, q] =TwoSum(p, h) s= fl*(s+ (q+r)) end

res= fl*(p+s)

Proposition

Let xi, yi F (1in) and res the result computed by CompDot with directed rounding. If (n+ 1)u< 12, then,

|resxTy| ≤2u|xTy|+ 2γn+12 (2u)|xT||y|.

(27)

Compensated dot product

Algorithm (Tight inclusion using INTLAB)

s e t r o u n d ( -1)

Dinf = C o m p D o t ( x , y ) s e t r o u n d (1)

Dsup = C o m p D o t ( x , y )

Proposition

Let xi, yi F (1in) be given. Then we have DinfxTyDsup.

(28)

Numerical experiments

100 105 1010 1015 1020 1025 1030 1035 1040

Condition number 10-16

10-14 10-12 10-10 10-8 10-6 10-4 10-2 100 102

Radius/midpoint

Conditioning and radius/midpoint

classic dot product compensated dot product

(29)

Outline

1 Error-free transformations (EFT) with rounding to nearest

2 Error-free transformations (EFT) with directed rounding

3 Compensated algorithm for summation with directed rounding

4 Compensated dot product with directed rounding

5 Compensated Horner scheme with directed rounding

(30)

Compensated Horner scheme

Letp(x) =

n

X

i=0

aixi with x, ai F

Algorithm (Graillat, Langlois, Louvet, 2009)

functionres=CompHorner(p, x) sn =an

rn= 0

for i=n1 :−1 : 0

[pi, πi] =TwoProduct(si+1, x) [si, σi] =TwoSum(pi, ai) ri = fl*(ri+1×x+ (πi +σi)) end

res= fl*(s0+r0)

(31)

Compensated Horner scheme

Theorem

Consider a polynomial p of degree n with floating-point coefficients, and a floating-point value x. With directed rounding, the forward error in the compensated Horner algorithm is such that

|CompHorner(p, x)p(x)| ≤2u|p(x)|+ 2γ2n+1(2u)2p(|x|),e with ep(x) = Pn

i=0|ai|xi.

(32)

Compensated Horner scheme

Algorithm (x ≥ 0, Tight inclusion using INTLAB)

s e t r o u n d ( -1)

Einf = C o m p H o r n e r ( p , x ) s e t r o u n d (1)

Esup = C o m p H o r n e r ( p , x )

Ifx0, CompHorner(¯p,−x) is computed with p(x) =¯ Pn

i=0ai(−1)ixi.

Proposition

Consider a polynomial p of degree n with floating-point coefficients, and a floating-point value x.

Einfp(x)Esup.

(33)

Numerical experiments

100 105 1010 1015 1020 1025 1030 1035 1040

Condition number 10-20

10-15 10-10 10-5 100 105

Radius/midpoint

Conditioning and radius/midpoint

Classic Horner Compensated Horner

(34)

Conclusion and future work

Conclusion

Compensated methodsare a fast way to get accurate results They can be used efficiently with interval arithmetic to obtain certified results with finite precision

Future work

Interval computations with K-fold compensated algorithms using Priest’s EFT and FMA

(35)

References I

[1] S. Boldo, S. Graillat, and J.-M. Muller.

On the robustness of the 2Sum and Fast2Sum algorithms.

ACM Trans. Math. Softw., 44(1):4:1–4:14, July 2017.

[2] S. Graillat, F. Jézéquel, and R. Picot.

Numerical validation of compensated summation algorithms with stochastic arithmetic.

Electronic Notes in Theoretical Computer Science, 317:55–69, 2015.

[3] S. Graillat, F. Jézéquel, and R. Picot.

Numerical validation of compensated algorithms with stochastic arithmetic.

Applied Mathematics and Computation, 329:339 – 363, 2018.

(36)

References II

[4] S. Graillat, Ph. Langlois, and N. Louvet.

Algorithms for accurate, validated and fast polynomial evaluation.

Japan J. Indust. Appl. Math., 2-3(26):191–214, 2009.

[5] T. Ogita, S. M. Rump, and S. Oishi.

Accurate sum and dot product.

SIAM Journal on Scientific Computing, 26(6):1955–1988, 2005.

[6] D.M. Priest.

On Properties of Floating Point Arithmetics: Numerical Stability and the Cost of Accurate Computations.

PhD thesis, Mathematics Department, University of California, Berkeley, CA, USA, November 1992.

(37)

Thank you for your attention

Références

Documents relatifs

Overall, considering all their mechanisms of action, proteases associated with IBD exert rather pro-in flammatory properties: they potentiate cytokines and chemokines pro-in

Afin d’offrir au Dépôt légal fribourgeois, sis à la Bibliothèque cantonale et universitaire de Fribourg, une nouvelle stratégie de veille médiatique –

For the same monetary aggregates, exchange rate elasticity is significant and slightly higher in the case of demand for M1 (-0.196) and cash (-0.186), reflecting the

A lower density of keratinocytes does not allow proper reconstruction of the epidermis since, in this case, the culture medium can overlay the seeded

This chapter is an introductory chapter: it recalls the definitions related to floating-point arithmetic, and presents some of the features of the IEEE-754-2008 Standard for

To verify the floating-point solution of a linear system, we adapt floating-point iterative refinements to interval arithmetic [NR]. By using alternately floating-point and

La ponction vidange transpariétale qui était proposée par certains auteurs pour le traitement du kyste hydatique pulmonaire dans des situations particulières, est

Figure 8 shows diameters of boxes along the trajectory for different iteration which illustrates the constraint propagation process. The constraint propaga- tion methods is shown to