[petsc-dev] default SNES rtol for single precision builds

Barry Smith bsmith at mcs.anl.gov
Mon Sep 19 12:59:50 CDT 2011


  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?

   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