1 2 #include <petsc/private/petscimpl.h> /*I "petscsys.h" I*/ 3 4 /* Logging support */ 5 PetscLogEvent PETSC_Barrier=0; 6 7 #undef __FUNCT__ 8 #define __FUNCT__ "PetscBarrier" 9 /*@C 10 PetscBarrier - Blocks until this routine is executed by all 11 processors owning the object A. 12 13 Input Parameters: 14 . A - PETSc object (Mat, Vec, IS, SNES etc...) 15 Must be caste with a (PetscObject), can use NULL (for MPI_COMM_WORLD) 16 17 Level: intermediate 18 19 Notes: 20 This routine calls MPI_Barrier with the communicator of the PETSc Object "A". 21 22 With fortran Use NULL_OBJECT (instead of NULL) 23 24 Concepts: barrier 25 26 @*/ 27 PetscErrorCode PetscBarrier(PetscObject obj) 28 { 29 PetscErrorCode ierr; 30 MPI_Comm comm; 31 32 PetscFunctionBegin; 33 if (obj) PetscValidHeader(obj,1); 34 ierr = PetscLogEventBegin(PETSC_Barrier,obj,0,0,0);CHKERRQ(ierr); 35 if (obj) { 36 ierr = PetscObjectGetComm(obj,&comm);CHKERRQ(ierr); 37 } else comm = PETSC_COMM_WORLD; 38 ierr = MPI_Barrier(comm);CHKERRQ(ierr); 39 ierr = PetscLogEventEnd(PETSC_Barrier,obj,0,0,0);CHKERRQ(ierr); 40 PetscFunctionReturn(0); 41 } 42 43