<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 25, 2015 at 12:13 PM, Mark Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 22, 2015 at 10:39 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><br>
> On Aug 22, 2015, at 9:26 PM, Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:<br>
><br>
> Good point.  I can not see any reason to use the initial guess for the eigen estimate.<br>
<br>
</span>   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 ...<br></blockquote><div><br></div><div>I've not looked at it, and it would be hard to because it is not a well defined problem.  But, if the initial guess is low frequency then it will give a poor estimate for the highest eigen value.  It is not clear to me what the relationship is, generally, of an initial guess and the solution, spectrally.  Initial guesses will change as the problem evolves but we don't update the eigen estimates.  If the user's initial guess happens to be zero then god knows what happens. (This is actually the case for the XGC1 code!!!)  It adds one more variable in debugging AMG, which is hard enough as it is.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span><br>
>  I would vote for (1).<br>
><br>
> Also, I hope cheb->random is the default.<br>
<br>
</span>   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 :-)<br></blockquote><div><br></div><div>We can use the determinate random number that I added to GAMG (eg, v(i) = ((double)(gid(i)*51)%100) - 50.)/50.</div></div></div></div></blockquote><div><br></div><div>Wait, why are you doing this? Why not just create a PetscRandom and set the seed?</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span><br>
>  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.<br>
<br>
</span>   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<br></blockquote><div><br></div><div>Too complicated for little gain, or loss even, and requires a reduction.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span><br>
>  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.<br>
<br>
</span>   Good point, the KSPChebyshevComputeExtremeEigenvalues_Private() routine should check that n returned from  KSPGetIterationNumber() is not zero etc.<br>
<span><font color="#888888"><br>
  Barry<br></font></span></blockquote><div><br></div><div>So I think we should:</div><div><br></div><div>1) set the initial guess with my new sort of random number (we don't need good quality random number here)</div><div>2) add the check for DIVERGE_ITS, or something, in KSPChebyshevComputeExtremeEigenvalues_Private.  Should it stop?  Probably.</div><div><br></div><div>Mark</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><font color="#888888">
</font></span><div><div><br>
><br>
> I can do this.<br>
><br>
> Mark<br>
><br>
><br>
><br>
> On Sat, Aug 22, 2015 at 6:35 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
>    From KSPSolve_Chebyshev()<br>
><br>
>      X = ksp->work[0];<br>
>       if (cheb->random) {<br>
>         B    = ksp->work[1];<br>
>         ierr = VecSetRandom(B,cheb->random);CHKERRQ(ierr);<br>
>       } else {<br>
>         B = ksp->vec_rhs;<br>
>       }<br>
>       ierr = KSPSolve(cheb->kspest,B,X);CHKERRQ(ierr);<br>
><br>
>       if (ksp->guess_zero) {<br>
>         ierr = VecZeroEntries(X);CHKERRQ(ierr);<br>
>       }<br>
>       ierr = KSPChebyshevComputeExtremeEigenvalues_Private(cheb->kspest,&min,&max);CHKERRQ(ierr);<br>
><br>
>    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?<br>
><br>
>    Shouldn't the code either<br>
><br>
> 1) zero X = ksp->work[0] everytime BEFORE the KSPSolve() or<br>
> 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?<br>
><br>
>   Barry<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>