<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Got it. I had a coding error.<br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">-gideon</span>
</div>
<br class=""><div style=""><blockquote type="cite" class=""><div class="">On Feb 15, 2015, at 10:34 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class=""><blockquote type="cite" class="">On Feb 15, 2015, at 9:17 PM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" class="">gideon.simpson@gmail.com</a>> wrote:<br class=""><br class="">Got it, one follow up question:<br class=""><br class="">When calling MatMPIAIJSetPreallocation, is there a reason why the number of nonzero entries in the off-diagonal sub matrix cannot be zero?<br class=""></blockquote><br class="">It could be zero; that means there is not coupling between processes however so essentially each process has its own independent problem; thus normally it is most definitely not zero.<br class=""><br class=""> Barry<br class=""><br class=""><blockquote type="cite" class=""><br class="">-gideon<br class=""><br class=""><blockquote type="cite" class="">On Feb 15, 2015, at 9:31 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Feb 15, 2015, at 8:22 PM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" class="">gideon.simpson@gmail.com</a>> wrote:<br class=""><br class="">I’m trying to get a handle on the different ways of constructing matrices. Currently, I have:<br class=""><br class="">MatCreate(...)<br class="">MatSetSizes(...)<br class="">MatSetFromOptions(...)<br class="">MatSetUp(…)<br class=""><br class="">but I gather from reading the manual that, by not preallocating, I’m losing out in performance. If I assume that my matrix will either by SeqAIJ or MPIAIJ, depending on the number of processors available, how would I go about doing this. I see some of the example codes with:<br class=""><br class="">MatSeqAIJSetPreallocation(…)<br class="">MatMPIAIJSetPreallocation(…)<br class=""><br class="">as successive commands. Should I interpret this as saying that PETSc will just ignore the one that is not the active one in the current instance? <br class=""></blockquote><br class=""> Exactly*.<br class=""><br class=""> You can also use MatXAIJSetPreallocation() which sets the possible preallocation forms for all the matrix types without requiring you to set one each individuallly.<br class=""><br class=""> Barry<br class=""><br class="">* We support this in many places because we hate requiring users to put a bunch of if (type == xxx) kind of code in their applications. For example KSPGMRESSetRestart() is ignored if the KSP type is not GMRES.<br class=""><br class=""><br class=""><blockquote type="cite" class=""><br class="">-gideon<br class=""><br class=""></blockquote><br class=""></blockquote><br class=""></blockquote><br class=""></div></blockquote></div><br class=""></body></html>