PETSc error logging

Issue #801 new
Jan Blechta created an issue

Pull request #289 tried to improve PETSc error logging but it turned up as rather wrong solution.

It showed up that PyDOLFIN did not usually print tracebacks because petsc4py installs its own error handler which is not called from DOLFIN. The default PetscTracebackErrorHandler can be easily reinstalled by

from dolfin import *

SubSystemsManager.init_petsc()
from petsc4py import PETSc
PETSc.pushErrorHandler("traceback")

The goal is to provide consistent error logging for C++ and Python both when affected or not by petsc4py. Partial goals are:

  1. decide whether to use petsc4py error handler in DOLFIN, circumvent (uninstall) it when detected, or do not touch it and keep responsibility on user.

  2. exception awareness. PetscTracebackErrorHandler provides useful output but cannot be silenced by catching the exception. (This is what petsc4py error handler does.) On Python side we could ensure this by sticking to petsc4py error handler but we would need to write our own for C++ DOLFIN or Py DOLFIN without petsc4py.

Comments (3)

  1. Log in to comment