[petsc-dev] [petsc-users] Bug in pc_right + nonzero initial guess + {tfqmr, tcqmr, cgs}

Barry Smith bsmith at mcs.anl.gov
Wed Mar 28 22:27:50 CDT 2012


   From KSPSolve_BCGS() 

  /* Compute initial preconditioned residual */
  ierr = KSPInitialResidual(ksp,X,V,T,R,B);CHKERRQ(ierr);

  /* with right preconditioning need to save initial guess to add to final solution */
  if (ksp->pc_side == PC_RIGHT && !ksp->guess_zero) {
    if (!bcgs->guess) {
      ierr = VecDuplicate(X,&bcgs->guess);CHKERRQ(ierr);
    }
    ierr = VecCopy(X,bcgs->guess);CHKERRQ(ierr);
    ierr = VecSet(X,0.0);CHKERRQ(ierr);
  }

   Thus in the right preconditioned, non-zero initial guess case it never computes the original norm of b so the convergence test is "different"; for example if the initial guess is really really good the convergence test doesn't know this so will iterate normally more than one would likely want.  We can fix this by computing the norm of b (when using the default convergence test) at the beginning passing it to the convergence test and then pass the || r|| norm to the convergence test but then that is like iteration 1/2.. Do we need to change the handling of the default convergence test to "eliminate" this 1/2 iteration?

  In answer to how to fix the other methods: 

   I'm thinking maybe this storage of the initial guess, computing first residual, zeroing of solution and addition back on at the end of the solve should be embedded in the KSPInitialResidual() and KSPUnwindPreconditioner() routines.   And it could be done perhaps in a more systematic way; for example GMRES does not use the paradigm of bcgs (and the others when we fix them) of simply removing the non-zero guess and changing the right hand side; should we change it?


  Barry


On Mar 13, 2012, at 7:47 AM, Jed Brown wrote:

> On Sun, Mar 11, 2012 at 00:38, Tobin Isaac <tisaac at ices.utexas.edu> wrote:
> 
> Hi,
> 
> The changes made to bcgs in the commit below should be applied to
> tfqmr, tcqmr, and cgs as well.
> 
> Toby, thanks for hunting this down. Barry, do you think we can reasonably share code between these implementations (and any others that might need it)?
>  
> 
> Cheers,
> Toby
> 
> author  Barry Smith bsmith at mcs.anl.gov
>  Wed, 19 Jan 2011 20:10:29 -0600 (13 months ago)
> changeset 18159 a526acdfdc95
> parent 18153  3c53022524fb
> child 18160   4db6569c26af
> 
> fixed KSPBCGS to work with right preconditioning and nonzero initial
> guess
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> 
> iEYEARECAAYFAk9cSIAACgkQk/TrNolnueUqMQCcD9gSdldhOY14sIFpwEC4nhpD
> pTEAniP556Lh3+5MgYB9cTUzHj7I4jg5
> =FvoR
> -----END PGP SIGNATURE-----
> 
> 




More information about the petsc-dev mailing list