Actual source code: ex11.c

petsc-3.8.4 2018-03-24
Report Typos and Errors

  2: static char help[] = "Tests PetscSynchronizedPrintf() and PetscSynchronizedFPrintf().\n\n";

  4:  #include <petscsys.h>

  6: int main(int argc,char **argv)
  7: {
  8:   PetscMPIInt    rank;

 11:   PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
 12:   MPI_Comm_rank(PETSC_COMM_WORLD,&rank);

 14:   PetscSynchronizedPrintf(PETSC_COMM_WORLD,"Greetings from %d\n",rank);
 15:   PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);

 17:   PetscSynchronizedFPrintf(PETSC_COMM_WORLD,PETSC_STDOUT,"Greetings again from %d\n",rank);
 18:   PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);

 20:   PetscFinalize();
 21:   return ierr;
 22: }



 26: /*TEST

 28:    test:
 29:       nsize: 3

 31: TEST*/