<div dir="ltr">Thank you, I will try BCGSL.<div><br></div><div>And good to know that this is worth pursuing, and that it is possible. Step 1, I guess I should upgrade to the latest release on Petsc. </div><div><br></div><div>How can I make sure that I am "using an MPI that follows the suggestion for implementers about determinism"? I am using MPICH version 3.3a2.</div><div><br></div><div>I am pretty sure that I'm assembling the same matrix every time, but I'm not sure how it would depend on 'how you do the communication'. Each process is doing a series of MatSetValues with INSERT_VALUES, assembling the matrix by rows. My understanding of this process is that it'd be deterministic.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 1, 2023 at 9:05 PM Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If you use unpreconditioned BCGS and ensure that you assemble the same matrix (depends how you do the communication for that), I think you'll get bitwise reproducible results when using an MPI that follows the suggestion for implementers about determinism. Beyond that, it'll depend somewhat on the preconditioner.<br>
<br>
If you like BCGS, you may want to try BCGSL, which has a longer memory and tends to be more robust. But preconditioning is usually critical and the place to devote most effort.<br>
<br>
Mark McClure <<a href="mailto:mark@resfrac.com" target="_blank">mark@resfrac.com</a>> writes:<br>
<br>
> Hello,<br>
><br>
> I have been a user of Petsc for quite a few years, though I haven't updated<br>
> my version in a few years, so it's possible that my comments below could be<br>
> 'out of date'.<br>
><br>
> Several years ago, I'd asked you guys about reproducibility. I observed<br>
> that if I gave an identical matrix to the Petsc linear solver, I would get<br>
> a bit-wise identical result back if running on one processor, but if I ran<br>
> with MPI, I would see differences at the final sig figs, below the<br>
> convergence criterion. Even if rerunning the same exact calculation on the<br>
> same exact machine.<br>
><br>
> Ie, with repeated tests, it was always converging to the same answer<br>
> 'within convergence tolerance', but not consistent in the sig figs beyond<br>
> the convergence tolerance.<br>
><br>
> At the time, the response that this was unavoidable, and related to the<br>
> issue that machine arithmetic is not commutative, and so the timing of when<br>
> processors were recombining information (which was random, effectively a<br>
> race condition) was causing these differences.<br>
><br>
> Am I remembering correctly? And, if so, is this still a property of the<br>
> Petsc linear solver with MPI, and is there now any option available to<br>
> resolve it? I would be willing to accept a performance hit in order to get<br>
> guaranteed bitwise consistency, even when running with MPI.<br>
><br>
> I am using the solver KSPBCGS, without a preconditioner. This is the<br>
> selection because several years ago, I did testing, and found that on the<br>
> particular linear systems that I am usually working with, this solver (with<br>
> no preconditioner) was the most robust, in terms of consistently<br>
> converging, and in terms of performance. Actually, I also tested a variety<br>
> of other linear solvers other than Petsc (including other implementations<br>
> of BiCGStab), and found that the Petsc BCGS was the best performer. Though,<br>
> I'm curious, have there been updates to that algorithm in recent years,<br>
> where I should consider updating to a newer Petsc build and comparing?<br>
><br>
> Best regards,<br>
> Mark McClure<br>
</blockquote></div>