42
?

Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical quality:an industrial casestudy on code_aster

Numerical Software Veri�cation22/07/2017

François Févotte?

Bruno Lathuilière

EDF R&DPERICLES / I23(Analysis and Numerical Modeling)

Page 2: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Industrial context � Numerical SimulationIn-house development of Scienti�c Computing Codes

Structures Fluid dynamics Wave propagation

Neutronics Power Systems Free surface hydraulics

Numerical quality: an industrial case study on code_aster 2/22

Page 3: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Industrial context � Numerical SimulationCode_aster

MechanicsSeismic

Acoustic

Thermo-mechanics

Code_Aster1.2M code lines

Fortran 90, C, Python

thousands of test cases

Large number of dependencies :I Linear solvers (MUMPS. . . )I Mesh generator and partitioning tools (Metis, Scotch. . . )

Goalsunderstand the non-reproducibility between test computers

Numerical quality: an industrial case study on code_aster 3/22

Page 4: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Industrial context � Numerical SimulationVeri�cation & Validation

Real-world system

Mathematical Model

Numerical Algorithm

Simulated system

Veri�cation

Validation

Modeling errors

Mathematical approximations

Computation errors

Quantifying numerical errors: at stakequality of produced results

e�cient use of resources (development & computing time)

Numerical quality: an industrial case study on code_aster 4/22

Page 5: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Industrial context � Numerical SimulationV&V process: non-regression testing

Source files Executablebinary Results

Compiler Processor

Testing tools

Referenceresults

✓ OK x KONo regression

Numerical quality: an industrial case study on code_aster 5/22

Page 6: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Industrial context � Numerical SimulationV&V process: ad-hoc numerical instability detection methods

INPUTS

geometry

materials

mesh

OUTPUTS

Code

results

Code

resultscompiler

hardware speci�cation

. . .

Physical input: a�ects the resultSimulation parameter: should be neutral

Idea: measure the sensitivity of the results w.r.t �neutral� parameters

easy to doad hoc, no localization

Numerical quality: an industrial case study on code_aster 6/22

Page 7: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Industrial context � Numerical SimulationV&V process: ad-hoc numerical instability detection methods

INPUTS

geometry

materials

mesh

OUTPUTS

Code

resultscompiler

hardware speci�cation

. . .

Physical input: a�ects the resultSimulation parameter: should be neutral

Idea: measure the sensitivity of the results w.r.t �neutral� parameters

easy to doad hoc, no localization

Numerical quality: an industrial case study on code_aster 6/22

Page 8: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationThe CESTAC Method: dynamic analysis with random rounding

IEEE-754 nearest rounding mode

Numerical quality: an industrial case study on code_aster 7/22

Page 9: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationThe CESTAC Method: dynamic analysis with random rounding

CESTAC random rounding mode

[1] J. Vignes, �A stochastic arithmetic for reliable scienti�c computation,� Mathematics and

Computers in Simulation, vol. 35, no. 3, 1993.

[2] J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, �CADNA_C: A version of CADNA foruse with C or C++ programs�, Computer Physics Communications, vol. 181, no. 11, 2010.

Numerical quality: an industrial case study on code_aster 7/22

Page 10: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationThe CESTAC Method: dynamic analysis with random rounding

CESTAC random rounding mode

Instruction Eval. 1 Eval. 2 Eval. 3 Averagea = 1/3 0.333↓ 0.334↑ 0.334↑ 0.334b = a× 3 0.999 1.00↓ 1.01↑ 1.00

Numerical quality: an industrial case study on code_aster 7/22

Page 11: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationCADNA: dynamic sources analysis

$ myProg in out

Source files Executablebinary Results

Compiler Processor

Numerical quality: an industrial case study on code_aster 8/22

Page 12: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationCADNA: dynamic sources analysis

$ myProg-cadna in out

Source files Executablebinary Results

Instrumentedsource files

Run time:x 10-20

Results+ accuracy

+instabilitiesNumerical quality: an industrial case study on code_aster 8/22

Page 13: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationVerrou: dynamic binary analysis

$ valgrind --tool=verrou --rounding-mode=random myProg in out1

Source files Executablebinary Results

Verrou

Perturbed

Run time:x 10-20

Numerical quality: an industrial case study on code_aster 8/22

Page 14: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationVerrou: dynamic binary analysis

$ valgrind --tool=verrou --rounding-mode=random myProg in out1

$ valgrind --tool=verrou --rounding-mode=random myProg in out2

