[petsc-users] tfqmr true residual norm monitoring

Алексей Рязанов amryazanov at gmail.com
Sat Jul 16 16:58:30 CDT 2011


Thank You very much! I don't know Why I was avoiding the ownprecond variant.
May be just was scared to try. I think I'll use it. I also could just set
the maximum number of iterations and watch the -ksp_monitor_true_residual,
but it's not so convinient. Thank You!

2011/7/17 Barry Smith <bsmith at mcs.anl.gov>

>
> On Jul 16, 2011, at 4:55 AM, Алексей Рязанов wrote:
>
> > Hi, Im solving a linear system with different methods for comparison
> goals.
> > And I want to make Krylov iterative methods work until they reach the
> predefined value of the TRUE residual norm.
> > So Im setting up tolerances (in fact only atol) with
> KSPSetTolerances(KSP, 1.e-50, 1.e-10, PETSC_DEFAULT, PETSC_DEFAULT) and
> watching for -ksp_monitor (or -ksp_monitor_true_residual).
> > By default most of methods monitor their preconditioned residual norm and
> stop working then the preconditioned residual norm reaches the predefined
> value.
> > That of course doesn't mean true residual norm also reached the value.
> >
> >
> > So I need to change this behavior and use KSPSetNormType(KSP,
> KSP_NORM_UNPRECONDITIONED) to use unpreconditioned residual or
> KSPSetPreconditionerSide(KSP, PC_RIGHT) to make preconditioned residual be
> the same as unpreconditioned and achieve my goal anyway.
> >
> > So what I have:
> >
> >
> > 1)
> > KSPSetNormType(KSP, KSP_NORM_UNPRECONDITIONED) is only supported by CG,
> RICHARDSON AND CHEBYCHEV (a said in user manual).
> > So as it is expected, CG, RICHARDSON AND CHEBYCHEV print error message:
> "No right preconditioning for KSPCG, KSPRICHARDSON, KSPCHEBYCHEV!" and work
>  great with KSPSetNormType(KSP, KSP_NORM_UNPRECONDITIONED)
> > Great!
> >
> > 2)
> > Practically the same behavior does KSPLSQR (except the great work,
> actually it doesn't work at all with my linear system, but I don't care
> about lsqr)
> > So it's ok.
> >
> >
> > 3)
> > KSPBCGS and KSPBICG don't support right preconditioning, so their true
> residual norm values cant be set as the finish point for iterating.
> > Am I right?
>
>     Actually in petsc-dev
> http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html KSPBCGS does
> support both left and right preconditioning. KSPBICG is coded only for left
> preconditioning
> >
> >
> > 4)
> > KSPGMRES print error message: "Use right preconditioning -ksp_right_pc if
> want unpreconditioned norm", when I use it with KSPSetNormType(KSP,
> KSP_NORM_UNPRECONDITIONED).
> > And works great with  KSPSetPreconditionerSide(KSP, PC_RIGHT).
> > As expected.
> >
> > 5)
> > KSPCGS prints no error, when I use it with KSPSetNormType(KSP,
> KSP_NORM_UNPRECONDITIONED) and works with preconditioned norm.
> > And works great with  KSPSetPreconditionerSide(KSP, PC_RIGHT).
> > So it's ok.
> >
> > 6)
> > KSPTFQMR and KSPTCQMR print no errors with any settings and works with
> preconditioned norm.
> > Is there any methods to make KSPTFQMR use unpreconditioned norm or right
> preconditioning?
>
>    These two algorithms actually do work with both left and right
> preconditioner but they are different than all the other methods in that:
>
>    The "residual norm" computed in this algorithm is actually just an upper
> bound on the actual residual norm.
>          That is for left preconditioning it is a bound on the
> preconditioned residual and for right preconditioning
>          it is a bound on the true residual.
>
>    I have added this information to their manual pages in petsc-dev for
> clarity.
>
>     Note that our GMRES is implemented only with left preconditioning and
> preconditioned residual norm but you can use the FGMRES which is implemented
> only for right preconditioning and the true residual norm for testing.
>
>
>    If you not particularly interested in speed and just want the iterations
> to stop when the true residual norm reaches some tolerance you can easily
> provide your own KSPConvergedTest() by calling KSPSetConvergenceTest() and
> writing a routine that calls KSPBuildResidual() (which always builds the
> true residual) and compute the norm of the result.
>
>    Barry
>
>
> >
> >
> > Please help me to understand situations 3) and 6)
> >
> > Thank in advance!
> >
> > --
> > Best regards,
> > Alexey Ryazanov
> > ______________________________________
> > Nuclear Safety Institute of Russian Academy of Sciences
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110717/7ee3643b/attachment.htm>


More information about the petsc-users mailing list