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

Dominik Szczerba dominik at itis.ethz.ch
Tue Nov 13 06:21:14 CST 2012

Thanks a lot for your suggestion.
No I did not mean just KSP progress, but the overall progress from my solver.
I have solved it now by offering a custom function pointer that the
downstream user can provide. This function is then called several
times during the computation and calculates the overall progress.


On Mon, Nov 12, 2012 at 6:29 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>      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.
>    Barry
>    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