Date: 2021-03-03T22:28:18+00:00

Actual source code: PetscMemzero.c
petsc-3.14.5 2021-03-03
Report Typos and Errors

      2: #include <petscsys.h>
      3: #include <petsctime.h>

      5: int main(int argc,char **argv)
      6: {
      7:   PetscLogDouble x,y,z;
      8:   PetscScalar    A[10000];

     11:   PetscInitialize(&argc,&argv,0,0);if (ierr) return ierr;
     12:   /* To take care of paging effects */
     13:   PetscMemzero(A,sizeof(PetscScalar)*0);
     14:   PetscTime(&x);

     16:   PetscTime(&x);
     17:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     18:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     19:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     20:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     21:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     22:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     23:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     24:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     25:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     26:   PetscMemzero(A,sizeof(PetscScalar)*10000);
     27:   PetscTime(&y);
     28:   PetscMemzero(A,sizeof(PetscScalar)*0);
     29:   PetscMemzero(A,sizeof(PetscScalar)*0);
     30:   PetscMemzero(A,sizeof(PetscScalar)*0);
     31:   PetscMemzero(A,sizeof(PetscScalar)*0);
     32:   PetscMemzero(A,sizeof(PetscScalar)*0);
     33:   PetscMemzero(A,sizeof(PetscScalar)*0);
     34:   PetscMemzero(A,sizeof(PetscScalar)*0);
     35:   PetscMemzero(A,sizeof(PetscScalar)*0);
     36:   PetscMemzero(A,sizeof(PetscScalar)*0);
     37:   PetscMemzero(A,sizeof(PetscScalar)*0);
     38:   PetscTime(&z);

     40:   fprintf(stdout,"%s : \n","PetscMemzero");
     41:   fprintf(stdout,"    %-15s : %e sec\n","Latency",(z-y)/10.0);
     42:   fprintf(stdout,"    %-15s : %e sec\n","Per PetscScalar",(2*y-x-z)/100000.0);

     44:   PetscFinalize();
     45:   return ierr;
     46: }