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