<div dir="ltr"><div dir="ltr">On Thu, Jan 18, 2024 at 2:47 AM 袁煕 <<a href="mailto:yuanxi@advancesoft.jp">yuanxi@advancesoft.jp</a>> wrote:<br></div><div class="gmail_quote"><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">Dear PETSc Experts,<br><div><br></div><div>My FEM program works well generally, but in some specific cases with multiple CPUs are used, it freezes when calling MatAssemblyBegin where PMPI_Allreduce is called (see attached file).</div><div><br></div><div>After some investigation, I found that it is most probably due to</div><div><br></div><div>・ MatSetValue is not called from all CPUs before MatAssemblyBegin </div><div><br></div><div>For example, when 4 CPUs are used, if there are elements in CPU 0,1,2 but no elements in CPU 3, then all CPUs other than CPU 3 would call MatSetValue function. I want to know</div><div><br></div><div>1. If my <span style="color:rgb(32,33,36);font-family:arial,sans-serif;font-size:14px">conjecture could be right? And If so</span></div></div></blockquote><div><br></div><div>No, you do not have to call MatSetValue() from all processes.</div><div> </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"><div><span style="color:rgb(32,33,36);font-family:arial,sans-serif;font-size:14px">2. Are there any convenient means to avoid this problem?</span></div></div></blockquote><div><br></div><div>Are you calling MatAssemblyBegin() from all processes? This is necessary.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </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"><div><span style="color:rgb(32,33,36);font-family:arial,sans-serif;font-size:14px">Thanks,</span></div><div><span style="color:rgb(32,33,36);font-family:arial,sans-serif;font-size:14px">Xi YUAN, PhD Solid Mechanics</span></div></div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>