[petsc-dev] Problem with l2g IS created by VecCreateGhostBlock

Smith, Barry F. bsmith at mcs.anl.gov
Sat May 19 11:13:00 CDT 2018


   Garth,

    Sorry for the delay in responding. This is our bug, I have put the fix into the branch barry/fix-veccreateghostblockwitharray/maint
which after testing tonight will go into the maint branch and then the next patch release.

     Please let us know if the fix in the branch resolves your difficulties.

    Barry


> On May 17, 2018, at 11:41 AM, Garth Wells <gnw20 at cam.ac.uk> wrote:
> 
> I'm seeing an issue because I previously built my own l2g IS, whereas
> now I'm relying on the IS created by VecCreateGhostBlock.
> 
> For a vector with 8 entries and block size 2 (i.e, 4 blocks), and
> arranged:
> 
> P0: Owns blocks: 0
>    Ghost blocks: 1, 2 
> 
> P1: Owns blocks: 1, 2, 3
>    Ghost blocks: None
> 
> I expected the local-to-global IS created by VecCreateGhostBlock on
> proc 1 to be:
> 
> 0  1
> 1  2
> 2  3
> 
> But I get 
> 
> 0  2  
> 1  3
> 2  4
> 
> The below code illustrates (run with 2 procs). I'm using the dev master
> branch (updated just now).
> 
> Am I doing something wrong?
> 
> Garth
> 
> 
> 
> #include <petsc.h>
> static char help[] = "Test ghost vec";
> int main(int argc, char **argv)
> {
>  PetscInitialize(&argc, &argv, (char *)0, help);
> 
>  PetscMPIInt rank;
>  MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
> 
>  Vec x;
>  if (rank == 0)
>  {
>    PetscInt ghst[2] = {1, 2};
>    VecCreateGhostBlock(PETSC_COMM_WORLD, 2, 2, PETSC_DECIDE, 2, ghst,
> &x);
>  }
>  else if (rank == 1)
>  {
>    VecCreateGhostBlock(PETSC_COMM_WORLD, 2, 6, PETSC_DECIDE, 0, NULL,
> &x);
> 
>    ISLocalToGlobalMapping mapping;
>    VecGetLocalToGlobalMapping(x, &mapping);
>    ISLocalToGlobalMappingView(mapping, PETSC_VIEWER_STDOUT_SELF);
>  }
>  return 0;
> }



More information about the petsc-dev mailing list