[petsc-dev] strangness in Chebyshev estimate of eigenvalues

Barry Smith bsmith at mcs.anl.gov
Sat Aug 22 21:39:13 CDT 2015


> On Aug 22, 2015, at 9:26 PM, Mark Adams <mfadams at lbl.gov> wrote:
> 
> Good point.  I can not see any reason to use the initial guess for the eigen estimate.

   Why not, won't it better select for the eigen space actually seen by the linear solver since the linear solver starts with that guess? I am just making this up because I haven't looked how the initial guess affects eigenanalysis for Chebyshev  it but ...

>  I would vote for (1).
> 
> Also, I hope cheb->random is the default.

   Well then different machines will produce different convergence histories which is annoying for any kind of "no change" daily testing. Except for you, most of the rest of us don't like the random default, sorry :-)

>  One of my apps uses a zero RHS for the first solve, just because they did not care about adding some logic like: if (.not. first_solve) solve()  Using a zero RHS would be catastrophic.

   There code be a check that rhs norm is zero (cost of a global reduction?) and then use a nonzero initial guess to do the eigenanalysis

>  I trust this is true, because the code works, but we should make sure.  And perhaps Cheby should check that that KSPSolve did all of its iterations (ie, DIVERGE_ITS, or whatever).  Getting this wrong leads to silent errors that are a pain to debug.

   Good point, the KSPChebyshevComputeExtremeEigenvalues_Private() routine should check that n returned from  KSPGetIterationNumber() is not zero etc.

  Barry

> 
> I can do this.
> 
> Mark
> 
> 
> 
> On Sat, Aug 22, 2015 at 6:35 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
>    From KSPSolve_Chebyshev()
> 
>      X = ksp->work[0];
>       if (cheb->random) {
>         B    = ksp->work[1];
>         ierr = VecSetRandom(B,cheb->random);CHKERRQ(ierr);
>       } else {
>         B = ksp->vec_rhs;
>       }
>       ierr = KSPSolve(cheb->kspest,B,X);CHKERRQ(ierr);
> 
>       if (ksp->guess_zero) {
>         ierr = VecZeroEntries(X);CHKERRQ(ierr);
>       }
>       ierr = KSPChebyshevComputeExtremeEigenvalues_Private(cheb->kspest,&min,&max);CHKERRQ(ierr);
> 
>    This seems to do strange stuff with the initial guess for the eigenanalysis. ksp->work[0] is a work vector used within the Chebyshev algorithm, so at this point in the code it will have just whatever stuff it had in it from a previous Chebyshev solver or a zero the first time through. It seems bad to use this vector as the initial guess for estimator. Then AFTER the KSPSolve() it zeros  ksp->work[0], sometimes? If the original system being solved has zero initial guess, even though the values in X will not be used again. WTF?
> 
>    Shouldn't the code either
> 
> 1) zero X = ksp->work[0] everytime BEFORE the KSPSolve() or
> 2) zero X if ksp->guess_zero and otherwise copy into X the initial guess vec_sol from the caller before computing the eigenvalues to use that initial guess in estimating the eigenvalues?
> 
>   Barry
> 
> 




More information about the petsc-dev mailing list