Source files Executablebinary Results

Verrou

Perturbed

Nexecutions

Numerical quality: an industrial case study on code_aster 8/22

Page 15: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationVerrou: dynamic binary analysis

$ valgrind --tool=verrou --rounding-mode=random myProg in out1

$ valgrind --tool=verrou --rounding-mode=random myProg in out2

Source files Executablebinary Results

Verrou

Perturbed

Testing tools

Referenceresults

✓ OK x KONumerical stability

Nexecutions

Numerical quality: an industrial case study on code_aster 8/22

Page 16: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical Veri�cationVeri�carlo: dynamic IR analysis

$ veri�carlo mySources.c -o myProg-veri�carlo$ myProg-veri�carlo in out1

Source files Executablebinary Results

Testing tools

Referenceresults

✓ OK x KONumerical stability

Nexecutions

Verificarlo

Perturbed

Numerical quality: an industrial case study on code_aster 8/22

Page 17: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical quality: an industrial case study on code_aster 9/22

Outline

1. Detect instabilities2. Locate (and �x) instabilities

unstable testsround-o� errors

3. Conclusions � perspectives

Page 18: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Detect instabilitiesPreliminary work

Selection of 72 test-casessome (believed to be) stable

some (known to be) unstable

�Meta-veri�cation�: veri�cation of the veri�cation process itself

Verrou could have bugs

new

Problem of �Heisenbugs�: they (dis)appear when instrumentingI introspectionI problematic assembly instructions (e.g x87 instruction set)I speci�c algorithms setting the rounding mode

Numerical quality: an industrial case study on code_aster 10/22

Page 19: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Detect instabilitiesPreliminary work

Selection of 72 test-casessome (believed to be) stable

some (known to be) unstable

�Meta-veri�cation�: veri�cation of the veri�cation process itself

Verrou had a bug, could have others new

Problem of �Heisenbugs�: they (dis)appear when instrumentingI introspectionI problematic assembly instructions (e.g x87 instruction set)I speci�c algorithms setting the rounding mode

Numerical quality: an industrial case study on code_aster 10/22

Page 20: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Analysis of numerical instabilitiesUsing Verrou and Random Rounding

Test Status # common decimal digitscase nearest rnd1 rnd2 rnd3 C (rnd1, rnd2, rnd3)

ssls108i OK OK OK OK 11 10ssls108j OK OK OK OK 10 10ssls108k OK OK OK OK 11 10ssls108l OK OK OK OK 10 9sdnl112a OK KO KO KO 6 6 6 * 3 0ssnp130a OK OK OK OK * * 10 10 10 10 9 * * * 9 9 9 9 *ssnp130b OK OK OK OK * * 11 11 * 12 9 * * * 9 9 9 9 9ssnp130c OK OK OK OK * 11 11 11 11 10 9 11 11 10 10ssnp130d OK OK OK OK * 9 * * * 10 9 9 9 9 9 9 9 9 * 9 *

10 minutes 20 minutes each

(72 test cases)

Numerical quality: an industrial case study on code_aster 11/22

Page 21: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Analysis of numerical instabilitiesUsing Verrou and Random Rounding

Test Status # common decimal digitscase nearest rnd1 rnd2 rnd3 C (rnd1, rnd2, rnd3)

ssls108i OK OK OK OK 11 10ssls108j OK OK OK OK 10 10ssls108k OK OK OK OK 11 10ssls108l OK OK OK OK 10 9sdnl112a OK KO KO KO 6 6 6 * 3 0ssnp130a OK OK OK OK * * 10 10 10 10 9 * * * 9 9 9 9 *ssnp130b OK OK OK OK * * 11 11 * 12 9 * * * 9 9 9 9 9ssnp130c OK OK OK OK * 11 11 11 11 10 9 11 11 10 10ssnp130d OK OK OK OK * 9 * * * 10 9 9 9 9 9 9 9 9 * 9 *

10 minutes 20 minutes each

(72 test cases)

Numerical quality: an industrial case study on code_aster 11/22

Page 22: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Analysis of numerical instabilitiesUsing Verrou and Random Rounding

Test Status # common decimal digitscase nearest rnd1 rnd2 rnd3 C (rnd1, rnd2, rnd3)

