Actual source code: ex11.c
petsc-3.6.1 2015-08-06
2: static char help[] = "Tests PetscSynchronizedPrintf() and PetscSynchronizedFPrintf().\n\n";
4: #include <petscsys.h>
8: int main(int argc,char **argv)
9: {
10: PetscMPIInt rank;
13: PetscInitialize(&argc,&argv,(char*)0,help);
14: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
16: PetscSynchronizedPrintf(PETSC_COMM_WORLD,"Greetings from %d\n",rank);
17: PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);
19: PetscSynchronizedFPrintf(PETSC_COMM_WORLD,stderr,"Greetings again from %d\n",rank);
20: PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);
22: PetscFinalize();
23: return 0;
24: }