Elsevier Science Home
Computer Physics Communications Program Library
Full text online from Science Direct
Programs in Physics & Physical Chemistry
CPC Home

[Licence| Download | New Version Template] aegq_v1_0.tar.gz(694 Kbytes)
Manuscript Title: CADNA_C: a version of CADNA for use with C or C++ programs
Authors: Jean-Luc Lamotte, Jean-Marie Chesneaux, Fabienne Jézéquel
Program title: CADNA_C
Catalogue identifier: AEGQ_v1_0
Distribution format: tar.gz
Journal reference: Comput. Phys. Commun. 181(2010)1925
Programming language: C++.
Computer: PC running LINUX with an i686 or an ia64 processor, UNIX workstations including SUN, IBM.
Operating system: LINUX, UNIX.
Keywords: CADNA, CESTAC method, Discrete Stochastic Arithmetic, floating-point arithmetic, numerical validation, round-off errors.
PACS: 02.70.-c.
Classification: 6.5.

Does the new version supersede the previous version?: No

Nature of problem:
A simulation program which uses floating-point arithmetic generates round-off errors, due to the rounding performed at each assignment and at each arithmetic operation. Round-off error propagation may invalidate the result of a program. The CADNA library enables one to estimate round-off error propagation in any simulation program and to detect all numerical instabilities that may occur at run time.

Solution method:
The CADNA library [1-3] implements Discrete Stochastic Arithmetic [4,5] which is based on a probabilistic model of round-off errors. The program is run several times with a random rounding mode generating different results each time. From this set of results, CADNA estimates the number of exact significant digits in the result that would have been computed with standard floating-point arithmetic.

Reasons for new version:
The previous version (AEAT_v1_0) enables the estimation of round-off error propagation in Fortran programs [2]. The new version has been developed to enable this estimation in C or C++ programs.

Summary of revisions:
The CADNA_C source code consists of one assembly language file (cadna_rounding.s) and twenty-three C++ language files (including three header files). cadna_rounding.s is a symbolic link to the assembly file corresponding to the processor and the C++ compiler used. This assembly file contains routines which are frequently called in the CADNA_C C++ files to change the rounding mode. The C++ language files contain the definition of the stochastic types on which the control of accuracy can be performed, CADNA_C specific functions (for instance to enable or disable the detection of numerical instabilities), the definition of arithmetic and relational operators which are overloaded for stochastic variables and the definition of mathematical functions which can be used with stochastic arguments. As a remark, on 64-bit processors, the mathematical library associated with the GNU C++ compiler may provide incorrect results or generate severe bugs with rounding towards -∞ and +∞, which the random rounding mode is based on. Therefore, if CADNA_C is used on a 64-bit processor with the GNU C++ compiler, mathematical functions are computed with rounding to the nearest, otherwise they are computed with the random rounding mode. It must be pointed out that the knowledge of the accuracy of the argument of a mathematical function is never lost.

Additional comments:
In the library archive, users are advised to read the INSTALL file first. The doc directory contains a user guide named ug.cadna.pdf and a reference guide named, ref_cadna.pdf. The user guide shows how to control the numerical accuracy of a program using CADNA, provides installation instructions and describes test runs.The reference guide briefly describes each function of the library. The source code (which consists of C++ and assembly files) is located in the src directory. The examples directory contains seven test runs which illustrate the use of the CADNA library and the benefits of Discrete Stochastic Arithmetic.

Running time:
The version of a code which uses CADNA runs at least three times slower than its floating-point version. This cost depends on the computer architecture and can be higher if the detection of numerical instabilities is enabled. In this case, the cost may be related to the number of instabilities detected.

References:
[1] The CADNA library, URL address: http://www.lip6.fr/cadna
[2] F. Jézéquel, J.-M. Chesneaux, CADNA: a library for estimating round-off error propagation, Comput. Phys. Commun., 178(12), 2008, pp. 933-955.
[3] N.S. Scott, F. Jézéquel, C. Denis, J.-M. Chesneaux, Numerical 'health check' for scientific codes: the CADNA approach, Comput. Phys. Commun., 176(8), 2007, pp. 507-521.
[4] J. Vignes, A stochastic arithmetic for reliable scientific computation, Math. and Comp. in Sim. 35, 1993, pp. 233-261.
[5] J. Vignes, Discrete Stochastic Arithmetic for Validating Results of Numerical Software, Num. Algo. 37, 2004, pp. 377-390.