[petsc-users] petsc4py and python's logging module

Matthew Knepley knepley at gmail.com
Mon May 29 14:30:39 CDT 2017


On Mon, May 29, 2017 at 11:17 AM, David Nolte <dnolte at dim.uchile.cl> wrote:

> Dear all,
>
> is it possible to use python's logging module
> (https://docs.python.org/2/howto/logging.html) to handle PETSc output in
> python, such as the residuals during a KSP/SNES solve?
> I log my solver's activity to a file using the logging module, it would
> be great to include the PETSc output aswell.
>

I think the best way to do this is the following:

  1) Create a PetscViewer implementation, say PyASCII, that logs to the
Python descriptor. This might be as easy as
      just augmenting the ASCII viewer to grab this descriptor on creation

  2) Then you can hook this viewer to the monitor using options

      -ksp_monitor pyascii

  Thanks,

     Matt


> Regards,
> David
>
>


-- 
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

http://www.caam.rice.edu/~mk51/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170529/e7ff912d/attachment.html>


More information about the petsc-users mailing list