<div dir="ltr"><div><div>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?</div></div><div>src/dm/impls/da/dadist.c<br></div><div>PetscErrorCode VecDuplicate_MPI_DA(Vec g,Vec *gg)<br></div><div>{</div><div> PetscErrorCode ierr;</div><div> DM da;</div><div> PetscLayout map;</div><div><br></div><div> PetscFunctionBegin;</div><div> ierr = VecGetDM(g, &da);CHKERRQ(ierr);</div><div> ierr = DMCreateGlobalVector(da,gg);CHKERRQ(ierr);</div><div> ierr = VecGetLayout(g,&map);CHKERRQ(ierr);</div><div> ierr = VecSetLayout(*gg,map);CHKERRQ(ierr);</div><div> PetscFunctionReturn(0);</div><div>}</div><div><br></div><div><div class="gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div>
</div>