2011/8/27 ??????? ??????? <ram at ibrae.ac.ru> > So. All memory and time issues appeared because of my KSPConvergedTest > function, which calls KSPBuildResidual to monitor true > residual. KSPBuildResidual incorrectly works with memory. As soon as I've > commented the line with KSPBuildResidual, all troubles gone. So now I use > default monitor and have to monitor preconditioned residual. This is > inconvenient for me, but I cant figure out, how can I set up using true > monitor for all methods without any memory or performance leaks. I'll try to > get used t deal with preconditioned norm.
1. You can actually run the Krylov method with unpreconditioned residuals by using -ksp_right_pc (some output is inconsistent with 3.1 this way, it's fixed in petsc-dev and you can just use -ksp_norm_type unpreconditioned). This is inexpensive and does the right thing. 2. You can run the Krylov method in the preconditioned norm, but monitor the true residual using -ksp_monitor_true_residual. The code is in src/ksp/ksp/interface/iterativ.c KSPMonitorTrueResidualNorm(). You can also use this code as a template to make a similar custom monitor without memory leaks. This calls KSPBuildResidual() which is very expensive for GMRES, but is cheap for some other methods (including GCR which is closely related). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110827/4c1752d4/attachment-0001.htm>
