[petsc-users] Dumping KSP solve information to a file
Barry Smith
bsmith at mcs.anl.gov
Wed Dec 3 20:49:53 CST 2014
> 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.
Barry
>
> -Patrick
>
More information about the petsc-users
mailing list