ssls108i OK OK OK OK 11 10ssls108j OK OK OK OK 10 10ssls108k OK OK OK OK 11 10ssls108l OK OK OK OK 10 9sdnl112a OK KO KO KO 6 6 6 * 3 (0 expected)ssnp130a OK OK OK OK * * 10 10 10 10 9 * * * 9 9 9 9 *ssnp130b OK OK OK OK * * 11 11 * 12 9 * * * 9 9 9 9 9ssnp130c OK OK OK OK * 11 11 11 11 10 9 11 11 10 10ssnp130d OK OK OK OK * 9 * * * 10 9 9 9 9 9 9 9 9 * 9 *

10 minutes 20 minutes each

(72 test cases)

Numerical quality: an industrial case study on code_aster 11/22

Page 23: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Analysis of numerical instabilitiesUsing Verrou and Random Rounding

Test Status # common decimal digitscase nearest rnd1 rnd2 rnd3 C (rnd1, rnd2, rnd3)

ssls108i OK OK OK OK 11 10ssls108j OK OK OK OK 10 10ssls108k OK OK OK OK 11 10ssls108l OK OK OK OK 10 9sdnl112a OK KO KO KO 6 6 6 * 3 (0 expected)ssnp130a OK OK OK OK * * 10 10 10 10 9 * * * 9 9 9 9 *ssnp130b OK OK OK OK * * 11 11 * 12 9 * * * 9 9 9 9 9ssnp130c OK OK OK OK * 11 11 11 11 10 9 11 11 10 10ssnp130d OK OK OK OK * 9 * * * 10 9 9 9 9 9 9 9 9 * 9 *

10 minutes 20 minutes each

(72 test cases)

C (x) = log10

∣∣∣∣µ(x)

σ(x)

∣∣∣∣

Numerical quality: an industrial case study on code_aster 11/22

Page 24: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical quality: an industrial case study on code_aster 12/22

Locate (and �x)instabilities

1. Detect instabilities

2. Locate (and �x) instabilitiesunstable testsround-o� errors

3. Conclusions � perspectives

Page 25: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Two kinds of error originsTrivial example: descent direction

1 f0 = f (x);

2 f1 = f (x + dx);

3

4 g = f1 - f0;

5

6 if ( g > 0 ) {

7 x -= dx;

8 } else {

9 x += dx;

10 }

round-o� errorsand

cancellation

unstable test

Numerical quality: an industrial case study on code_aster 13/22

Page 26: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of unstable branchesUsing code coverage tools: code_aster (test-case sdnl112a)

$ make CFLAGS="-fprofile-arcs -ftest-coverage"$ make check$ gcov *.c *.f

"standard" coverage "Verrou" coverage120:subroutine fun1(area, a1, a2, n)

-: implicit none-: integer :: n-: real(kind=8) :: area, a1, a2

120: if (a1 .eq. a2) then

13: area = a1

-: else

107: if (n .lt. 2) then

107: area = (a2-a1) / (log(a2)-log(a1))

###: else if (n .eq.2) then###: area = sqrt (a1*a2)

-: else###: ! ...-: endif-: endif

120:end subroutine

