flops.cpp
Go to the documentation of this file.
1 
17 /*---------------- Start Alburto's flops.c source code -----------------*/
18 
19 /*****************************/
20 /* flops.c */
21 /* Version 2.0, 18 Dec 1992 */
22 /* Al Aburto */
23 /* aburto@nosc.mil */
24 /*****************************/
25 
26 /*
27  Flops.c is a 'c' program which attempts to estimate your systems
28  floating-point 'MFLOPS' rating for the FADD, FSUB, FMUL, and FDIV
29  operations based on specific 'instruction mixes' (discussed below).
30  The program provides an estimate of PEAK MFLOPS performance by making
31  maximal use of register variables with minimal interaction with main
32  memory. The execution loops are all small so that they will fit in
33  any cache. Flops.c can be used along with Linpack and the Livermore
34  kernels (which exersize memory much more extensively) to gain further
35  insight into the limits of system performance. The flops.c execution
36  modules also include various percent weightings of FDIV's (from 0% to
37  25% FDIV's) so that the range of performance can be obtained when
38  using FDIV's. FDIV's, being computationally more intensive than
39  FADD's or FMUL's, can impact performance considerably on some systems.
40 
41  Flops.c consists of 8 independent modules (routines) which, except for
42  module 2, conduct numerical integration of various functions. Module
43  2, estimates the value of pi based upon the Maclaurin series expansion
44  of atan(1). MFLOPS ratings are provided for each module, but the
45  programs overall results are summerized by the MFLOPS(1), MFLOPS(2),
46  MFLOPS(3), and MFLOPS(4) outputs.
47 
48  The MFLOPS(1) result is identical to the result provided by all
49  previous versions of flops.c. It is based only upon the results from
50  modules 2 and 3. Two problems surfaced in using MFLOPS(1). First, it
51  was difficult to completely 'vectorize' the result due to the
52  recurrence of the 's' variable in module 2. This problem is addressed
53  in the MFLOPS(2) result which does not use module 2, but maintains
54  nearly the same weighting of FDIV's (9.2%) as in MFLOPS(1) (9.6%).
55  The second problem with MFLOPS(1) centers around the percentage of
56  FDIV's (9.6%) which was viewed as too high for an important class of
57  problems. This concern is addressed in the MFLOPS(3) result where NO
58  FDIV's are conducted at all.
59 
60  The number of floating-point instructions per iteration (loop) is
61  given below for each module executed:
62 
63  MODULE FADD FSUB FMUL FDIV TOTAL Comment
64  1 7 0 6 1 14 7.1% FDIV's
65  2 3 2 1 1 7 difficult to vectorize.
66  3 6 2 9 0 17 0.0% FDIV's
67  4 7 0 8 0 15 0.0% FDIV's
68  5 13 0 15 1 29 3.4% FDIV's
69  6 13 0 16 0 29 0.0% FDIV's
70  7 3 3 3 3 12 25.0% FDIV's
71  8 13 0 17 0 30 0.0% FDIV's
72 
73  A*2+3 21 12 14 5 52 A=5, MFLOPS(1), Same as
74  40.4% 23.1% 26.9% 9.6% previous versions of the
75  flops.c program. Includes
76  only Modules 2 and 3, does
77  9.6% FDIV's, and is not
78  easily vectorizable.
79 
80  1+3+4 58 14 66 14 152 A=4, MFLOPS(2), New output
81  +5+6+ 38.2% 9.2% 43.4% 9.2% does not include Module 2,
82  A*7 but does 9.2% FDIV's.
83 
84  1+3+4 62 5 74 5 146 A=0, MFLOPS(3), New output
85  +5+6+ 42.9% 3.4% 50.7% 3.4% does not include Module 2,
86  7+8 but does 3.4% FDIV's.
87 
88  3+4+6 39 2 50 0 91 A=0, MFLOPS(4), New output
89  +8 42.9% 2.2% 54.9% 0.0% does not include Module 2,
90  and does NO FDIV's.
91 
92  NOTE: Various timer routines are included as indicated below. The
93  timer routines, with some comments, are attached at the end
94  of the main program.
95 
96  NOTE: Please do not remove any of the printouts.
97 
98  EXAMPLE COMPILATION:
99  UNIX based systems
100  cc -DUNIX -O flops.c -o flops
101  cc -DUNIX -DROPT flops.c -o flops
102  cc -DUNIX -fast -O4 flops.c -o flops
103  .
104  .
105  .
106  etc.
107 
108  Al Aburto
109  aburto@nosc.mil
110 */
111 /*****************************************************************************
112 ** Includes
113 *****************************************************************************/
114 
115 #include <cstdio>
116 #include <cmath>
117 #include <ecl/config.hpp>
118 #include <ecl/command_line.hpp>
119 #include <ecl/threads/priority.hpp>
120 
121 /*****************************************************************************
122 ** Using
123 *****************************************************************************/
124 
125 using ecl::CmdLine;
127 
128 /*****************************************************************************
129 ** dtime() : Uses Posix .1 calls to evaluate the time.
130 *****************************************************************************/
131 
132 #if defined(ECL_IS_WIN32)
133  #include <windows.h>
134 
135  int dtime(double *p)
136  {
137  double q;
138 
139  q = p[2];
140 
141  p[2] = (double)GetTickCount() * 1.0e-03;
142  p[1] = p[2] - q;
143 
144  return 0;
145  }
146 #elif defined(ECL_IS_POSIX)
147  #include <unistd.h>
148  #include <limits.h>
149  #include <sys/times.h>
150 
151  int dtime(double *p)
152  {
153  static struct tms tms;
154 
155  double q;
156  times(&tms);
157  q = p[2];
158  p[2] = (double)tms.tms_utime / (double)_SC_CLK_TCK;
159  p[1] = p[2] - q;
160  return 0;
161  }
162 #endif
163 
164 
165 /*****************************************************************************
166 ** Main program
167 *****************************************************************************/
168 int main(int argc, char** argv)
169 {
170  try {
171  ecl::set_priority(ecl::RealTimePriority4);
172  } catch ( StandardException &e ) {
173  // dont worry about it.
174  }
175 
176  CmdLine cmd("Benchmarks the speed of computation (mflops) on this machine.");
177  cmd.parse(argc,argv);
178 
179  /*****************************************************************************
180  ** Variables
181  *****************************************************************************/
182 
183  double nulltime, TimeArray[3]; /* Variables needed for 'dtime()'. */
184  double TLimit; /* Threshold to determine Number of */
185  /* Loops to run. Fixed at 15.0 seconds.*/
186 
187  double T[36]; /* Global Array used to hold timing */
188  /* results and other information. */
189 
190  double sa,sb,sc,one,two,three;
191 // double sd;
192  double four,five,piref,piprg;
193  double scale,pierr;
194 
195  double A0 = 1.0;
196  double A1 = -0.1666666666671334;
197  double A2 = 0.833333333809067E-2;
198  double A3 = 0.198412715551283E-3;
199  double A4 = 0.27557589750762E-5;
200  double A5 = 0.2507059876207E-7;
201  double A6 = 0.164105986683E-9;
202 
203 // double B0 = 1.0;
204  double B1 = -0.4999999999982;
205  double B2 = 0.4166666664651E-1;
206  double B3 = -0.1388888805755E-2;
207  double B4 = 0.24801428034E-4;
208  double B5 = -0.2754213324E-6;
209  double B6 = 0.20189405E-8;
210 
211 // double C0 = 1.0;
212 // double C1 = 0.99999999668;
213 // double C2 = 0.49999995173;
214 // double C3 = 0.16666704243;
215 // double C4 = 0.4166685027E-1;
216 // double C5 = 0.832672635E-2;
217 // double C6 = 0.140836136E-2;
218 // double C7 = 0.17358267E-3;
219 // double C8 = 0.3931683E-4;
220 
221  double D1 = 0.3999999946405E-1;
222  double D2 = 0.96E-3;
223  double D3 = 0.1233153E-5;
224 
225  double E2 = 0.48E-3;
226  double E3 = 0.411051E-6;
227 
228  double s,u,v,w,x;
229 
230  long loops, NLimit;
231  register long i, m, n;
232 
233  printf("\n");
234  printf(" FLOPS C Program (Double Precision), V2.0 18 Dec 1992\n\n");
235 
236  /****************************/
237  loops = 15625; /* Initial number of loops. */
238  /* DO NOT CHANGE! */
239  /****************************/
240 
241  /****************************************************/
242  /* Set Variable Values. */
243  /* T[1] references all timing results relative to */
244  /* one million loops. */
245  /* */
246  /* The program will execute from 31250 to 512000000 */
247  /* loops based on a runtime of Module 1 of at least */
248  /* TLimit = 15.0 seconds. That is, a runtime of 15 */
249  /* seconds for Module 1 is used to determine the */
250  /* number of loops to execute. */
251  /* */
252  /* No more than NLimit = 512000000 loops are allowed*/
253  /****************************************************/
254 
255  T[1] = 1.0E+06/(double)loops;
256 
257  TLimit = 15.0;
258  NLimit = 512000000;
259 
260  piref = 3.14159265358979324;
261  one = 1.0;
262  two = 2.0;
263  three = 3.0;
264  four = 4.0;
265  five = 5.0;
266  scale = one;
267 
268  printf(" Module Error RunTime MFLOPS Math Calculation Operations\n");
269  printf(" (usec)\n");
270  /*************************/
271  /* Initialize the timer. */
272  /*************************/
273 
274  dtime(TimeArray);
275  dtime(TimeArray);
276 
277  /*******************************************************/
278  /* Module 1. Calculate integral of df(x)/f(x) defined */
279  /* below. Result is ln(f(1)). There are 14 */
280  /* double precision operations per loop */
281  /* ( 7 +, 0 -, 6 *, 1 / ) that are included */
282  /* in the timing. */
283  /* 50.0% +, 00.0% -, 42.9% *, and 07.1% / */
284  /*******************************************************/
285  n = loops;
286  sa = 0.0;
287 
288  s = 0.0; // Initialising to remove warning
289  x = 0.0;
290 
291  while ( sa < TLimit )
292  {
293  n = 2 * n;
294  x = one / (double)n; /*********************/
295  s = 0.0; /* Loop 1. */
296  v = 0.0; /*********************/
297  w = one;
298 
299  dtime(TimeArray);
300  for( i = 1 ; i <= n-1 ; i++ )
301  {
302  v = v + w;
303  u = v * x;
304  s = s + (D1+u*(D2+u*D3))/(w+u*(D1+u*(E2+u*E3)));
305  }
306  dtime(TimeArray);
307  sa = TimeArray[1];
308 
309  if ( n == NLimit ) break;
310  /* printf(" %10ld %12.5lf\n",n,sa); */
311  }
312 
313  scale = 1.0E+06 / (double)n;
314  T[1] = scale;
315 
316 /****************************************/
317 /* Estimate nulltime ('for' loop time). */
318 /****************************************/
319  dtime(TimeArray);
320  for( i = 1 ; i <= n-1 ; i++ )
321  {
322  }
323  dtime(TimeArray);
324  nulltime = T[1] * TimeArray[1];
325  if ( nulltime < 0.0 ) nulltime = 0.0;
326 
327  T[2] = T[1] * sa - nulltime;
328 
329  sa = (D1+D2+D3)/(one+D1+E2+E3);
330  sb = D1;
331 
332  T[3] = T[2] / 14.0; /*********************/
333  sa = x * ( sa + sb + two * s ) / two; /* Module 1 Results. */
334  sb = one / sa; /*********************/
335  n = (long)( (double)( 40000 * (long)sb ) / scale );
336  sc = sb - 25.2;
337  T[4] = one / T[3];
338  /********************/
339  /* DO NOT REMOVE */
340  /* THIS PRINTOUT! */
341  /********************/
342  printf(" 1 %13.4le %10.4lf %10.4lf Integration [ 7+, 0-, 6*, 1/]\n",sc,T[2],T[4]);
343 
344  m = n;
345 
346  /*******************************************************/
347  /* Module 2. Calculate value of PI from Taylor Series */
348  /* expansion of atan(1.0). There are 7 */
349  /* double precision operations per loop */
350  /* ( 3 +, 2 -, 1 *, 1 / ) that are included */
351  /* in the timing. */
352  /* 42.9% +, 28.6% -, 14.3% *, and 14.3% / */
353  /*******************************************************/
354 
355  s = -five; /********************/
356  sa = -one; /* Loop 2. */
357  /********************/
358  dtime(TimeArray);
359  for ( i = 1 ; i <= m ; i++ )
360  {
361  s = -s;
362  sa = sa + s;
363  }
364  dtime(TimeArray);
365  T[5] = T[1] * TimeArray[1];
366  if ( T[5] < 0.0 ) T[5] = 0.0;
367 
368  sc = (double)m;
369 
370  u = sa; /*********************/
371  v = 0.0; /* Loop 3. */
372  w = 0.0; /*********************/
373  x = 0.0;
374 
375  dtime(TimeArray);
376  for ( i = 1 ; i <= m ; i++)
377  {
378  s = -s;
379  sa = sa + s;
380  u = u + two;
381  x = x +(s - u);
382  v = v - s * u;
383  w = w + s / u;
384  }
385  dtime(TimeArray);
386  T[6] = T[1] * TimeArray[1];
387 
388  T[7] = ( T[6] - T[5] ) / 7.0; /*********************/
389  m = (long)( sa * x / sc ); /* PI Results */
390  sa = four * w / five; /*********************/
391  sb = sa + five / v;
392  sc = 31.25;
393  piprg = sb - sc / (v * v * v);
394  pierr = piprg - piref;
395  T[8] = one / T[7];
396  /*********************/
397  /* DO NOT REMOVE */
398  /* THIS PRINTOUT! */
399  /*********************/
400  printf(" 2 %13.4le %10.4lf %10.4lf Taylor Series [ 3+, 2-, 1*, 1/]\n",pierr,T[6]-T[5],T[8]);
401 
402  /*******************************************************/
403  /* Module 3. Calculate integral of sin(x) from 0.0 to */
404  /* PI/3.0 using Trapazoidal Method. Result */
405  /* is 0.5. There are 17 double precision */
406  /* operations per loop (6 +, 2 -, 9 *, 0 /) */
407  /* included in the timing. */
408  /* 35.3% +, 11.8% -, 52.9% *, and 00.0% / */
409  /*******************************************************/
410 
411  x = piref / ( three * (double)m ); /*********************/
412  s = 0.0; /* Loop 4. */
413  v = 0.0; /*********************/
414 
415  dtime(TimeArray);
416  for( i = 1 ; i <= m-1 ; i++ )
417  {
418  v = v + one;
419  u = v * x;
420  w = u * u;
421  s = s + u * ((((((A6*w-A5)*w+A4)*w-A3)*w+A2)*w+A1)*w+one);
422  }
423  dtime(TimeArray);
424  T[9] = T[1] * TimeArray[1] - nulltime;
425 
426  u = piref / three;
427  w = u * u;
428  sa = u * ((((((A6*w-A5)*w+A4)*w-A3)*w+A2)*w+A1)*w+one);
429 
430  T[10] = T[9] / 17.0; /*********************/
431  sa = x * ( sa + two * s ) / two; /* sin(x) Results. */
432  sb = 0.5; /*********************/
433  sc = sa - sb;
434  T[11] = one / T[10];
435  /*********************/
436  /* DO NOT REMOVE */
437  /* THIS PRINTOUT! */
438  /*********************/
439  printf(" 3 %13.4le %10.4lf %10.4lf Trapezoidal Sum (sin) [ 6+, 2-, 9*, 0/]\n",sc,T[9],T[11]);
440 
441 /************************************************************/
442 /* Module 4. Calculate Integral of cos(x) from 0.0 to PI/3 */
443 /* using the Trapazoidal Method. Result is */
444 /* sin(PI/3). There are 15 double precision */
445 /* operations per loop (7 +, 0 -, 8 *, and 0 / ) */
446 /* included in the timing. */
447 /* 50.0% +, 00.0% -, 50.0% *, 00.0% / */
448 /************************************************************/
449  A3 = -A3;
450  A5 = -A5;
451  x = piref / ( three * (double)m ); /*********************/
452  s = 0.0; /* Loop 5. */
453  v = 0.0; /*********************/
454 
455  dtime(TimeArray);
456  for( i = 1 ; i <= m-1 ; i++ )
457  {
458  u = (double)i * x;
459  w = u * u;
460  s = s + w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one;
461  }
462  dtime(TimeArray);
463  T[12] = T[1] * TimeArray[1] - nulltime;
464 
465  u = piref / three;
466  w = u * u;
467  sa = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one;
468 
469  T[13] = T[12] / 15.0; /*******************/
470  sa = x * ( sa + one + two * s ) / two; /* Module 4 Result */
471  u = piref / three; /*******************/
472  w = u * u;
473  sb = u * ((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+A0);
474  sc = sa - sb;
475  T[14] = one / T[13];
476  /*********************/
477  /* DO NOT REMOVE */
478  /* THIS PRINTOUT! */
479  /*********************/
480  printf(" 4 %13.4le %10.4lf %10.4lf Trapezoidal Sum (cos) [ 7+, 0-, 8*, 0/]\n",sc,T[12],T[14]);
481 
482 /************************************************************/
483 /* Module 5. Calculate Integral of tan(x) from 0.0 to PI/3 */
484 /* using the Trapazoidal Method. Result is */
485 /* ln(cos(PI/3)). There are 29 double precision */
486 /* operations per loop (13 +, 0 -, 15 *, and 1 /)*/
487 /* included in the timing. */
488 /* 46.7% +, 00.0% -, 50.0% *, and 03.3% / */
489 /************************************************************/
490 
491  x = piref / ( three * (double)m ); /*********************/
492  s = 0.0; /* Loop 6. */
493  v = 0.0; /*********************/
494 
495  dtime(TimeArray);
496  for( i = 1 ; i <= m-1 ; i++ )
497  {
498  u = (double)i * x;
499  w = u * u;
500  v = u * ((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one);
501  s = s + v / (w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one);
502  }
503  dtime(TimeArray);
504  T[15] = T[1] * TimeArray[1] - nulltime;
505 
506  u = piref / three;
507  w = u * u;
508  sa = u*((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one);
509  sb = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one;
510  sa = sa / sb;
511 
512  T[16] = T[15] / 29.0; /*******************/
513  sa = x * ( sa + two * s ) / two; /* Module 5 Result */
514  sb = 0.6931471805599453; /*******************/
515  sc = sa - sb;
516  T[17] = one / T[16];
517  /*********************/
518  /* DO NOT REMOVE */
519  /* THIS PRINTOUT! */
520  /*********************/
521  printf(" 5 %13.4le %10.4lf %10.4lf Trapezoidal Sum (tan) [13+, 0-,15*, 1/]\n",sc,T[15],T[17]);
522 
523 /************************************************************/
524 /* Module 6. Calculate Integral of sin(x)*cos(x) from 0.0 */
525 /* to PI/4 using the Trapazoidal Method. Result */
526 /* is sin(PI/4)^2. There are 29 double precision */
527 /* operations per loop (13 +, 0 -, 16 *, and 0 /)*/
528 /* included in the timing. */
529 /* 46.7% +, 00.0% -, 53.3% *, and 00.0% / */
530 /************************************************************/
531 
532  x = piref / ( four * (double)m ); /*********************/
533  s = 0.0; /* Loop 7. */
534  v = 0.0; /*********************/
535 
536  dtime(TimeArray);
537  for( i = 1 ; i <= m-1 ; i++ )
538  {
539  u = (double)i * x;
540  w = u * u;
541  v = u * ((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one);
542  s = s + v*(w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one);
543  }
544  dtime(TimeArray);
545  T[18] = T[1] * TimeArray[1] - nulltime;
546 
547  u = piref / four;
548  w = u * u;
549  sa = u*((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one);
550  sb = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one;
551  sa = sa * sb;
552 
553  T[19] = T[18] / 29.0; /*******************/
554  sa = x * ( sa + two * s ) / two; /* Module 6 Result */
555  sb = 0.25; /*******************/
556  sc = sa - sb;
557  T[20] = one / T[19];
558  /*********************/
559  /* DO NOT REMOVE */
560  /* THIS PRINTOUT! */
561  /*********************/
562  printf(" 6 %13.4le %10.4lf %10.4lf Trapezoidal Sum (sin*cos) [13+, 0-,16*, 0/]\n",sc,T[18],T[20]);
563 
564 
565 /*******************************************************/
566 /* Module 7. Calculate value of the definite integral */
567 /* from 0 to sa of 1/(x+1), x/(x*x+1), and */
568 /* x*x/(x*x*x+1) using the Trapizoidal Rule.*/
569 /* There are 12 double precision operations */
570 /* per loop ( 3 +, 3 -, 3 *, and 3 / ) that */
571 /* are included in the timing. */
572 /* 25.0% +, 25.0% -, 25.0% *, and 25.0% / */
573 /*******************************************************/
574 
575  /*********************/
576  s = 0.0; /* Loop 8. */
577  w = one; /*********************/
578  sa = 102.3321513995275;
579  v = sa / (double)m;
580 
581  dtime(TimeArray);
582  for ( i = 1 ; i <= m-1 ; i++)
583  {
584  x = (double)i * v;
585  u = x * x;
586  s = s - w / ( x + w ) - x / ( u + w ) - u / ( x * u + w );
587  }
588  dtime(TimeArray);
589  T[21] = T[1] * TimeArray[1] - nulltime;
590  /*********************/
591  /* Module 7 Results */
592  /*********************/
593  T[22] = T[21] / 12.0;
594  x = sa;
595  u = x * x;
596  sa = -w - w / ( x + w ) - x / ( u + w ) - u / ( x * u + w );
597  sa = 18.0 * v * (sa + two * s );
598 
599  m = -2000 * (long)sa;
600  m = (long)( (double)m / scale );
601 
602  sc = sa + 500.2;
603  T[23] = one / T[22];
604  /********************/
605  /* DO NOT REMOVE */
606  /* THIS PRINTOUT! */
607  /********************/
608  printf(" 7 %13.4le %10.4lf %10.4lf Trapezoidal Sum (polynomial) [ 3+, 3-, 3*, 3/]\n",sc,T[21],T[23]);
609 
610 /************************************************************/
611 /* Module 8. Calculate Integral of sin(x)*cos(x)*cos(x) */
612 /* from 0 to PI/3 using the Trapazoidal Method. */
613 /* Result is (1-cos(PI/3)^3)/3. There are 30 */
614 /* double precision operations per loop included */
615 /* in the timing: */
616 /* 13 +, 0 -, 17 * 0 / */
617 /* 46.7% +, 00.0% -, 53.3% *, and 00.0% / */
618 /************************************************************/
619 
620  x = piref / ( three * (double)m ); /*********************/
621  s = 0.0; /* Loop 9. */
622  v = 0.0; /*********************/
623 
624  dtime(TimeArray);
625  for( i = 1 ; i <= m-1 ; i++ )
626  {
627  u = (double)i * x;
628  w = u * u;
629  v = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one;
630  s = s + v*v*u*((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one);
631  }
632  dtime(TimeArray);
633  T[24] = T[1] * TimeArray[1] - nulltime;
634 
635  u = piref / three;
636  w = u * u;
637  sa = u*((((((A6*w+A5)*w+A4)*w+A3)*w+A2)*w+A1)*w+one);
638  sb = w*(w*(w*(w*(w*(B6*w+B5)+B4)+B3)+B2)+B1)+one;
639  sa = sa * sb * sb;
640 
641  T[25] = T[24] / 30.0; /*******************/
642  sa = x * ( sa + two * s ) / two; /* Module 8 Result */
643  sb = 0.29166666666666667; /*******************/
644  sc = sa - sb;
645  T[26] = one / T[25];
646  /*********************/
647  /* DO NOT REMOVE */
648  /* THIS PRINTOUT! */
649  /*********************/
650  printf(" 8 %13.4le %10.4lf %10.4lf Trapezoidal Sum (sin*cos*cos) [13+, 0-,17*, 0/]\n",sc,T[24],T[26]);
651 
652 /**************************************************/
653 /* MFLOPS(1) output. This is the same weighting */
654 /* used for all previous versions of the flops.c */
655 /* program. Includes Modules 2 and 3 only. */
656 /**************************************************/
657  T[27] = ( five * (T[6] - T[5]) + T[9] ) / 52.0;
658  T[28] = one / T[27];
659 
660 /**************************************************/
661 /* MFLOPS(2) output. This output does not include */
662 /* Module 2, but it still does 9.2% FDIV's. */
663 /**************************************************/
664  T[29] = T[2] + T[9] + T[12] + T[15] + T[18];
665  T[29] = (T[29] + four * T[21]) / 152.0;
666  T[30] = one / T[29];
667 
668 /**************************************************/
669 /* MFLOPS(3) output. This output does not include */
670 /* Module 2, but it still does 3.4% FDIV's. */
671 /**************************************************/
672  T[31] = T[2] + T[9] + T[12] + T[15] + T[18];
673  T[31] = (T[31] + T[21] + T[24]) / 146.0;
674  T[32] = one / T[31];
675 
676 /**************************************************/
677 /* MFLOPS(4) output. This output does not include */
678 /* Module 2, and it does NO FDIV's. */
679 /**************************************************/
680  T[33] = (T[9] + T[12] + T[18] + T[24]) / 91.0;
681  T[34] = one / T[33];
682 
683 
684  printf("\n");
685  printf("Averaging various groups above\n");
686  printf("\n");
687  printf(" Iterations = %10ld\n",m);
688  printf(" NullTime (usec) = %10.4lf\n",nulltime);
689  printf(" MFLOPS(1) = %10.4lf [generic 2,3 only]\n",T[28]);
690  printf(" MFLOPS(2) = %10.4lf [9.2%% fp divisions]\n",T[30]);
691  printf(" MFLOPS(3) = %10.4lf [3.4%% fp divisions]\n",T[32]);
692  printf(" MFLOPS(4) = %10.4lf [0.0%% fp divisions]\n\n",T[34]);
693 
694  return 0;
695 }
int main(int argc, char **argv)
Definition: flops.cpp:168
RealTimePriority4
void parse(int argc, char **argv)


ecl_core_apps
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:55