Actual source code: MPI_Wtime.c

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

  2:  #include <petscsys.h>

  4: int main(int argc,char **argv)
  5: {
  6:   double x,y;
  7:   int    ierr;

  9:   PetscInitialize(&argc,&argv,0,0);if (ierr) return ierr;
 10:   /* To take care of paging effects */
 11:   y = MPI_Wtime();

 13:   x = MPI_Wtime();
 14:   y = MPI_Wtime();
 15:   y = MPI_Wtime();
 16:   y = MPI_Wtime();
 17:   y = MPI_Wtime();
 18:   y = MPI_Wtime();
 19:   y = MPI_Wtime();
 20:   y = MPI_Wtime();
 21:   y = MPI_Wtime();
 22:   y = MPI_Wtime();
 23:   y = MPI_Wtime();

 25:   fprintf(stdout,"%-15s : %e sec\n","MPI_Wtime",(y-x)/10.0);
 26:   y = MPI_Wtick();
 27:   fprintf(stdout,"%-15s : %e sec\n","MPI_Wtick",y);

 29:   x    = MPI_Wtime();
 30:   PetscSleep(10);
 31:   y    = MPI_Wtime();
 32:   fprintf(stdout,"%-15s : %e sec - Slept for 10 sec \n","MPI_Wtime",(y-x));

 34:   PetscFinalize();
 35:   return ierr;
 36: }