<div dir="ltr">Thanks Satish. That all makes sense. <div><br></div><div>Truth is I am trying to move data from a parallel vector to a serial one on rank 0. I make an index set, in parallel, with stride 1 and use it for both source and destination and i believe that should do the job ... but it does not. Somehow it seems that the values from other processors do not get inserted in the serial vector on rank 0!</div>

<div><br></div><div>This seems it should be so simple and I&#39;m not sure if there is a bug somewhere in my code or I&#39;m still confused about IS and VecScatter!</div><div><br></div><div>Mohammad<br><div><br></div><div>

<br><div class="gmail_quote">On Thu, Feb 9, 2012 at 3:42 PM, Satish Balay <span dir="ltr">&lt;<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>&gt;</span> wrote<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On Thu, 9 Feb 2012, Mohammad Mirzadeh wrote:<br>
<br>
</div>&gt; So this actually means it somehow matches the local indices?<br>
<br>
Hm - no local indices here.<br>
<div class="im"><br>
&gt; What i mean by that is,<br>
&gt;<br>
&gt; y[ iy[i] ] = x[ ix[i] ].<br>
<br>
</div>Sure - with global indices.<br>
<div class="im"><br>
&gt;<br>
&gt; Is that why ix and iy should have the same size?<br>
<br>
</div>When you specify data movement - you specify both source and<br>
destination for each element that is to be moved. If you are moving n<br>
elements - you have n sources, and n destination values - hence ix[n],<br>
iy[n]<br>
<span class="HOEnZb"><font color="#888888"><br>
Satish<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
&gt;<br>
&gt; Mohammad<br>
&gt;<br>
&gt; On Thu, Feb 9, 2012 at 3:17 PM, Satish Balay &lt;<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On Thu, 9 Feb 2012, Mohammad Mirzadeh wrote:<br>
&gt; &gt;<br>
&gt; &gt; &gt; Hi guys,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I&#39;m just wondering if I understand how the VecScatter works. Considering<br>
&gt; &gt; &gt; (petsc 3.2-p6 manual page 53):<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; VecScatterCreate(Vec x,IS ix,Vec y,IS iy,VecScatter *ctx);<br>
&gt; &gt; &gt; VecScatterBegin(VecScatter ctx,Vec x,Vec y,INSERT VALUES,SCATTER<br>
&gt; &gt; FORWARD);<br>
&gt; &gt; &gt; VecScatterEnd(VecScatter ctx,Vec x,Vec y,INSERT VALUES,SCATTER FORWARD);<br>
&gt; &gt; &gt; VecScatterDestroy(VecScatter *ctx);<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; is the following statement correct?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; VecScatter looks into &quot;ix&quot; and &quot;iy&quot; index sets and `matches&#39; the global<br>
&gt; &gt; &gt; indecies between the two to copy data from vector &quot;x&quot; to vector &quot;y&quot;. For<br>
&gt; &gt; &gt; example, if &quot;ix&quot; maps local index &quot;1&quot; to global index &quot;10&quot;, VecScatter<br>
&gt; &gt; &gt; looks inside &quot;iy&quot; to find a local index that is mapped to global index<br>
&gt; &gt; &quot;10&quot;<br>
&gt; &gt; &gt; and sends the data accordingly to the correct processor.<br>
&gt; &gt;<br>
&gt; &gt; nope - it means - if you have x[10],y[10]:<br>
&gt; &gt;<br>
&gt; &gt; ix = {1,5,9}<br>
&gt; &gt; iy = {0,2,1}<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Then you get:<br>
&gt; &gt; y[0] = x[1]<br>
&gt; &gt; y[2] = x[5]<br>
&gt; &gt; y[1] = x[9]<br>
&gt; &gt;<br>
&gt; &gt; [all numbers above are global indices]<br>
&gt; &gt;<br>
&gt; &gt; Satish<br>
&gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Thanks,<br>
&gt; &gt; &gt; Mohammad<br>
&gt; &gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br></div></div></div>