On Wed, Jun 22, 2011 at 10:59 AM, Milan Mitrovic <span dir="ltr">&lt;<a href="mailto:milan.v.mitrovic@gmail.com">milan.v.mitrovic@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
mpirun -n 2 ./ex9<br>
0 0<br>
1 1<br>
2 2<br>
3 3<br>
4 4<br>
5 5<br>
6 11<br>
7 6<br>
0 6<br>
1 7<br>
2 8<br>
3 9<br>
4 10<br>
5 11<br>
6 0<br>
7 5<br>
<br>
I am also doing it in fortran to test if it works:<br>
<br>
  if (rank .eq. 0) then<br>
     order(1) = 11<br>
     order(2) = 6<br>
  else<br>
     order(1) = 0<br>
     order(2) = 5<br>
  end if<br>
<br>
  call VecCreateGhost(PETSC_COMM_WORLD, 6, PETSC_DECIDE, 2, order, p, info)<br>
<br>
  call VecGhostGetLocalForm(p, pl, info)<br>
  call VecGetOwnershipRange(p, ps, pe, info)<br>
<br>
  do i=ps,pe-1<br>
     call VecSetValues(p,1,i,real(i,8),INSERT_VALUES,info)<br>
  end do<br>
<br>
  call VecAssemblyBegin(p, info)<br>
  call VecAssemblyEnd(p, info)<br>
<br>
  call VecGhostUpdateBegin(p,INSERT_VALUES,SCATTER_FORWARD,info)<br>
  call VecGhostUpdateEnd(p,INSERT_VALUES,SCATTER_FORWARD,info)<br>
<br>
  call VecGetArray(pl,pla,plai,info)<br>
<br>
and the output is:<br>
<br>
[0] p(1) = 0<br>
[0] p(2) = 1<br>
[0] p(3) = 2<br>
[0] p(4) = 3<br>
[0] p(5) = 4<br>
[0] p(6) = 5<br>
[0] p(7) = 11<br>
[0] p(8) = 6<br>
<br>
[1] p(1) = 6<br>
[1] p(2) = 7<br>
[1] p(3) = 8<br>
[1] p(4) = 9<br>
[1] p(5) = 10<br>
[1] p(6) = 11<br>
[1] p(7) = 0<br>
[1] p(8) = 5<br>
<br>
so it seems to work... but the other code still doesn&#39;t<br>
</blockquote></div><br>So we know that ghost update works, so something is coded incorrectly in your other example. I recommend<div>changing ex9 step-by-step until you can do what you want.</div><div><br></div><div>   Matt<br clear="all">
<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>
</div>