<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 4, 2015 at 6:20 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
  My first reaction to this was "man that is ugly and cumbersome, I can do it much cleaner than that"; turns out it isn't as simple as I thought but with a couple of macros I think I've incorporated much of what is needed in<br>
<br>
<a href="https://bitbucket.org/petsc/petsc/pull-request/315/propagating-solver-errors-instead-of/diff" target="_blank">https://bitbucket.org/petsc/petsc/pull-request/315/propagating-solver-errors-instead-of/diff</a><br>
<br>
some work needs to be done on getting the most appropriate SNES converged reason set. In fact one could argue that trying to pass the converged reason up as a single enum type may not be the best model since there may be more information that one wishes to convey such as function domain error that happened while differencing the function with coloring to compute the Jacobian.<br>
<br>
  Anyways in particular look at the test example ex69.c</blockquote><div><br></div><div>I like this idea that we switch interpretation of some conditions from error to snafu. This is exactly what Patrick was asking</div><div>for in SNESComposite and I think its what most people want.</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"><span class="HOEnZb"><font color="#888888"><br>
  Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On May 1, 2015, at 10:52 PM, Dmitry Karpeyev <<a href="mailto:dkarpeev@gmail.com">dkarpeev@gmail.com</a>> wrote:<br>
><br>
> Here's the first crack at it: <a href="https://bitbucket.org/petsc/petsc/branch/karpeev/ksp-diverged-on-matmult-nanorinf" target="_blank">https://bitbucket.org/petsc/petsc/branch/karpeev/ksp-diverged-on-matmult-nanorinf</a>.<br>
> Messier than I had expected (GMRES only for now).<br>
><br>
> On Fri, May 1, 2015 at 8:06 PM Dmitry Karpeyev <<a href="mailto:dkarpeev@gmail.com">dkarpeev@gmail.com</a>> wrote:<br>
> On Fri, May 1, 2015 at 7:32 PM Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
> > On May 1, 2015, at 6:43 PM, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br>
> ><br>
> > Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> writes:<br>
> >>   1) This simplifies the needed code since we won't need to put<br>
> >>   checks all over the place on returns about failure nor do we need<br>
> >>   to worry about propagating errors from one process to another<br>
> >>   (since the Nan/Inf get moved by the MPI_Allreduce()).<br>
> ><br>
> > My concern is that -fp_trap will become a lot less useful.<br>
><br>
>   I agree there is a tradeoff; but under "normal" circumstances where there are no Nan or Inf around (which I think is most of the time) -fp_trap will be just as useful as now. For the other cases the user will have to have some idea where (and when) in the code to turn on the trapping to catch the "true" problems.<br>
><br>
>    Barry<br>
><br>
>   The only other way I see to do it is carry a validity flag around with each vector and reduce that flag in all the vector reductions; but this alone is not enough we would also have to have some propagation code for things like zero pivot, for example setting a validity flag in the Mat factor (saying the factor is not valid) and propagating up those flags. We get all these things "for free" with the Inf Nan approach.<br>
> There is an additional benefit: the validity flag would have to be cleared by the caller to avoid "false positives" on subsequent calls.  That's an opportunity for bugs.  With NaN the "error condition" (i.e., the NaN entry) gets cleared automatically by a subsequent successful vector operation.<br>
><br>
><br>
> What exactly caused the NaN would have to be signaled "out-of-band" as the saying goes. One way to "signal" it is by the code path that led to the error condition: that's why calling through KSP_MatMult() is useful.  It's not ideal, but covers the cases of immediate interest.<br>
> Dmitry.<br>
><br>
> ><br>
><br>
<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>