<div dir="ltr">You want to look at example codes and docs (<a href="https://urldefense.us/v3/__https://petsc.org/release/manualpages/PetscSF/VecScatterCreate/__;!!G_uCfscf7eWS!ZfPM2-JGiNd8Yo2xIkHZlQtcjvcJFjXXbMbQPIZ3C5d-RVC-yfvFjoiEm5yaWLcKxfLTPhKkdLX9BM2atRAJ6eg$">https://petsc.org/release/manualpages/PetscSF/VecScatterCreate/</a>) but I am guessing global_vec and local_vec do not have the same communicator.<div><br></div><div>Mark</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Dec 7, 2024 at 9:50 PM Qiyue Lu <<a href="mailto:qiyuelu1@gmail.com">qiyuelu1@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">Hello,<br><div>I am trying to fetch 12 entries from a distributed vector global_vec and put them into a local vector on each process. </div><div><br></div><div><div style="background-color:rgb(31,31,31);font-family:"Droid Sans Mono","monospace",monospace;font-size:14px;line-height:19px;white-space:pre-wrap"><div style="color:rgb(204,204,204)"><span style="color:rgb(78,201,176)"> IS</span> <span style="color:rgb(156,220,254)">is_source</span>, <span style="color:rgb(156,220,254)">is_dest</span>;</div><div><font color="#cccccc"> </font><span style="color:rgb(220,220,170)">ISCreateGeneral</span><font color="#cccccc">(</font><span style="color:rgb(86,156,214)">PETSC_COMM_SELF</span><font color="#cccccc">, </font><font color="#9cdcfe">12</font><font color="#cccccc">, </font><span style="color:rgb(156,220,254)">idx_global</span><font color="#cccccc">, </font><span style="color:rgb(79,193,255)">PETSC_COPY_VALUES</span><font color="#cccccc">, </font><span style="color:rgb(212,212,212)">&</span><span style="color:rgb(156,220,254)">is_source</span><font color="#cccccc">);</font></div><div><span style="color:rgb(204,204,204)"> <span style="color:rgb(220,220,170)">ISCreateGeneral</span>(<span style="color:rgb(86,156,214)">PETSC_COMM_SELF</span>, </span><font color="#9cdcfe">12</font><font color="#cccccc">, </font><span style="color:rgb(156,220,254)">idx_local</span><font color="#cccccc">, </font><span style="color:rgb(79,193,255)">PETSC_COPY_VALUES</span><font color="#cccccc">, </font><span style="color:rgb(212,212,212)">&</span><span style="color:rgb(156,220,254)">is_dest</span><font color="#cccccc">);</font></div><div style="color:rgb(204,204,204)"> <span style="color:rgb(78,201,176)">Vec</span> <span style="color:rgb(156,220,254)">local_vec</span>;</div><div style="color:rgb(204,204,204)"> <span style="color:rgb(220,220,170)">VecCreate</span>(<span style="color:rgb(86,156,214)">PETSC_COMM_SELF</span>, <span style="color:rgb(212,212,212)">&</span><span style="color:rgb(156,220,254)">local_vec</span>);</div><div><span style="color:rgb(204,204,204)"> <span style="color:rgb(220,220,170)">VecSetSizes</span>(<span style="color:rgb(156,220,254)">local_vec</span>, <span style="color:rgb(86,156,214)">PETSC_DECIDE</span>, </span><font color="#9cdcfe">12</font><font color="#cccccc">); </font></div><div style="color:rgb(204,204,204)"> <span style="color:rgb(220,220,170)">VecSetType</span>(<span style="color:rgb(156,220,254)">local_vec</span>, <span style="color:rgb(86,156,214)">VECSEQ</span>);</div><div style="color:rgb(204,204,204)"> <span style="color:rgb(78,201,176)">VecScatter</span> <span style="color:rgb(156,220,254)">scat</span>;</div><div style="color:rgb(204,204,204)"> <span style="color:rgb(220,220,170)">VecScatterCreate</span>(<span style="color:rgb(156,220,254)">global_vec</span>, <span style="color:rgb(156,220,254)">is_source</span>, <span style="color:rgb(156,220,254)">local_vec</span>, <span style="color:rgb(156,220,254)">is_dest</span>, <span style="color:rgb(212,212,212)">&</span><span style="color:rgb(156,220,254)">scat</span>);</div></div></div><div><br></div><div><br></div><div>I create the local vector as sequential. However, the last two lines which create a scatter object, will cause more than half processes to hang and no error pops out. </div><div><br></div><div>Does the scatter have to be VECMPI to VECMPI and cannot VECMPI to VECSEQ?</div><div><br></div><div>Thanks,</div><div>Qiyue Lu</div></div>
</blockquote></div>