<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 23, 2016 at 6:39 AM, Karl Rupp <span dir="ltr"><<a href="mailto:rupp@iue.tuwien.ac.at" target="_blank">rupp@iue.tuwien.ac.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Marco,<span class=""><br>
<br>
> I'm struggling with this statement:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
"It is recommended that you call both of the above preallocation<br>
routines [MatSeqAIJSetPreallocation and MatMPIAIJSetPreallocation] for<br>
simplicity."<br>
<br>
(source: <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATAIJ.html" rel="noreferrer" target="_blank">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATAIJ.html</a><br>
)<br>
<br>
I saw that, even on a single-processor communicator,<br>
MatMPIAIJSetPreallocation works fine (at least, it gives no errors,<br>
but I don't know about efficiency drops).<br>
What's the effect of the recommended double preallocation?<br>
</blockquote>
<br></span>
It allows you to quickly switch between a serial run and a parallel run. If something doesn't work as expected, it's much easier to debug (if possible) on a single rank, hence MatSeqAIJSetPreallocation. However, ultimately you are looking for parallel runs, for which you need MatMPIAIJSetPreallocation. Changing your code back and forth is non-productive, hence it's recommended to call both and you get full flexibility :-)<br></blockquote><div><br></div><div>PETSc uses a system for dispatch that ignores functions which do not apply to that concrete type. This</div><div>allows you to call a variety of specialization functions without</div><div><br></div><div> a) constantly checking the type</div><div><br></div><div> b) failure where a downcast might fail</div><div><br></div><div> Thanks,</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">
Best regards,<br>
Karli<br>
</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>