[petsc-users] Why PetscDestroy global collective semantics?

Barry Smith bsmith at petsc.dev
Fri Oct 22 21:13:11 CDT 2021


  One technical reason is that PetscHeaderDestroy_Private() may call PetscCommDestroy() which may call MPI_Comm_free() which is defined by the standard to be collective. Though PETSc tries to limit its use of new MPI communicators (for example generally many objects shared the same communicator) if we did not free those we no longer need when destroying objects we could run out.

  I cannot off-hand think of another specific technical reason they must be collective besides this good housekeeping. 

  In what use case can you not call them collectively?

  Barry


> On Oct 22, 2021, at 9:21 PM, Alberto F. Martín <amartin at cimne.upc.edu> wrote:
> 
> Dear PETSc users,
> 
> What is the main reason underlying PetscDestroy subroutines having global collective semantics? Is this actually true for all PETSc objects? Can this be relaxed/deactivated by, e.g., compilation macros/configuration options?
> 
> Thanks in advance!
> 
> Best regards,
> 
>  Alberto.
> 



More information about the petsc-users mailing list