xref: /petsc/src/benchmarks/PetscVecNorm.c (revision 3a40ed3dce77c081171d005ae1a6ff4bb9d13b6f)
1832676f5SBarry Smith #ifdef PETSC_RCS_HEADER
2*3a40ed3dSBarry Smith static char vcid[] = "$Id: PetscVecNorm.c,v 1.2 1997/07/10 03:46:48 bsmith Exp bsmith $";
34fcfa849SBarry Smith #endif
44fcfa849SBarry Smith 
5832676f5SBarry Smith #include "vec.h"
64fcfa849SBarry Smith 
74fcfa849SBarry Smith int main( int argc, char **argv)
84fcfa849SBarry Smith {
9832676f5SBarry Smith   Vec        x;
10832676f5SBarry Smith   double     norm;
11832676f5SBarry Smith   PLogDouble t1,t2;
12832676f5SBarry Smith   int        ierr,n = 10000,flg;
134fcfa849SBarry Smith 
144fcfa849SBarry Smith   PetscInitialize(&argc, &argv,0,0);
15832676f5SBarry Smith   ierr = OptionsGetInt(PETSC_NULL,"-n",&n,&flg); CHKERRA(ierr);
164fcfa849SBarry Smith 
17832676f5SBarry Smith   ierr = VecCreate(PETSC_COMM_SELF,n,&x); CHKERRA(ierr);
18832676f5SBarry Smith 
19832676f5SBarry Smith   /* To take care of paging effects */
20832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
21832676f5SBarry Smith 
22832676f5SBarry Smith   t1 = PetscGetTime();
23832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
24832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
25832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
26832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
27832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
28832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
29832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
30832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
31832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
32832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
33832676f5SBarry Smith   t2 = PetscGetTime();
34832676f5SBarry Smith   ierr = VecNorm(x,NORM_2,&norm); CHKERRA(ierr);
354fcfa849SBarry Smith 
364fcfa849SBarry Smith   fprintf(stderr,"%s : \n","PetscMemcpy");
37832676f5SBarry Smith   fprintf(stderr," Time %g\n",t2-t1);
384fcfa849SBarry Smith 
394fcfa849SBarry Smith   PetscFinalize();
40*3a40ed3dSBarry Smith   PetscFunctionReturn(0);
414fcfa849SBarry Smith }
42