error checking macros with optimization

Matthew Knepley knepley at gmail.com
Fri Nov 23 09:32:10 CST 2007


On Nov 23, 2007 10:25 AM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> I would to propose some changes to error checking macros for optimized builds.
>
> 1.- SETERRQXXX: define them as
>
> #define SETERRQ[1|2|..](ierr,...)   return ierr

I think this is fine. However for it to matter, you need 2.

> 2.- CHKERRQ: define them as
>
> #define CHKERRQ(ierr)  if (ierr) return ierr
>
> For (1), it should be no performace impact. For (2), the extra check
> at almost every line of PETSc source code could impact performace, but
> any of you have a clear idea of how much?

This is a big problem because it completely blows the pipeline and disrupts
speculative execution (unless you always guess correctly). We could try
testing it, but someone will always complain. Optimized is supposed to be
as fast as possible, and this will be slower.

   Matt

> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
>
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener




More information about the petsc-dev mailing list