[petsc-users] Understanding parallelism in DMPlexCreateBoxMesh

Geoffrey Irving irving at naml.us
Mon Nov 18 17:55:28 CST 2013


DMPlexCreateSquareBoundary naively seems to

1. Create topology only on rank 0.
2. Set positions on all ranks.

In particular, if seems to allocate space proportional to the entire
number of vertices on every rank:

  ierr = PetscSectionGetStorageSize(coordSection, &coordSize);CHKERRQ(ierr);
  ierr = VecCreate(PetscObjectComm((PetscObject)dm),
&coordinates);CHKERRQ(ierr);
  ierr = VecSetSizes(coordinates, coordSize, PETSC_DETERMINE);CHKERRQ(ierr);

How does this code work?  It's clearly intended to be callable in a
parallel context given that it has a !rank conditional, and works as
part of various examples, so I'm clearly missing something.

Geoffrey


More information about the petsc-users mailing list