<div dir="ltr">Thanks Dave,<div><br></div><div>I think is interesting it never gave an error on this, after adding the vecassembly calls it still shows the same behavior, without complaining, i did:</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(206,121,36)"><span style="font-variant-ligatures:no-common-ligatures">if</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(rankl</span><span style="font-variant-ligatures:no-common-ligatures">==</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">0</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">)</span><span style="font-variant-ligatures:no-common-ligatures">then</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecSetValues(</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,nbdp,ind,Rhs,INSERT_VALUES,ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecAssemblyBegin(</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,ierr) ; </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecAssemblyEnd(</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,ierr);</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     CHKERRQ(ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecView(</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,PETSC_VIEWER_STDOUT_WORLD,ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     CHKERRQ(ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecScatterBegin(ctr,</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,bp2,INSERT_VALUES,SCATTER_REVERSE,ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecScatterEnd(ctr,</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,bp2,INSERT_VALUES,SCATTER_REVERSE,ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(195,55,32)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">print*</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">,</span><span style="font-variant-ligatures:no-common-ligatures">"done! "</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     CHKERRQ(ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(206,121,36)"><span style="font-variant-ligatures:no-common-ligatures">endif</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">       CHKERRQ(ierr)</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Thanks.</span></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 6, 2017 at 12:44 PM, Dave May <span dir="ltr"><<a href="mailto:dave.mayhem23@gmail.com" target="_blank">dave.mayhem23@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On 6 January 2017 at 20:24, Manuel Valera <span dir="ltr"><<a href="mailto:mvalera@mail.sdsu.edu" target="_blank">mvalera@mail.sdsu.edu</a>></span> wrote:<br><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">Great help Barry, i totally had overlooked that option (it is explicit in the vecscatterbegin call help page but not in vecscattercreatetozero, as i read later)<div><br></div><div>So i used that and it works partially, it scatters te values assigned in root but not the rest, if i call vecscatterbegin from outside root it hangs, the code currently look as this:</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecScatterCreateToZero(bp2,ctr<wbr>,</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,ierr); CHKERRQ(ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> PetscObjectSetName(</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">, </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">'</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(153,18,0);background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">:'</span><span style="font-variant-ligatures:no-common-ligatures">,ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(206,121,36)"><span style="font-variant-ligatures:no-common-ligatures">if</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">(rankl</span><span style="font-variant-ligatures:no-common-ligatures">==</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">0</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">)</span><span style="font-variant-ligatures:no-common-ligatures">then</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecSetValues(</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,nbdp,ind,Rhs,<wbr>INSERT_VALUES,ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecView(</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,PETSC_VIEWER_STDOU<wbr>T_WORLD,ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p></div></div></blockquote><div><br></div></span><div>You need to call<br><br>  VecAssemblyBegin(bp0);<br>  VecAssemblyEnd(bp0);<br></div><div>after your last call to VecSetValues() before you can do any operations with bp0.<br></div><div><br></div><div>With your current code, the call to VecView should produce an error if you used the error checking macro CHKERRQ(ierr) (as should VecScatter{Begin,End}<br></div><div><br></div><div>Thanks,<br></div><div>  Dave<br></div><div><div class="h5"><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><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecScatterBegin(ctr,</span><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,bp2,IN<wbr>SERT_VALUES,SCATTER_REVERSE,ie<wbr>rr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="color:rgb(0,0,0);font-variant-ligatures:no-common-ligatures">     </span><span style="font-variant-ligatures:no-common-ligatures"><font color="#a2c4c9">call </font><font color="#000000">VecScatterEnd(ctr,</font></span><font color="#000000"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,bp2,INSE<wbr>RT_VALUES,SCATTER_REVERSE,ierr<wbr>) </span></font></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(195,55,32)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">     </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">print*</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">,</span><span style="font-variant-ligatures:no-common-ligatures">"done! "</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">     CHKERRQ(ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(206,121,36)"><span style="font-variant-ligatures:no-common-ligatures">endif</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(83,48,225)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">   </span><span style="font-variant-ligatures:no-common-ligatures">! call VecScatterBegin(ctr,</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(2,32,179);background-color:rgb(230,230,0)">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,bp2,IN<wbr>SERT_VALUES,SCATTER_REVERSE,ie<wbr>rr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="background-color:rgb(255,255,255)"><font color="#9900ff"><span style="font-variant-ligatures:no-common-ligatures">   !  </span><span style="font-variant-ligatures:no-common-ligatures">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecScatterEnd(ctr,</span><span style="font-variant-ligatures:no-common-ligatures">bp0</span><span style="font-variant-ligatures:no-common-ligatures">,bp2,INSE<wbr>RT_VALUES,SCATTER_REVERSE,ierr<wbr>)</span></font></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> VecView(bp2,PETSC_VIEWER_STDOU<wbr>T_WORLD,ierr)</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> PetscBarrier(PETSC_NULL_OBJECT<wbr>,ierr)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures">  </span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(52,187,199)">call</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(206,121,36)">exit</span><span style="font-variant-ligatures:no-common-ligatures">()</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">And the output is: (with bp the right answer)</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Vec Object:bp: 2 MPI processes</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  type: mpi</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Process [0]</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">1.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">2.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Process [1]</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">4.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">3.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Vec Object:bp2: 2 MPI processes  <b>(before scatter)</b></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  type: mpi</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Process [0]</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">0.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">0.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Process [1]</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">0.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">0.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Vec Object:bp0: 1 MPI processes</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  type: seq</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">1.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">2.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">4.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">3.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"> done! </span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Vec Object:bp2: 2 MPI processes  <b>(after scatter)</b></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">  type: mpi</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">Process [0]</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">1.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">2.</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><b>Process [1]</b></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><b>0.</b></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo">





























</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><b>0.</b></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><b><br></b></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><b><br></b></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><b><br></b></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><b><br></b></span></p><p style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, helvetica, sans-serif">Thanks inmensely for your help,</font></span></p><p style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, helvetica, sans-serif"><br></font></span></p><p style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, helvetica, sans-serif">Manuel</font></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures"><b><br></b></span></p></div></div><div class="m_-1204852822857472003m_-3825662620284732078m_-7452556731958915607gmail-HOEnZb"><div class="m_-1204852822857472003m_-3825662620284732078m_-7452556731958915607gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 5, 2017 at 4:39 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><br>
> On Jan 5, 2017, at 6:21 PM, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu" target="_blank">mvalera@mail.sdsu.edu</a>> wrote:<br>
><br>
> Hello Devs is me again,<br>
><br>
> I'm trying to distribute a vector to all called processes, the vector would be originally in root as a sequential vector and i would like to scatter it, what would the best call to do this ?<br>
><br>
> I already know how to gather a distributed vector to root with VecScatterCreateToZero, this would be the inverse operation,<br>
<br>
</span>   Use the same VecScatter object but with SCATTER_REVERSE, not you need to reverse the two vector arguments as well.<br>
<div class="m_-1204852822857472003m_-3825662620284732078m_-7452556731958915607gmail-m_3785297629156724777HOEnZb"><div class="m_-1204852822857472003m_-3825662620284732078m_-7452556731958915607gmail-m_3785297629156724777h5"><br>
<br>
> i'm currently trying with VecScatterCreate() and as of now im doing the following:<br>
><br>
><br>
> if(rank==0)then<br>
><br>
><br>
>      call VecCreate(PETSC_COMM_SELF,bp0,<wbr>ierr); CHKERRQ(ierr) !if i use WORLD<br>
>                                                              !freezes in SetSizes<br>
>      call VecSetSizes(bp0,PETSC_DECIDE,n<wbr>bdp,ierr); CHKERRQ(ierr)<br>
>      call VecSetType(bp0,VECSEQ,ierr)<br>
>      call VecSetFromOptions(bp0,ierr); CHKERRQ(ierr)<br>
><br>
><br>
>      call VecSetValues(bp0,nbdp,ind,Rhs,<wbr>INSERT_VALUES,ierr)<br>
><br>
>      !call VecSet(bp0,5.0D0,ierr); CHKERRQ(ierr)<br>
><br>
><br>
>      call VecView(bp0,PETSC_VIEWER_STDOU<wbr>T_WORLD,ierr)<br>
><br>
>      call VecAssemblyBegin(bp0,ierr) ; call VecAssemblyEnd(bp0,ierr) !rhs<br>
><br>
>      do i=0,nbdp-1,1<br>
>         ind(i+1) = i<br>
>      enddo<br>
><br>
>      call ISCreateGeneral(PETSC_COMM_SEL<wbr>F,nbdp,ind,PETSC_COPY_VALUES,l<wbr>ocis,ierr)<br>
><br>
>     !call VecScatterCreate(bp0,PETSC_NUL<wbr>L_OBJECT,bp2,is,ctr,ierr) !if i use SELF<br>
>                                                                   !freezes here.<br>
><br>
>      call VecScatterCreate(bp0,locis,bp2<wbr>,PETSC_NULL_OBJECT,ctr,ierr)<br>
><br>
> endif<br>
><br>
> bp2 being the receptor MPI vector to scatter to<br>
><br>
> But it freezes in VecScatterCreate when trying to use more than one processor, what would be a better approach ?<br>
><br>
><br>
> Thanks once again,<br>
><br>
> Manuel<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On Wed, Jan 4, 2017 at 3:30 PM, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu" target="_blank">mvalera@mail.sdsu.edu</a>> wrote:<br>
> Thanks i had no idea how to debug and read those logs, that solved this issue at least (i was sending a message from root to everyone else, but trying to catch from everyone else including root)<br>
><br>
> Until next time, many thanks,<br>
><br>
> Manuel<br>
><br>
> On Wed, Jan 4, 2017 at 3:23 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
> On Wed, Jan 4, 2017 at 5:21 PM, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu" target="_blank">mvalera@mail.sdsu.edu</a>> wrote:<br>
> I did a PetscBarrier just before calling the vicariate routine and im pretty sure im calling it from every processor, code looks like this:<br>
><br>
> From the gdb trace.<br>
><br>
>   Proc 0: Is in some MPI routine you call yourself, line 113<br>
><br>
>   Proc 1: Is in VecCreate(), line 130<br>
><br>
> You need to fix your communication code.<br>
><br>
>    Matt<br>
><br>
> call PetscBarrier(PETSC_NULL_OBJECT<wbr>,ierr)<br>
><br>
> print*,'entering POInit from',rank<br>
> !call exit()<br>
><br>
> call PetscObjsInit()<br>
><br>
><br>
> And output gives:<br>
><br>
>  entering POInit from           0<br>
>  entering POInit from           1<br>
>  entering POInit from           2<br>
>  entering POInit from           3<br>
><br>
><br>
> Still hangs in the same way,<br>
><br>
> Thanks,<br>
><br>
> Manuel<br>
><br>
><br>
><br>
> On Wed, Jan 4, 2017 at 2:55 PM, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu" target="_blank">mvalera@mail.sdsu.edu</a>> wrote:<br>
> Thanks for the answers !<br>
><br>
> heres the screenshot of what i got from bt in gdb (great hint in how to debug in petsc, didn't know that)<br>
><br>
> I don't really know what to look at here,<br>
><br>
> Thanks,<br>
><br>
> Manuel<br>
><br>
> On Wed, Jan 4, 2017 at 2:39 PM, Dave May <<a href="mailto:dave.mayhem23@gmail.com" target="_blank">dave.mayhem23@gmail.com</a>> wrote:<br>
> Are you certain ALL ranks in PETSC_COMM_WORLD call these function(s). These functions cannot be inside if statements like<br>
> if (rank == 0){<br>
>   VecCreateMPI(...)<br>
> }<br>
><br>
><br>
> On Wed, 4 Jan 2017 at 23:34, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu" target="_blank">mvalera@mail.sdsu.edu</a>> wrote:<br>
> Thanks Dave for the quick answer, appreciate it,<br>
><br>
> I just tried that and it didn't make a difference, any other suggestions ?<br>
><br>
> Thanks,<br>
> Manuel<br>
><br>
> On Wed, Jan 4, 2017 at 2:29 PM, Dave May <<a href="mailto:dave.mayhem23@gmail.com" target="_blank">dave.mayhem23@gmail.com</a>> wrote:<br>
> You need to swap the order of your function calls.<br>
> Call VecSetSizes() before VecSetType()<br>
><br>
> Thanks,<br>
>   Dave<br>
><br>
><br>
> On Wed, 4 Jan 2017 at 23:21, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu" target="_blank">mvalera@mail.sdsu.edu</a>> wrote:<br>
> Hello all, happy new year,<br>
><br>
> I'm working on parallelizing my code, it worked and provided some results when i just called more than one processor, but created artifacts because i didn't need one image of the whole program in each processor, conflicting with each other.<br>
><br>
> Since the pressure solver is the main part i need in parallel im chosing mpi to run everything in root processor until its time to solve for pressure, at this point im trying to create a distributed vector using either<br>
><br>
>      call VecCreateMPI(PETSC_COMM_WORLD,<wbr>PETSC_DECIDE,nbdp,xp,ierr)<br>
> or<br>
>      call VecCreate(PETSC_COMM_WORLD,xp,<wbr>ierr); CHKERRQ(ierr)<br>
>      call VecSetType(xp,VECMPI,ierr)<br>
>      call VecSetSizes(xp,PETSC_DECIDE,nb<wbr>dp,ierr); CHKERRQ(ierr)<br>
><br>
><br>
> In both cases program hangs at this point, something it never happened on the naive way i described before. I've made sure the global size, nbdp, is the same in every processor. What can be wrong?<br>
><br>
> Thanks for your kind help,<br>
><br>
> Manuel.<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> 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<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>