[petsc-users] Ghost communication

Milan Mitrovic milan.v.mitrovic at gmail.com
Wed Jun 22 10:59:52 CDT 2011


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


More information about the petsc-users mailing list