<div dir="ltr">If I call MatAssembly for individual sub-matrices, <div> MatAssemblyBegin(subA[ii], MAT_FINAL_ASSEMBLY);<br> MatAssemblyEnd(subA[ii], MAT_FINAL_ASSEMBLY);<br></div><div><br></div><div>then call KSPSetOperators, the PC setup is not called.</div><div><br></div><div>I have to call the assembly for the whole nest matrix </div><div> MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY);<br> MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY);<br></div><div>to trigger the setup of PC. </div><div><br></div><div>I found some comments in <a href="https://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/nest/matnest.c" style="font-family:"Times New Roman";font-size:medium;text-align:-webkit-center">matnest.c</a>, line 474-478: "<span style="color:rgb(178,34,34)">Note: split assembly will fail if the same block appears more than once (even indirectly through a nested</span></div><pre width="80" style="color:rgb(0,0,0)"><a name="line475">475: </a><font color="#B22222"> * sub-block). This could be fixed by adding a flag to <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/Mat.html#Mat">Mat</a> so that there was a way to check if a <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/Mat.html#Mat">Mat</a> was</font>
<a name="line476">476: </a><font color="#B22222"> * already performing an assembly, but the result would by more complicated and appears to offer less</font>
<a name="line477">477: </a><font color="#B22222"> * potential for diagnostics and correctness checking. Split assembly should be fixed once there is an</font>
<a name="line478">478: </a><font color="#B22222"> * interface for libraries to make asynchronous progress in "user-defined non-blocking collectives"."</font></pre><pre width="80" style=""><font color="#B22222" style="color:rgb(0,0,0)">I guess the comment suggests calling matassembly for the big nest matrix after having setted values for individual sub-matrices, instead of calling matassembly for individual submatrices.</font></pre><pre width="80" style=""><font color="#B22222" style="color:rgb(0,0,0)"><br></font></pre><pre width="80" style=""><font color="#B22222" style="color:rgb(0,0,0)">Can you confirm that?</font></pre><pre width="80" style="color:rgb(0,0,0)"><font color="#B22222"><br></font></pre></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 21, 2020 at 4:35 PM Mark Adams <<a href="mailto:mfadams@lbl.gov">mfadams@lbl.gov</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"><div dir="ltr">KSPSetOperator tells the KSP that the PC should be resetup.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 21, 2020 at 3:45 PM Alex Fleeter <<a href="mailto:luis.saturday@gmail.com" target="_blank">luis.saturday@gmail.com</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"><div dir="ltr">Hi:<div><br></div><div>I want to ask under what circumstance will trigger a call for pc setup. </div><div><br></div><div>I call KSPSolve to solve with the same Mat object with different entry values each time. I can see that the pc setup is only called at the beginning of the first solve. </div><div><br></div><div>I tried to read the implementation, but quickly get lost...</div></div>
</blockquote></div>
</blockquote></div>