[petsc-dev] Expensive VecDuplicate_MPI_DA

Junchao Zhang jczhang at mcs.anl.gov
Tue Jun 19 16:30:56 CDT 2018


I met an expensive VecDuplicate. See the attached call
stack. VecDuplicate_MPI_DA indirectly calls MPI_Allreduce/Allgather to
build the vector's layout, but it then immediately destroys it
with VecGetLayout & VecSetLayout. Is it wrong?
src/dm/impls/da/dadist.c
PetscErrorCode  VecDuplicate_MPI_DA(Vec g,Vec *gg)
{
  PetscErrorCode ierr;
  DM             da;
  PetscLayout    map;

  PetscFunctionBegin;
  ierr = VecGetDM(g, &da);CHKERRQ(ierr);
  ierr = DMCreateGlobalVector(da,gg);CHKERRQ(ierr);
  ierr = VecGetLayout(g,&map);CHKERRQ(ierr);
  ierr = VecSetLayout(*gg,map);CHKERRQ(ierr);
  PetscFunctionReturn(0);
}

--Junchao Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20180619/3e035c9a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VecDup.png
Type: image/png
Size: 114199 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20180619/3e035c9a/attachment-0001.png>


More information about the petsc-dev mailing list