Actual source code: pbarrier.c

petsc-3.3-p7 2013-05-11
  2: #include <petscsys.h>              /*I "petscsys.h" I*/

  4: /* Logging support */
  5: PetscLogEvent PETSC_Barrier=0;

  9: /*@C
 10:     PetscBarrier - Blocks until this routine is executed by all
 11:                    processors owning the object A.

 13:    Input Parameters:
 14: .  A - PETSc object  (Mat, Vec, IS, SNES etc...)
 15:         Must be caste with a (PetscObject), can use PETSC_NULL (for MPI_COMM_WORLD)

 17:   Level: intermediate

 19:   Notes: 
 20:   This routine calls MPI_Barrier with the communicator of the PETSc Object "A". 

 22:   With fortran Use PETSC_NULL_OBJECT (instead of PETSC_NULL) 

 24:    Concepts: barrier

 26: @*/
 27: PetscErrorCode  PetscBarrier(PetscObject obj)
 28: {
 30:   MPI_Comm       comm;

 34:   PetscLogEventBegin(PETSC_Barrier,obj,0,0,0);
 35:   if (obj) {
 36:     PetscObjectGetComm(obj,&comm);
 37:   } else {
 38:     comm = PETSC_COMM_WORLD;
 39:   }
 40:   MPI_Barrier(comm);
 41:   PetscLogEventEnd(PETSC_Barrier,obj,0,0,0);
 42:   return(0);
 43: }