[petsc-users] Report progress to an external driver code

Barry Smith bsmith at mcs.anl.gov
Mon Nov 12 11:29:48 CST 2012

     If you are calling KSP directly you can write a custom monitor and set it with KSPMonitorSet(), similarly with SNES write a custom monitor and set it with SNESMonitorSet() or both. These monitors can do anything you like, print to a GUI, communicate via a unix socket to another process, etc.


   The logging stuff is really not intended for this purpose.

On Nov 12, 2012, at 4:50 AM, Dominik Szczerba <dominik at itis.ethz.ch> wrote:

> Hi,
> I need to report progress (0-100%, which I compute myself) of my Petsc
> solver code to an external driver code that is controlling my solver.
> I had a look at the many Petsc logging functions and examples but I am
> still not sure which way to go. I tried PetscLogStage, but it does not
> seem to display any information during the execution, and I also do
> not see a way this information could be sent somewhere and accessed by
> e.g. registering a custom (static) function used to inform the
> downstream code what the solver is doing at the moment. The most
> trivial solution that I have found is to output a message like [STATUS
> 50%], which could be intercepted in the downstream code by overwriting
> PetscVFPrintf, but it sounds rather inelegant. I would be very glad to
> receive some pointers where to start looking.
> Regards,
> Dominik

More information about the petsc-users mailing list