[petsc-users] PC Shell Left, Right, Symm?

Barry Smith bsmith at mcs.anl.gov
Sat Feb 5 16:27:34 CST 2011


On Feb 5, 2011, at 3:54 PM, Robert Ellis wrote:

> Hello Experts,
>  
> When using a KSP Shell PreConditioner, is the LEFT, RIGHT, SYMMETRIC option applicable?
>  
>       call KSPGetPC(ksp,pc,ierr)
>       call PCSetType(pc,PCSHELL,ierr)
>       call KSPSetPreconditionerSide(ksp,PC_SYMMETRIC,ierr)
>       call PCShellSetApply(pc,JacobiShellPCApply,ierr)
>  
> The JacobiShellPCApply PreConditioner improves convergence considerably on my KSPCG problem. However, I have found empirically that using PC_LEFT, PC_RIGHT, PC_SYMMETRIC seems to have no effect on the convergence of the solution. Can anyone explain this unusual situation?

1) Based on the call call KSPSetPreconditionerSide(ksp,PC_SYMMETRIC,ierr) above you are correctly trying to set it to use symmetric preconditioning but it must be overwritten later because our CG doesn't have symmetric (or even right preconditioning implemented) so it would generate an error message when it tries to use it. If you run with -ksp_view it will show the side being used. Perhaps the ksp in the code fragment above is not the ksp being used in your linear solve?

2) When left or right preconditioning is being used by the Krylov method the PC object doesn't know or care, it just applies the preconditioner, in this case your JacobiShellPCApply() routine. When PC_SYMMETRIC is used the application of the preconditioner is "split" into two parts, the application of the left part and the right part, symbolically as   Bleft * A * Bright. This does not mean that the PCApply() is simply called twice once to apply the right part and once to apply the left part instead PCApplySymmetricRight() is called and then PCApplySymmetricLeft(). For example, if one wished to use symmetric ICC incomplete Cholesky preconditioning then these two operators are transposes of each other. Thus there should be two additional functions PCShellSetApplySymmetricRight() and PCShellSetApplySymmetricRight() allowing you to provide the two functions. PETSc doesn't currently have these but they could be trivially added.  However since our Krylov methods are not even implemented for symmetric application of the preconditioner it wouldn't help you.

If you use the GMRES method (just to check) you can switch the preconditioning to either side and you will see different convergence behavior.

In my experience using left or right preconditioning doesn't really matter much, but there are some people who swear that one is better than the other; and different people believe different things.

BTW: With PETSc's CG you can base your convergence test on either the preconditioned or nonpreconditioned residual norm this is controlled with KSPSetNormType()

   Barry


>  
> Thanks in advance for any help.
> Cheers,
> Rob



More information about the petsc-users mailing list