[petsc-users] Ghost communication

Matthew Knepley knepley at gmail.com
Wed Jun 22 11:02:12 CDT 2011


On Wed, Jun 22, 2011 at 10:59 AM, Milan Mitrovic <milan.v.mitrovic at gmail.com
> wrote:

> mpirun -n 2 ./ex9
> 0 0
> 1 1
> 2 2
> 3 3
> 4 4
> 5 5
> 6 11
> 7 6
> 0 6
> 1 7
> 2 8
> 3 9
> 4 10
> 5 11
> 6 0
> 7 5
>
> I am also doing it in fortran to test if it works:
>
>  if (rank .eq. 0) then
>     order(1) = 11
>     order(2) = 6
>  else
>     order(1) = 0
>     order(2) = 5
>  end if
>
>  call VecCreateGhost(PETSC_COMM_WORLD, 6, PETSC_DECIDE, 2, order, p, info)
>
>  call VecGhostGetLocalForm(p, pl, info)
>  call VecGetOwnershipRange(p, ps, pe, info)
>
>  do i=ps,pe-1
>     call VecSetValues(p,1,i,real(i,8),INSERT_VALUES,info)
>  end do
>
>  call VecAssemblyBegin(p, info)
>  call VecAssemblyEnd(p, info)
>
>  call VecGhostUpdateBegin(p,INSERT_VALUES,SCATTER_FORWARD,info)
>  call VecGhostUpdateEnd(p,INSERT_VALUES,SCATTER_FORWARD,info)
>
>  call VecGetArray(pl,pla,plai,info)
>
> and the output is:
>
> [0] p(1) = 0
> [0] p(2) = 1
> [0] p(3) = 2
> [0] p(4) = 3
> [0] p(5) = 4
> [0] p(6) = 5
> [0] p(7) = 11
> [0] p(8) = 6
>
> [1] p(1) = 6
> [1] p(2) = 7
> [1] p(3) = 8
> [1] p(4) = 9
> [1] p(5) = 10
> [1] p(6) = 11
> [1] p(7) = 0
> [1] p(8) = 5
>
> so it seems to work... but the other code still doesn't
>

So we know that ghost update works, so something is coded incorrectly in
your other example. I recommend
changing ex9 step-by-step until you can do what you want.

   Matt

-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110622/174b0080/attachment.htm>


More information about the petsc-users mailing list