Changeset 2584 in Sophya for trunk/Eval
- Timestamp:
- Jul 30, 2004, 1:04:18 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Eval/Speed/cpupower.c
r2553 r2584 17 17 #define T_Type double 18 18 19 static int SZ ; /* Taille de tableau */20 static double N_OP ; /* Nb operations */21 static int OPE ; /* Choix Operation fop_1/2/3/4 */22 static int ckprt ; /* > 0 : Print check apres calcul */19 static int SZ=20000; /* Taille de tableau */ 20 static double N_OP=0; /* Nb operations */ 21 static int OPE=0; /* Choix Operation fop_1/2/3/4 */ 22 static int ckprt=0; /* > 0 : Print check apres calcul */ 23 23 24 24 /* Tableaux X,Y,Z */ … … 26 26 static T_Type * y; 27 27 static T_Type * z; 28 29 void fop_0() 30 { 31 T_Type s=0; 32 int i,k; 33 printf("--- fop_0: Simple Loop: z[k] = x[k]*y[i] --- \n"); 34 for(k=0; k<SZ; k++) z[k] = x[k]*y[k]; 35 N_OP += SZ; 36 return; 37 } 28 38 29 39 void fop_1() … … 101 111 { 102 112 int maxnprt = 1000; 113 int nloop = 1000; 103 114 int i,nprt; 104 115 double mflops; … … 109 120 if (narg < 2) { 110 121 printf("--- Programme cpupower: (Puissance de calcul) ---- \n"); 111 printf(" Usage cpupower Op=1/2/3 [Size=20000] [CkPrt=0] \n"); 122 printf(" Usage cpupower Op=0/1/2/3/4/5 [Size=20000] [NLoop=1000] [CkPrt=0]\n"); 123 printf(" Op=0 Simple Loop: z[k] = x[k]*y[k] effectue NLoop fois\n"); 124 printf(" Size=10^6 par defaut, NLoop=100 \n"); 112 125 printf(" Op=1 Double Loop: z[k] = Somme_i(x[k]*y[i]) \n"); 113 126 printf(" Op=1 *,+=2 op / tour de boucle \n"); … … 120 133 printf(" Op=5 Double Loop: z[k] = Somme_i(x[k]*sin(y[i])+log(fabs(x[i])+0.1)+y[k]) \n"); 121 134 printf(" Op=5 ~ 100 op float / tour de boucle \n"); 135 printf(" Test 4,5 Size=2000 par defaut \n"); 122 136 return 1; 123 137 } 124 138 OPE = atoi(arg[1]); 125 139 SZ = 20000; 140 if (OPE == 0) SZ = 1000000; 141 if (OPE >= 4) SZ = 2000; 126 142 if (narg > 2) SZ = atoi(arg[2]); 143 nloop = 100; 144 if (narg > 3) nloop = atoi(arg[3]); 127 145 ckprt = 0; 128 if (narg > 3) ckprt = atoi(arg[ 3]);146 if (narg > 3) ckprt = atoi(arg[4]); 129 147 130 148 printf("::::::: cpupower: OPE=%d SZ= %d ::::::: \n", OPE,SZ); … … 136 154 x[i] = (T_Type)((random()%10000)-5000); 137 155 y[i] = (T_Type)((random()%10000)-5000); 138 y[i] = (T_Type)(0);156 z[i] = (T_Type)(0); 139 157 } 140 158 PrtTim("--Fin malloc+init x,y,z "); 159 N_OP = 0; 141 160 if (OPE == 5) fop_5(); 142 161 else if (OPE == 4) fop_4(); 143 162 else if (OPE == 3) fop_3(); 144 163 else if (OPE == 2) fop_2(); 145 else fop_1(); 164 else if (OPE == 1) fop_1(); 165 else for(i=0; i<nloop; i++) fop_0(); 146 166 PrtTim("---Fin OpeDoubleBoucle "); 147 167 mflops = N_OP/ GetPartialCPUTime()*1.e-6;
Note:
See TracChangeset
for help on using the changeset viewer.