<div dir="ltr"><div>Ok, thanks for the clarification. <br></div><div><br></div><div>Kind regards.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El vie., 8 de nov. de 2019 a la(s) 04:23, Matthew Knepley (<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>) escribió:<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"><div dir="ltr">On Fri, Nov 8, 2019 at 2:23 AM Emmanuel Ayala via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</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"><div>Hi, <br></div><div><br></div><div>Thank you very much for the help and the quickly answer.</div><div><br></div><div>After check my code the problem was previous to scattering. <b>The scatter routines work perfectly.</b><br><br>Just to undesrtand, in the line:<br><br>ISCreateStride(MPI_COMM_WORLD,(end-start),start,1,&is_fromA);<br><br>if I use MPI_COMM_WORLD, it means that all the processes have a copy of the (current local process) index set?<br>If I use MPI_COMM_SELF, it means that only the local process have information about the index set?<br></div></div></blockquote><div><br></div><div>No, each process has whatever you give it in this call. The comm determines what happens with collective calls, like</div><div><br></div><div> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/ISGetTotalIndices.html" target="_blank">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/ISGetTotalIndices.html</a></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>Kind regards</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El lun., 4 de nov. de 2019 a la(s) 08:47, Smith, Barry F. (<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>) escribió:<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>
<div><font size="2"><span style="font-size:11pt">
<div><br>
It works for me. Please send a complete code that fails.<br>
<br>
<br>
</div>
</span></font></div>
<div><font size="2"><span style="font-size:11pt">
<div><br>
<br>
> On Nov 3, 2019, at 11:41 PM, Emmanuel Ayala via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
> <br>
> Hi everyone, thanks in advance.<br>
> <br>
> I have three parallel vectors: A, B and C. A and B have different sizes, and C must be contain these two vectors (MatLab notation C=[A;B]). I need to do some operations on C then put back the proper portion of C on A and B, then I do some computations on
A and B y put again on C, and the loop repeats.<br>
> <br>
> For these propose I use Scatters:<br>
> <br>
> C is created as a parallel vector with size of (sizeA + sizeB) with petsc_decide for parallel layout. The vectors have been distributed on the same amount of processes.<br>
> <br>
> For the specific case with order [A;B]<br>
> <br>
> VecGetOwnershipRange(A,&start,&end);<br>
> ISCreateStride(MPI_COMM_WORLD,(end-start),start,1,&is_fromA);<br>
> ISCreateStride(MPI_COMM_WORLD,(end-start),start,1,&is_toC1);// this is redundant<br>
> VecScatterCreate(A,is_fromA,C,is_toC1,&scatter1);<br>
> <br>
> VecGetSize(A,&sizeA)<br>
> VecGetOwnershipRange(B,&start,&end);<br>
> ISCreateStride(MPI_COMM_WORLD,(end-start),start,1,&is_fromB);<br>
> ISCreateStride(MPI_COMM_WORLD,(end-start),(start+sizeA),1,&is_toC2); //shifts the index location<br>
> VecScatterCreate(B,is_fromB,C,is_toC2,&scatter2);<br>
> <br>
> Then I can use <br>
> VecScatterBegin(scatter1,A,C,INSERT_VALUES,SCATTER_FORWARD);<br>
> VecScatterEnd(scatter1,A,C,INSERT_VALUES,SCATTER_FORWARD);<br>
> <br>
> and<br>
> VecScatterBegin(scatter1,C,A,INSERT_VALUES,SCATTER_REVERSE);<br>
> VecScatterEnd(scatter1,C,A,INSERT_VALUES,SCATTER_REVERSE);<br>
> <br>
> and the same with B.<br>
> I used MPI_COMM SELF and I got the same results.<br>
> <br>
> The situation is: My results look good for the portion of B, but no for the portion of A, there is something that I'm doing wrong with the scattering?<br>
> <br>
> Best regards.<br>
<br>
</div>
</span></font></div>
</div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><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>
</blockquote></div>