[petsc-dev] default SNES rtol for single precision builds
Jose E. Roman
jroman at dsic.upv.es
Tue Sep 20 02:53:20 CDT 2011
El 19/09/2011, a las 19:59, Barry Smith escribió:
>
> In petscmath.h we have
>
> #if defined(PETSC_USE_REAL_SINGLE)
> #if defined(MAXFLOAT)
> # define PETSC_MAX_REAL MAXFLOAT
> #else
> # define PETSC_MAX_REAL 1.e30
> #endif
> # define PETSC_MIN_REAL -PETSC_MAX_REAL
> # define PETSC_MACHINE_EPSILON 1.e-7
> # define PETSC_SQRT_MACHINE_EPSILON 3.e-4
> # define PETSC_SMALL 1.e-5
> #elif defined(PETSC_USE_REAL_DOUBLE)
> # define PETSC_MAX_REAL 1.e300
> # define PETSC_MIN_REAL -PETSC_MAX_REAL
> # define PETSC_MACHINE_EPSILON 1.e-14
> # define PETSC_SQRT_MACHINE_EPSILON 1.e-7
> # define PETSC_SMALL 1.e-10
> #elif defined(PETSC_USE_REAL_LONG_DOUBLE)
> # define PETSC_MAX_REAL 1.e4900L
> # define PETSC_MIN_REAL -PETSC_MAX_REAL
> # define PETSC_MACHINE_EPSILON 1.e-18
> # define PETSC_SQRT_MACHINE_EPSILON 1.e-9
> # define PETSC_SMALL 1.e-13
> #elif defined(PETSC_USE_REAL___FLOAT128)
> # define PETSC_MAX_REAL FLT128_MAX
> # define PETSC_MIN_REAL -FLT128_MAX
> # define PETSC_MACHINE_EPSILON FLT128_EPSILON
> # define PETSC_SQRT_MACHINE_EPSILON 1.38777878078e-17
> # define PETSC_SMALL 1.e-20
> #endif
>
> these are a bit ad-hoc and there maybe more items we wish to add. If possible we could try to use values here to set the various default tolerances we have in various places
>
> In particular the e-8 for SNES is very ad-hoc and has no justification, I originally used that number because I wanted something smaller than what we use for KSP but not too small. Does anybody have suggestions for a self-consistent justified set of rules for defining all our default tolerances?
Could use precision-independent expressions, such as
rtol_KSP = PETSC_SQRT_MACHINE_EPSILON
rtol_SNES = 0.1*PETSC_SQRT_MACHINE_EPSILON
but I don't have a justification why these values and not others.
By the way, it always seemed strange to me that PETSC_MACHINE_EPSILON (in double) is defined to be 1.e-14 instead of the actual IEEE value 1.11022e-16 (or 2.22045e-16). Its square root is 1.0537e-08.
Also, it could be possible to set these values by calling Lapack's _lamch at configure.
Jose
>
> Barry
>
>
> On Sep 19, 2011, at 12:27 PM, Lisandro Dalcin wrote:
>
>> After debugging a failing petsc4py testcase using single precision
>> builds, I realized the default SNES relative tolerance is 1e-8. What
>> should we do?
>>
>> --
>> Lisandro Dalcin
>> ---------------
>> CIMEC (INTEC/CONICET-UNL)
>> Predio CONICET-Santa Fe
>> Colectora RN 168 Km 472, Paraje El Pozo
>> 3000 Santa Fe, Argentina
>> Tel: +54-342-4511594 (ext 1011)
>> Tel/Fax: +54-342-4511169
>
More information about the petsc-dev
mailing list