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

Patrick Sanan patrick.sanan at gmail.com
Wed Dec 3 19:26:48 CST 2014


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?

-Patrick



More information about the petsc-users mailing list