[petsc-users] Dumping KSP solve information to a file

Barry Smith bsmith at mcs.anl.gov
Wed Dec 3 21:07:47 CST 2014


> On Dec 3, 2014, at 9:04 PM, Patrick Sanan <patrick.sanan at gmail.com> wrote:
> 
> 
> 
> 
> 
>> Il giorno Dec 4, 2014, alle ore 11:49 AM, Barry Smith <bsmith at mcs.anl.gov> ha scritto:
>> 
>> 
>>> On Dec 3, 2014, at 7:26 PM, Patrick Sanan <patrick.sanan at gmail.com> wrote:
>>> 
>>> I'd like to be able to obtain and process post-solve information about KSP solves, after a PETSc application has run.  Specifically, I would like the information produced by -ksp_converged_reason, as well as the final residual norm, to be available as a file for post-processing.
>>> 
>>> A direct approach is to modify the application source, adding my own code invoking KSPGetIterationNumber(), KSPGetConvergedReason(), KSPGetResidualNorm(), etc. to the source, and producing the required output with an ASCII viewer.
>>> 
>>> However, it'd be more convenient to be able to obtain the required information without modifying the application source. An inelegant and potentially fragile approach is to provide flags like -ksp_converged_reason, -ksp_monitor, etc. and write a script to extract the required information from what is dumped to stdout.
>>> 
>>> My first thought on how to do things properly is to link in my own custom KSP viewer; should that be a viable approach? Is there a simpler/better method?
>> 
>> We have ways to add your own monitor with KSPMonitorSet() but for viewer basically you would just write your own viewer function and then call it directly.
>> 
> Ok- thats what Im essentially doing now, but (if I understand you correctly) this still involves modifying the source of the application I want to analyze - I was wondering how easy it would be to write my own viewer, link it in when I compile my application,

   You can do this part.

> and then supply a command line option to invoke it at runtime.

   We don't have a way of registering new viewers at run time.

  Barry

> 
>> Barry
>> 
>>> 
>>> -Patrick



More information about the petsc-users mailing list