120:subroutine fun1(area, a1,...-: implicit none-: integer :: n-: real(kind=8) :: area,...

120: if (a1 .eq. a2) then

4: area = a1

-: else

116: if (n .lt. 2) then

116: area = (a2-a1)...

###: else if (n .eq.2)...###: area = sqrt (a...

-: else###: ! ...

-: endif-: endif

120:end subroutine

Numerical quality: an industrial case study on code_aster 14/22

Page 27: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of unstable branchesUsing code coverage tools: code_aster (test-case sdnl112a)

$ make CFLAGS="-fprofile-arcs -ftest-coverage"$ make check$ gcov *.c *.f

"standard" coverage "Verrou" coverage120:subroutine fun1(area, a1, a2, n)

-: implicit none-: integer :: n-: real(kind=8) :: area, a1, a2

120: if (a1 .eq. a2) then

13: area = a1

-: else

107: if (n .lt. 2) then

107: area = (a2-a1) / (log(a2)-log(a1))

###: else if (n .eq.2) then###: area = sqrt (a1*a2)

-: else###: ! ...-: endif-: endif

120:end subroutine

120:subroutine fun1(area, a1,...-: implicit none-: integer :: n-: real(kind=8) :: area,...

120: if (a1 .eq. a2) then

4: area = a1

-: else

116: if (n .lt. 2) then

116: area = (a2-a1)...

###: else if (n .eq.2)...###: area = sqrt (a...

-: else###: ! ...

-: endif-: endif

120:end subroutine

Numerical quality: an industrial case study on code_aster 14/22

Page 28: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of unstable branchesFormula correction

f (a, b) =

∣∣∣∣∣a if a = b

b−alog(b)−log(a) otherwise

http://herbie.uwplse.org/

Bits of error vs value of b

Sampling is not enoughNeed for more rigorous alternatives (static analysis?)

We have uncovered one counter-example → enough to test a correction

Numerical quality: an industrial case study on code_aster 15/22

Page 29: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of unstable branchesFormula correction

f (a, b) =

∣∣∣∣∣a if a = b

b−alog(b)−log(a) otherwise

−→f (a, b) =

∣∣∣∣∣∣

a if a = b

aba−1

log( ba )

otherwise

Empirical studyoutside the code (proxyapp)

around the problematicpoint

reference = intervalarithmetic

Prooferror bounded by 10 ulps

1e-14

1e-11

1e-08

1e-05

0.01

a=

fl( 4

.2080034963016440×

10−5)

0

2e-16

4e-16

−600 −400 −200 0 200 400 600

ulp2 ulp3 ulp

a=

fl( 4

.2080034963016440×

10−5)

relative

error

∣ ∣ ∣val fp−val int

val int

∣ ∣ ∣

Error on the computation of f(a, b) = b−alog(b)−log(a)

original formulaproposed formula

b− a [ulp]

Numerical quality: an industrial case study on code_aster 16/22

Page 30: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical quality: an industrial case study on code_aster 17/22

Locate (and �x)instabilities

1. Detect instabilities

2. Locate (and �x) instabilitiesunstable testsround-o� errors

3. Conclusions � perspectives

Page 31: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of round-o� errors accumulationsDelta-debugging

log.L .../aster.releasevolum2_ .../aster.releasebilpla_ .../aster.releaseecrval_ .../aster.releaseprint_plath_ .../aster.releaseclasser_groupes_ .../aster.releaseetupla_ .../aster.releasecouhyd_pi_ .../aster.releaseecrplr_ .../aster.releaseimovi_ .../aster.releaseresopt_ .../aster.releasegetgrp_marginal_ .../aster.releaseecrpla_ .../aster.releasefin_exec_main_ .../aster.releasedecopt_pi_ .../aster.releaseparaend_ .../aster.releaseresopt_cnt_zones_ .../aster.releaseapstop_ .../aster.releaseihyd_ .../aster.releaseimpression_info_ .../aster.releasecoupla_ .../aster.releasegere_print_plath_ .../aster.releaselog .../aster.releasethepla_ .../aster.releasecoutot_ .../aster.releaseiprit_ .../aster.release

Delta-Debugging [A. Zeller, 1999]

→ X

Inputs :I run scriptI comparison script

Output:I DDmax: failure inducing functions

Also works at the source linegranularity:

I if the code was compiled with -g

Numerical quality: an industrial case study on code_aster 18/22

Page 32: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of round-o� errors accumulationsDelta-debugging

# log.L .../aster.release# volum2_ .../aster.release# bilpla_ .../aster.release# ecrval_ .../aster.release# print_plath_ .../aster.release# classer_groupes_ .../aster.release# etupla_ .../aster.release# couhyd_pi_ .../aster.release# ecrplr_ .../aster.release# imovi_ .../aster.release# resopt_ .../aster.release# getgrp_marginal_ .../aster.release# ecrpla_ .../aster.release# fin_exec_main_ .../aster.release# decopt_pi_ .../aster.release# paraend_ .../aster.release# resopt_cnt_zones_ .../aster.release# apstop_ .../aster.release# ihyd_ .../aster.release# impression_info_ .../aster.release# coupla_ .../aster.release# gere_print_plath_ .../aster.release# log .../aster.release# thepla_ .../aster.release# coutot_ .../aster.release# iprit_ .../aster.release

Delta-Debugging [A. Zeller, 1999]

→ ×

Inputs :I run scriptI comparison script

Output:I DDmax: failure inducing functions

Also works at the source linegranularity:

I if the code was compiled with -g

Numerical quality: an industrial case study on code_aster 18/22

Page 33: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of round-o� errors accumulationsDelta-debugging

# log.L .../aster.release# volum2_ .../aster.release# bilpla_ .../aster.release# ecrval_ .../aster.release# print_plath_ .../aster.release# classer_groupes_ .../aster.release# etupla_ .../aster.release# couhyd_pi_ .../aster.release# ecrplr_ .../aster.release# imovi_ .../aster.release# resopt_ .../aster.release# getgrp_marginal_ .../aster.release# ecrpla_ .../aster.releasefin_exec_main_ .../aster.releasedecopt_pi_ .../aster.releaseparaend_ .../aster.releaseresopt_cnt_zones_ .../aster.releaseapstop_ .../aster.releaseihyd_ .../aster.releaseimpression_info_ .../aster.releasecoupla_ .../aster.releasegere_print_plath_ .../aster.releaselog .../aster.releasethepla_ .../aster.releasecoutot_ .../aster.releaseiprit_ .../aster.release

Delta-Debugging [A. Zeller, 1999]

→ ×

Inputs :I run scriptI comparison script

Output:I DDmax: failure inducing functions

Also works at the source linegranularity:

I if the code was compiled with -g

Numerical quality: an industrial case study on code_aster 18/22

Page 34: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of round-o� errors accumulationsDelta-debugging

# log.L .../aster.release# volum2_ .../aster.release# bilpla_ .../aster.release# ecrval_ .../aster.release# print_plath_ .../aster.release# classer_groupes_ .../aster.release# etupla_ .../aster.releasecouhyd_pi_ .../aster.releaseecrplr_ .../aster.releaseimovi_ .../aster.releaseresopt_ .../aster.releasegetgrp_marginal_ .../aster.releaseecrpla_ .../aster.releasefin_exec_main_ .../aster.releasedecopt_pi_ .../aster.releaseparaend_ .../aster.releaseresopt_cnt_zones_ .../aster.releaseapstop_ .../aster.releaseihyd_ .../aster.releaseimpression_info_ .../aster.releasecoupla_ .../aster.releasegere_print_plath_ .../aster.releaselog .../aster.releasethepla_ .../aster.releasecoutot_ .../aster.releaseiprit_ .../aster.release

Delta-Debugging [A. Zeller, 1999]

→ X

Inputs :I run scriptI comparison script

Output:I DDmax: failure inducing functions

Also works at the source linegranularity:

I if the code was compiled with -g

Numerical quality: an industrial case study on code_aster 18/22

Page 35: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of round-o� errors accumulationsDelta-debugging

log.L .../aster.releasevolum2_ .../aster.releasebilpla_ .../aster.releaseecrval_ .../aster.releaseprint_plath_ .../aster.releaseclasser_groupes_ .../aster.releaseetupla_ .../aster.release# couhyd_pi_ .../aster.release# ecrplr_ .../aster.release# imovi_ .../aster.release# resopt_ .../aster.release# getgrp_marginal_ .../aster.release# ecrpla_ .../aster.releasefin_exec_main_ .../aster.releasedecopt_pi_ .../aster.releaseparaend_ .../aster.releaseresopt_cnt_zones_ .../aster.releaseapstop_ .../aster.releaseihyd_ .../aster.releaseimpression_info_ .../aster.releasecoupla_ .../aster.releasegere_print_plath_ .../aster.releaselog .../aster.releasethepla_ .../aster.releasecoutot_ .../aster.releaseiprit_ .../aster.release

Delta-Debugging [A. Zeller, 1999]

→ ×

Inputs :I run scriptI comparison script

Output:I DDmax: failure inducing functions

Also works at the source linegranularity:

I if the code was compiled with -g

Numerical quality: an industrial case study on code_aster 18/22

Page 36: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of round-o� errors accumulationsDelta-debugging

log.L .../aster.releasevolum2_ .../aster.releasebilpla_ .../aster.releaseecrval_ .../aster.releaseprint_plath_ .../aster.releaseclasser_groupes_ .../aster.releaseetupla_ .../aster.release# couhyd_pi_ .../aster.releaseecrplr_ .../aster.releaseimovi_ .../aster.releaseresopt_ .../aster.releasegetgrp_marginal_ .../aster.releaseecrpla_ .../aster.releasefin_exec_main_ .../aster.release# decopt_pi_ .../aster.releaseparaend_ .../aster.releaseresopt_cnt_zones_ .../aster.releaseapstop_ .../aster.release# ihyd_ .../aster.releaseimpression_info_ .../aster.releasecoupla_ .../aster.releasegere_print_plath_ .../aster.releaselog .../aster.releasethepla_ .../aster.release# coutot_ .../aster.release# iprit_ .../aster.release

Delta-Debugging [A. Zeller, 1999]

Inputs :I run scriptI comparison script

Output:I DDmax: failure inducing functions

Also works at the source linegranularity:

I if the code was compiled with -g

Numerical quality: an industrial case study on code_aster 18/22

Page 37: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of round-o� errors accumulationsDelta-Debugging on code_aster (test-case sdnl112a)

2:20' run time =

(would Herbgrind be competitive?)

86 con�gurations

15 random rounding runs to validate

10s. per RR run (vs 4s. native)

do 60 jvec = 1, nbvectdo 30 k = 1, neq

vectmp(k)=vect(k,jvec)30 continue

if (prepos) call mrconl('DIVI', lmat, 0, 'R', vectmp,1)xsol(1,jvec)=xsol(1,jvec)+zr(jvalms-1+1)*vectmp(1)do 50 ilig = 2, neq

kdeb=smdi(ilig-1)+1kfin=smdi(ilig)-1do 40 ki = kdeb, kfin

jcol=smhc(ki)

xsol(ilig,jvec)=xsol(ilig,jvec) + zr(jvalmi-1+ki) * vectmp(jcol)

xsol(jcol,jvec)=xsol(jcol,jvec) + zr(jvalms-1+ki) * vectmp(ilig)

40 continue

xsol(ilig,jvec)=xsol(ilig,jvec) + zr(jvalms+kfin) * vectmp(ilig)

50 continueif (prepos) call mrconl('DIVI', lmat, 0, 'R', xsol(1, jvec),1)

60 continueNumerical quality: an industrial case study on code_aster 19/22

Page 38: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Localization of round-o� errors accumulationsDelta-Debugging on code_aster (test-case sdnl112a)

2:20' run time =

(would Herbgrind be competitive?)

86 con�gurations

15 random rounding runs to validate

10s. per RR run (vs 4s. native)

do 60 jvec = 1, nbvectdo 30 k = 1, neq

vectmp(k)=vect(k,jvec)30 continue

if (prepos) call mrconl('DIVI', lmat, 0, 'R', vectmp,1)xsol(1,jvec)=xsol(1,jvec)+zr(jvalms-1+1)*vectmp(1)do 50 ilig = 2, neq

kdeb=smdi(ilig-1)+1kfin=smdi(ilig)-1do 40 ki = kdeb, kfin

jcol=smhc(ki)

xsol(ilig,jvec)=xsol(ilig,jvec) + zr(jvalmi-1+ki) * vectmp(jcol)

xsol(jcol,jvec)=xsol(jcol,jvec) + zr(jvalms-1+ki) * vectmp(ilig)

40 continue

xsol(ilig,jvec)=xsol(ilig,jvec) + zr(jvalms+kfin) * vectmp(ilig)

50 continueif (prepos) call mrconl('DIVI', lmat, 0, 'R', xsol(1, jvec),1)

60 continue

Correction: compensated algorithms [Ogita, Rump, Oishi. 2005]I Sum2 is not enough

I Dot2 new

Numerical quality: an industrial case study on code_aster 19/22

Page 39: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Numerical quality: an industrial case study on code_aster 20/22

Conclusions �perspectives

1. Detect instabilities

2. Locate (and �x) instabilities

3. Conclusions � perspectives

Page 40: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

ConclusionsAccuracy quanti�cation after correction

sdnl112a

Status # common digitsVersion nearest rnd1 rnd2 rnd3 C (rnd1, rnd2, rnd3)

Before correction OK KO KO KO 6 6 6 * 3 0After correction OK OK OK OK 10 10 9 * 6 0

ConclusionsProblems hard to �nd, but easy to solve (for now!)

Work�ow for the analysis of industrial codes

First steps are a�ordable and could be automatized

Numerical quality: an industrial case study on code_aster 21/22

Page 41: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Perspectives

VerrouInter�op: common interface for Veri�carlo & Verrou (soon others!)

I share Monte-Carlo Arithmetic back-endsI improve performance of instrumentation front-ends

Handle mathematics library & co

MethodologyApply to other �elds

I optimization (electricity production planning)I multi-physics (severe nuclear accidents)

Correction steps should be further automatizedI would Herbgrind + Herbie help?I static analysis?

Numerical quality: an industrial case study on code_aster 22/22

Page 42: Numerical quality: an industrial case study on code aster · 2017. 7. 27. · [2]J.-L. Lamotte, J.-M. Chesneaux and F. Jézéquel, CADNA_C: A version of CADNA for use with C or C++

Thank you !

Questions ?

Get verrou on github :http://github.com/edf-hpc/verrou

Documentation :http://edf-hpc.github.io/verrou/vr-manual.html

Numerical quality: an industrial case study on code_aster 23