/************************************************************************ * * * L. L. N. L. " C " K E R N E L S: M F L O P S P C V E R S I O N * * * * These kernels measure " C " numerical computation * * rates for a spectrum of cpu-limited computational * * structures or benchmarks. Mathematical through-put * * is measured in units of millions of floating-point * * operations executed per second, called Megaflops/sec. * * * ************************************************************************ * Originally from Greg Astfalk, AT&T, P.O.Box 900, Princeton, * * NJ. 08540. by way of Frank McMahon (LLNL). * * * * Modifications by Tim Peters, Kendall Square Res. Corp. Oct 92. * * * * This version by Roy Longbottom (retired, ex-CCTA UK) * * Roy_Longbottom 101323.2241@compuserve.com * * March 1996 * * * * REFERENCE * * * * F.H.McMahon, The Livermore Fortran Kernels: * * A Computer Test Of The Numerical Performance Range, * * Lawrence Livermore National Laboratory, * * Livermore, California, UCRL-53745, December 1986. * * * * from: National Technical Information Service * * U.S. Department of Commerce * * 5285 Port Royal Road * * Springfield, VA. 22161 * * * ************************************************************************ * The standard "C" code accesses the FORTRAN version for data * * generation and result analysis. These features have been merged * * to produce a program more suitable to run on PCs. FORTRAN features * * for detailed statistical analysis of the results have been omitted. * * * * Changes to "C" code to produce correct results: * * * * Kernel 2 change i = ipntp - 1; to i = ipntp; * * Kernel 7 third line of inner loop change r to q * ************************************************************************ * Because of the inaccuracy of the PC clock, this version arranges * for timing to be based on at least five seconds. * * The kernels are executed as follows: * * parameters(x); * do * { * execute kernel code * * endloop(x); * } * while (count < loop); * * Function parameters obtains the loop parameters, generates all the data * and makes a copy of it for use with extra loops. Timing is started at * the end of the function. * * The variable loop has a defined number of passes (e.g. 7 for kernel 1, * long span - see Passes in table). This is multiplied by a further * constant for which checksums are defined - 200/400/1600 for long/medium * /short spans was chosen. The overhead of executing function endloop is * calculated as below. This is deducted from the total time but probably * could be ignored on PCs. * * The running time for each loop is set to a minimum of five seconds via * repeating all loops until each has recorded at least 0.07 seconds (see * calibration below). The extra loops required are shown under E in the * tables. The data used in the loops is re-initialised from the copy in * function endloop for each of the extra loops. The worst case overhead * of this has been measured as less than 1% and is ignored. Note, the * alternative of summing the time for each set of count passes cannot * be relied upon when the time for one set is of the same order of * magnitude as the clock resolution (0.05 to 0.06 seconds). Calibration * also gives an indication of the linearity of timing. In the example * shown, the overhead of 24 occurrences of data generation, which is * excluded from the main timing, is about 0.6 seconds. * * The total floating point operations for the first kernel 1 results are * 200 x 7 x 15 x 5 x 1001. For some other kernels, the total is not * proportional to the span. * * The OK column in the tables indicates the number of correct significant * digits out of 16 compared with the defined checksums. * * * Example of Results * * L.L.N.L. 'C' KERNELS: MFLOPS P.C. VERSION * * Calculating outer loop overhead * 1000 times 0.00 seconds * 10000 times 0.00 seconds * 100000 times 0.06 seconds * 1000000 times 0.33 seconds * 2000000 times 0.88 seconds * 4000000 times 1.59 seconds * 8000000 times 3.30 seconds * 16000000 times 6.64 seconds * Overhead for each loop 4.1500e-007 seconds * * Calibrating part 1 of 3 * * Loop count 4 0.94 seconds * Loop count 16 2.08 seconds * Loop count 32 3.52 seconds * Loop count 64 6.42 seconds * Loop count 128 12.31 seconds * * Loops 200 x 1 x Passes * * Kernel Floating Pt ops * No Passes E No Total Secs. MFLOPS Span Checksums OK * ------------ -- ------------- ----- ------- ---- ---------------------- -- * 1 7 x 15 5 1.051050e+008 5.10 20.60 1001 5.114652693224671e+004 16 * 2 67 x 21 4 1.091832e+008 5.20 20.98 101 1.539721811668384e+003 15 * 3 9 x 15 2 5.405400e+007 4.17 12.97 1001 1.000742883066364e+001 15 * 4 14 x 30 2 1.008000e+008 5.52 18.28 1001 5.999250595473891e-001 16 * 5 10 x 12 2 4.800000e+007 5.43 8.84 1001 4.548871642387267e+003 16 * 6 3 x 19 2 4.523520e+007 4.34 10.43 64 4.375116344729986e+003 16 * 7 4 x 10 16 1.273600e+008 4.45 28.64 995 6.104251075174761e+004 16 * 8 10 x 7 36 9.979200e+007 5.15 19.36 100 1.501268005625795e+005 15 * 9 36 x 6 17 7.417440e+007 5.20 14.26 101 1.189443609974981e+005 16 * 10 34 x 5 9 3.090600e+007 5.48 5.64 101 7.310369784325296e+004 16 * 11 11 x 15 1 3.300000e+007 5.65 5.84 1001 3.342910972650109e+007 16 * 12 12 x 30 1 7.200000e+007 6.50 11.08 1000 2.907141294167248e-005 16 * 13 36 x 4 7 1.290240e+007 6.41 2.01 64 1.202533961842804e+011 15 * 14 2 x 4 11 1.761760e+007 5.61 3.14 1001 3.165553044000335e+009 15 * 15 1 x 15 33 4.950000e+007 5.66 8.75 101 3.943816690352044e+004 15 * 16 25 x 30 10 7.950000e+007 6.14 12.95 75 5.650760000000000e+005 16 * 17 35 x 9 9 5.726700e+007 5.03 11.38 101 1.114641772902486e+003 16 * 18 2 x 11 44 9.583200e+007 5.76 16.64 100 1.015727037502299e+005 15 * 19 39 x 21 6 9.926280e+007 6.14 16.16 101 5.421816960147207e+002 16 * 20 1 x 15 26 7.800000e+007 5.93 13.16 1000 3.040644339351238e+007 16 * 21 1 x 1 2 2.525000e+007 6.37 3.96 101 1.597308280710200e+008 15 * 22 11 x 12 17 4.532880e+007 5.43 8.35 101 2.938604376566698e+002 15 * 23 8 x 12 11 1.045440e+008 5.10 20.49 100 3.549900501563624e+004 15 * 24 5 x 30 1 3.000000e+007 4.93 6.09 1001 5.000000000000000e+002 16 * * Maximum Rate 28.64 * Average Rate 12.50 * Geometric Mean 10.50 * Harmonic Mean 8.25 * Minimum Rate 2.01 * * Do Span 471 * * Calibrating part 2 of 3 * * Loop count 8 0.88 seconds * Loop count 32 1.86 seconds * Loop count 64 3.19 seconds * Loop count 128 5.77 seconds * Loop count 256 10.93 seconds * * Loops 200 x 2 x Passes * * Kernel Floating Pt ops * No Passes E No Total Secs. MFLOPS Span Checksums OK * ------------ -- ------------- ----- ------- ---- ---------------------- -- * 1 40 x 15 5 1.212000e+008 4.84 25.04 101 5.253344778937972e+002 16 * 2 40 x 20 4 1.241600e+008 5.91 21.02 101 1.539721811668384e+003 15 * 3 53 x 20 2 8.564800e+007 5.10 16.78 101 1.009741436578952e+000 16 * 4 70 x 32 2 1.075200e+008 4.29 25.07 101 5.999250595473891e-001 16 * 5 55 x 13 2 5.720000e+007 4.99 11.46 101 4.589031939600982e+001 16 * 6 7 x 19 2 5.107200e+007 4.70 10.87 32 8.631675645333210e+001 16 * 7 22 x 12 16 1.706496e+008 5.56 30.71 101 6.345586315784055e+002 16 * 8 6 x 6 36 1.026432e+008 5.26 19.50 100 1.501268005625795e+005 15 * 9 21 x 5 17 7.211400e+007 5.03 14.33 101 1.189443609974981e+005 16 * 10 19 x 5 9 3.454200e+007 6.13 5.63 101 7.310369784325296e+004 16 * 11 64 x 20 1 5.120000e+007 4.95 10.35 101 3.433560407475758e+004 16 * 12 68 x 20 1 5.440000e+007 5.16 10.53 100 7.127569130821465e-006 16 * 13 41 x 3 7 1.102080e+007 5.47 2.01 32 9.816387810944356e+010 15 * 14 10 x 4 11 1.777600e+007 5.49 3.24 101 3.039983465145392e+007 15 * 15 1 x 7 33 4.620000e+007 5.32 8.69 101 3.943816690352044e+004 15 * 16 27 x 21 10 6.350400e+007 5.02 12.66 40 6.480410000000000e+005 16 * 17 20 x 9 9 6.544800e+007 5.74 11.40 101 1.114641772902486e+003 16 * 18 1 x 10 44 8.712000e+007 5.22 16.69 100 1.015727037502299e+005 15 * 19 23 x 15 6 8.362800e+007 5.11 16.36 101 5.421816960147207e+002 16 * 20 8 x 9 26 7.488000e+007 5.43 13.80 100 3.126205178815432e+004 16 * 21 1 x 2 2 5.000000e+007 5.55 9.01 50 7.824524877232093e+007 16 * 22 7 x 9 17 4.326840e+007 5.21 8.31 101 2.938604376566698e+002 15 * 23 5 x 9 11 9.801000e+007 4.77 20.54 100 3.549900501563624e+004 15 * 24 31 x 30 1 3.720000e+007 6.06 6.14 101 5.000000000000000e+001 16 * * Maximum Rate 30.71 * Average Rate 13.76 * Geometric Mean 11.69 * Harmonic Mean 9.19 * Minimum Rate 2.01 * * Do Span 90 * * Calibrating part 3 of 3 * * Loop count 32 0.77 seconds * Loop count 128 1.54 seconds * Loop count 256 2.47 seconds * Loop count 512 4.34 seconds * Loop count 1024 8.13 seconds * * Loops 200 x 8 x Passes * * Kernel Floating Pt ops * No Passes E No Total Secs. MFLOPS Span Checksums OK * ------------ -- ------------- ----- ------- ---- ---------------------- -- * 1 28 x 22 5 1.330560e+008 5.31 25.05 27 3.855104502494961e+001 16 * 2 46 x 22 4 7.124480e+007 4.38 16.27 15 3.953296986903060e+001 16 * 3 37 x 23 2 7.352640e+007 4.26 17.24 27 2.699309089320672e-001 16 * 4 38 x 35 2 6.384000e+007 3.79 16.86 27 5.999250595473891e-001 16 * 5 40 x 23 2 7.654400e+007 4.45 17.20 27 3.182615248447483e+000 16 * 6 21 x 32 2 5.160960e+007 4.82 10.70 8 1.120309393467088e+000 15 * 7 20 x 12 16 1.290240e+008 4.24 30.43 21 2.845720217644024e+001 16 * 8 9 x 8 36 1.078272e+008 5.17 20.85 14 2.960543667875005e+003 15 * 9 26 x 16 17 1.697280e+008 5.33 31.82 15 2.623968460874250e+003 16 * 10 25 x 11 9 5.940000e+007 5.42 10.96 15 1.651291227698265e+003 16 * 11 46 x 22 1 4.209920e+007 3.67 11.48 27 6.551161335845770e+002 16 * 12 48 x 23 1 4.592640e+007 5.04 9.12 26 1.943435981130448e-006 16 * 13 31 x 4 7 1.111040e+007 5.57 2.00 8 3.847124199949431e+010 15 * 14 8 x 6 11 2.280960e+007 5.19 4.40 27 2.923540598672009e+006 15 * 15 1 x 15 33 5.544000e+007 6.14 9.03 15 1.108997288134785e+003 16 * 16 14 x 31 10 7.638400e+007 5.80 13.17 15 5.152160000000000e+005 16 * 17 26 x 11 9 6.177600e+007 5.14 12.02 15 2.947368618589360e+001 16 * 18 2 x 12 44 1.098240e+008 5.36 20.47 14 9.700646212337040e+002 16 * 19 28 x 21 6 8.467200e+007 5.38 15.74 15 1.268230698051004e+001 15 * 20 7 x 10 26 7.571200e+007 5.27 14.36 26 5.987713249475302e+002 16 * 21 1 x 2 2 8.000000e+007 5.50 14.55 20 5.009945671204667e+007 16 * 22 8 x 13 17 4.243200e+007 5.04 8.42 15 6.109968728263973e+000 16 * 23 7 x 15 11 1.201200e+008 4.38 27.42 14 4.850340602749970e+002 16 * 24 23 x 32 1 3.061760e+007 5.01 6.11 27 1.300000000000000e+001 16 * * Maximum Rate 31.82 * Average Rate 15.24 * Geometric Mean 13.06 * Harmonic Mean 10.26 * Minimum Rate 2.00 * * Do Span 19 * * Overall * * Part 1 weight 1 * Part 2 weight 2 * Part 3 weight 1 * * Maximum Rate 31.82 * Average Rate 13.81 * Geometric Mean 11.70 * Harmonic Mean 9.17 * Minimum Rate 2.00 * * Do Span 167 * * Enter the following data which will be filed with the results * * Month run 9/1996 * PC model Escom * CPU Pentium * Clock MHz 100 * Cache 256K * Options Neptune chipset * OS/DOS Windows 95 * Compiler Watcom C/C++ Version 10.5 * OptLevel Win386 -zp4 -otexan -om -fp5 -zc -5r * Run by Roy Longbottom * From UK * Mail 101323.2241@compuserve.com * * Note: the date, compiler and opt level are inserted by the program. * * The tables of results and running details are appended to file * LLloops.txt. * * When a single MFLOPS rating is claimed for this benchmark it is * usually the overall geometric mean result. * ********************************************************************** * * Pre-compiled codes were produced via a Watcom C/C++ 10.5 compiler. * Versions are available for DOS, Windows 3/95 and NT/Win 95. Both * non-optimised and optimised programs are available. The latter have * options as in the above example. * * In this source code, function prototypes are declared and function * headers have embedded parameter types to produce code for C and C++ * at least suitable for compiling as such with the Watcom compiler. * *********************************************************************** */ #include #include #include /* for following time function only */ #include struct Arrays { double U[1001]; double V[1001]; double W[1001]; double X[1001]; double Y[1001]; double Z[1001]; double G[1001]; double Du1[101]; double Du2[101]; double Du3[101]; double Grd[1001]; double Dex[1001]; double Xi[1001]; double Ex[1001]; double Ex1[1001]; double Dex1[1001]; double Vx[1001]; double Xx[1001]; double Rx[1001]; double Rh[2048]; double Vsp[101]; double Vstp[101]; double Vxne[101]; double Vxnd[101]; double Ve3[101]; double Vlr[101]; double Vlin[101]; double B5[101]; double Plan[300]; double D[300]; double Sa[101]; double Sb[101]; double P[512][4]; double Px[101][25]; double Cx[101][25]; double Vy[25][101]; double Vh[7][101]; double Vf[7][101]; double Vg[7][101]; double Vs[7][101]; double Za[7][101]; double Zp[7][101]; double Zq[7][101]; double Zr[7][101]; double Zm[7][101]; double Zb[7][101]; double Zu[7][101]; double Zv[7][101]; double Zz[7][101]; double B[64][64]; double C[64][64]; double H[64][64]; double U1[2][101][5]; double U2[2][101][5]; double U3[2][101][5]; double Xtra[40]; long E[96]; long F[96]; long Ix[1001]; long Ir[1001]; long Zone[301]; double X0[1001]; double W0[1001]; double Px0[101][25]; double P0[512][4]; double H0[64][64]; double Rh0[2048]; double Vxne0[101]; double Zr0[7][101]; double Zu0[7][101]; double Zv0[7][101]; double Zz0[7][101]; double Za0[101][25]; double Stb50; double Xx0; }as1; #define u as1.U #define v as1.V #define w as1.W #define x as1.X #define y as1.Y #define z as1.Z #define g as1.G #define du1 as1.Du1 #define du2 as1.Du2 #define du3 as1.Du3 #define grd as1.Grd #define dex as1.Dex #define xi as1.Xi #define ex as1.Ex #define ex1 as1.Ex1 #define dex1 as1.Dex1 #define vx as1.Vx #define xx as1.Xx #define rx as1.Rx #define rh as1.Rh #define vsp as1.Vsp #define vstp as1.Vstp #define vxne as1.Vxne #define vxnd as1.Vxnd #define ve3 as1.Ve3 #define vlr as1.Vlr #define vlin as1.Vlin #define b5 as1.B5 #define plan as1.Plan #define d as1.D #define sa as1.Sa #define sb as1.Sb #define p as1.P #define px as1.Px #define cx as1.Cx #define vy as1.Vy #define vh as1.Vh #define vf as1.Vf #define vg as1.Vg #define vs as1.Vs #define za as1.Za #define zb as1.Zb #define zp as1.Zp #define zq as1.Zq #define zr as1.Zr #define zm as1.Zm #define zz as1.Zz #define zu as1.Zu #define zv as1.Zv #define b as1.B #define c as1.C #define h as1.H #define u1 as1.U1 #define u2 as1.U2 #define u3 as1.U3 #define xtra as1.Xtra #define a11 as1.Xtra[1] #define a12 as1.Xtra[2] #define a13 as1.Xtra[3] #define a21 as1.Xtra[4] #define a22 as1.Xtra[5] #define a23 as1.Xtra[6] #define a31 as1.Xtra[7] #define a32 as1.Xtra[8] #define a33 as1.Xtra[9] #define c0 as1.Xtra[12] #define dk as1.Xtra[15] #define dm22 as1.Xtra[16] #define dm23 as1.Xtra[17] #define dm24 as1.Xtra[18] #define dm25 as1.Xtra[19] #define dm26 as1.Xtra[20] #define dm27 as1.Xtra[21] #define dm28 as1.Xtra[22] #define expmax as1.Xtra[26] #define flx as1.Xtra[27] #define q as1.Xtra[28] #define r as1.Xtra[30] #define s as1.Xtra[32] #define sig as1.Xtra[34] #define stb5 as1.Xtra[35] #define t as1.Xtra[36] #define xnm as1.Xtra[39] #define e as1.E #define f as1.F #define ix as1.Ix #define ir as1.Ir #define zone as1.Zone #define x0 as1.X0 #define w0 as1.W0 #define px0 as1.Px0 #define p0 as1.P0 #define h0 as1.H0 #define rh0 as1.Rh0 #define vxne0 as1.Vxne0 #define zr0 as1.Zr0 #define zu0 as1.Zu0 #define zv0 as1.Zv0 #define zz0 as1.Zz0 #define za0 as1.Za0 #define stb50 as1.Stb50 #define xx0 as1.Xx0 struct Parameters { long Inner_loops; long Outer_loops; long Loop_mult; double Flops_per_loop; double Sumcheck[3][25]; long Accuracy[3][25]; double LoopTime[3][25]; double LoopSpeed[3][25]; double LoopFlos[3][25]; long Xflops[25]; long Xloops[3][25]; long Nspan[3][25]; double TimeStart; double TimeEnd; double Loopohead; long Count; long Count2; long Pass; long Extra_loops[3][25]; long K2; long K3; long M16; long J5; long Section; long N16; double Mastersum; long M24; }as2; #define n as2.Inner_loops #define loop as2.Outer_loops #define mult as2.Loop_mult #define nflops as2.Flops_per_loop #define Checksum as2.Sumcheck #define accuracy as2.Accuracy #define RunTime as2.LoopTime #define Mflops as2.LoopSpeed #define FPops as2.LoopFlos #define nspan as2.Nspan #define xflops as2.Xflops #define xloops as2.Xloops #define StartTime as2.TimeStart #define EndTime as2.TimeEnd #define overhead_l as2.Loopohead #define count as2.Count #define count2 as2.Count2 #define pass as2.Pass #define extra_loops as2.Extra_loops #define k2 as2.K2 #define k3 as2.K3 #define m16 as2.M16 #define j5 as2.J5 #define section as2.Section #define n16 as2.N16 #define MasterSum as2.Mastersum #define m24 as2.M24 /*COMPILER COMPILER COMPILER COMPILER COMPILER COMPILER COMPILER*/ #ifdef COW #define compiler "Watcom C/C++ 10.5 Win386" #define options "-otexan -om -zp8 -fp5 -5r" #endif #ifdef CNW #define compiler "Watcom C/C++ 10.5 Win386" #define options " No optimisation" #endif #ifdef COD #define compiler "Watcom C/C++ 10.5 Dos4GW" #define options "-otexan -om -zp8 -fp5 -5r" #endif #ifdef CND #define compiler "Watcom C/C++ 10.5 Dos4GW" #define options " No optimisation" #endif #ifdef CONT #define compiler "Watcom C/C++ 10.5 Win32NT" #define options "-otexan -om -zp8 -fp5 -5r" #endif #ifdef CNNT #define compiler "Watcom C/C++ 10.5 Win32NT" #define options " No optimisation" #endif #ifdef COO2 #define compiler "Watcom C/C++ 10.5 OS/2-32" #define options "-otexan -om -zp8 -fp5 -5r" #endif #ifdef CNO2 #define compiler "Watcom C/C++ 10.5 OS/2-32" #define options " No optimisation" #endif #ifdef __GNUC__ #define compiler "GNU C/C++" #define options " No optimisation" #endif void init(long which); /* Initialises arrays and variables */ long endloop(long which); /* Controls outer loops and stores results */ long parameters(long which); /* Gets loop parameters and variables, starts timer */ void kernels(); /* The 24 kernels */ void check(long which); /* Calculates checksum accuracy */ void iqranf(); /* Random number generator for Kernel 14 */ /* TIME TIME TIME TIME TIME TIME TIME TIME TIME TIME TIME TIME TIME */ double what_time(double secs) { clock_t Time; Time = clock(); secs = (double)(Time) / (double)(CLOCKS_PER_SEC); return secs; } static char this_month; static int this_year; /* DATE DATE DATE DATE DATE DATE DATE DATE DATE DATE DATE DATE DATE */ void what_date() { return; } main(int argc, char *argv[]) { double pass_time, least, lmult, now = 1.0, wt; double time1, time2; long i, k, loop_passes; long mul[3] = {1, 2, 8}; double weight[3] = {1.0, 2.0, 1.0}; long Endit, which; double maximum[4]; double minimum[4]; double average[4]; double harmonic[4]; double geometric[4]; long xspan[4]; char general[9][80] = {" "}; FILE *outfile; int getinput = 1; if (argc > 1) { switch (argv[1][0]) { case 'N': getinput = 0; break; case 'n': getinput = 0; break; } } printf ("L.L.N.L. 'C' KERNELS: MFLOPS P.C. VERSION 4.0\n\n"); if (getinput == 0) { printf ("***** No run time input data *****\n\n"); } else { printf ("*** With run time input data ***\n\n"); } printf("Compiler %s\n",compiler); printf("Optimisation %s\n\n",options); /************************************************************************ * Calculate overhead of executing endloop procedure * ************************************************************************/ printf ("Calculating outer loop overhead\n"); pass = -20; extra_loops[0][0] = 1; loop = 1000; which = 0; section = 0; do { time1 = what_time(now); count = 0; count2 = 0; pass = pass + 1; do { endloop (0); } while (count < loop); time2 = what_time(now); overhead_l = (time2 - time1); printf ("%10d times %6.2f seconds\n", loop, overhead_l); if (overhead_l > 5.0) { pass = 0; } if (pass < 0) { if (overhead_l < 0.1) { loop = loop * 10; } else { loop = loop * 2; } } } while (pass < 0); overhead_l = overhead_l / (double)(loop); printf ("Overhead for each loop %12.4e seconds\n\n", overhead_l); /************************************************************************ * Execute the kernels three times at different Do Spans * ************************************************************************/ for ( section=0 ; section<3 ; section++ ) { loop_passes = 200 * mul[section]; pass = -20; mult = 2 * mul[section]; for ( i=1; i<25; i++) { extra_loops[section][i] = 1; } /************************************************************************ * Calculate extra loops for running time of 5 seconds per kernel * ************************************************************************/ printf ("Calibrating part %d of 3\n\n", section + 1); do /* Run a number of times with increased number of loops or until the time for each loop is at least 0.07 seconds */ { pass = pass + 1; mult = mult * 2; count2 = 0; for ( i=1; i<25; i++) { RunTime[section][i] = 0.0; } time1 = what_time(now); kernels(); time2 = what_time(now); pass_time = (time2 - time1); least = 1.0; for ( i=1; i<25; i++) { if (RunTime[section][i] < 0.07) { least = 0.0; RunTime[section][i] = 0.05; } } printf ("Loop count %10d %5.2f seconds\n", mult, pass_time); if (least > 0.0 ) { pass = 0; } else { if (pass_time < 1.0) { mult = mult * 2; } } } while (pass < 0); lmult = (double)(mult) / (double)(loop_passes); for ( i=1; i<25; i++) { /* Calculate extra loops to produce a run time of about 5 seconds for each kernel. For each of the extra loops the parameters are re-initialised. The time for initialising parameters is not included in the loop time. */ extra_loops[section][i] = (long)(5.0 / RunTime[section][i] * lmult) +1; RunTime[section][i] = 0.0; } mult = loop_passes; printf ("\nLoops 200 x %2d x Passes\n\n", mul[section]); printf ("Kernel Floating Pt ops\n"); printf ("No Passes E No Total Secs. MFLOPS Span " "Checksums OK\n"); printf ("------------ -- ------------- ----- ------- ---- " "---------------------- --\n"); pass = 1; count2 = 0; /************************************************************************ * Execute the kernels * ************************************************************************/ kernels(); maximum[section] = 0.0; minimum[section] = Mflops[section][1]; average[section] = 0.0; harmonic[section] = 0.0; geometric[section] = 0.0; xspan[section] = 0.0; /************************************************************************ * Calculate averages etc. * ************************************************************************/ for ( k=1 ; k<=24 ; k++ ) { average[section] = average[section] + Mflops[section][k]; harmonic[section] = harmonic[section] + 1 / Mflops[section][k]; geometric[section] = geometric[section] + log(Mflops[section][k]); xspan[section] = xspan[section] + nspan[section][k]; if (Mflops[section][k] < minimum[section]) { minimum[section] = Mflops[section][k]; } if (Mflops[section][k] > maximum[section]) { maximum[section] = Mflops[section][k]; } } average[section] = average[section] / 24.0; harmonic[section] = 24.0 / harmonic[section]; geometric[section] = exp(geometric[section] / 24.0); xspan[section] = xspan[section] / 24; if (pass > 0) /************************************************************************ * Display averages etc. except during calibration * ************************************************************************/ { printf ("\n"); printf (" Maximum Rate%8.2f \n", maximum[section]); printf (" Average Rate%8.2f \n", average[section]); printf (" Geometric Mean%8.2f \n", geometric[section]); printf (" Harmonic Mean%8.2f \n", harmonic[section]); printf (" Minimum Rate%8.2f \n\n", minimum[section]); printf (" Do Span %4d\n\n", xspan[section]); } } /************************************************************************ * End of executing the kernels three times at different Do Spans * ************************************************************************/ maximum[3] = 0.0; minimum[3] = Mflops[0][1]; average[3] = 0.0; harmonic[3] = 0.0; geometric[3] = 0.0; xspan[3] = 0; wt = 0.0; /************************************************************************ * Calculate weighted averages for all Do Spans and display * ************************************************************************/ for ( section=0 ; section<3 ; section++ ) { for ( k=1 ; k<=24 ; k++ ) { average[3] = average[3] + weight[section] * Mflops[section][k]; harmonic[3] = harmonic[3] + weight[section] / Mflops[section][k]; geometric[3] = geometric[3] + weight[section] * log(Mflops[section][k]); xspan[3] = xspan[3] + weight[section] * nspan[section][k]; if (Mflops[section][k] < minimum[3]) { minimum[3] = Mflops[section][k]; } if (Mflops[section][k] > maximum[3]) { maximum[3] = Mflops[section][k]; } } wt = wt + weight[section]; } average[3] = average[3] / (24.0 * wt); harmonic[3] = 24.0 * wt / harmonic[3]; geometric[3] = exp(geometric[3] / (24.0 * wt)); xspan[3] = xspan[3] / (24.0 * wt); printf (" Overall\n\n"); printf (" Part 1 weight 1\n"); printf (" Part 2 weight 2\n"); printf (" Part 3 weight 1\n\n"); printf (" Maximum Rate%8.2f \n", maximum[3]); printf (" Average Rate%8.2f \n", average[3]); printf (" Geometric Mean%8.2f \n", geometric[3]); printf (" Harmonic Mean%8.2f \n", harmonic[3]); printf (" Minimum Rate%8.2f \n\n", minimum[3]); printf (" Do Span %4d\n\n", xspan[3]); } /************************************************************************ * The Kernels * ************************************************************************/ void kernels() { long lw; long ipnt, ipntp, ii; double temp; long nl1, nl2; long kx, ky; double ar, br, cr; long i, j, k, m; long ip, i1, i2, j1, j2, j4, lb; long ng, nz; double tmp; double scale, xnei, xnc, e3,e6; long ink, jn, kn, kb5i; double di, dn; double qa; for ( k=0 ; k<25; k++) { Checksum[section][k] = 0.0; } /* ******************************************************************* * Kernel 1 -- hydro fragment ******************************************************************* */ parameters (1); do { for ( k=0 ; k0 ); endloop (2); } while (count < loop); /* ******************************************************************* * Kernel 3 -- inner product ******************************************************************* */ parameters (3); do { q = 0.0; for ( k=0 ; k= ng ) { vy[j][k] = 0.0; continue; } if ( vh[j+1][k] > vh[j][k] ) { t = ar; } else { t = br; } if ( vf[j][k] < vf[j][k-1] ) { if ( vh[j][k-1] > vh[j+1][k-1] ) r = vh[j][k-1]; else r = vh[j+1][k-1]; s = vf[j][k-1]; } else { if ( vh[j][k] > vh[j+1][k] ) r = vh[j][k]; else r = vh[j+1][k]; s = vf[j][k]; } vy[j][k] = sqrt( vg[j][k]*vg[j][k] + r*r )* t/s; if ( (k+1) >= nz ) { vs[j][k] = 0.0; continue; } if ( vf[j][k] < vf[j-1][k] ) { if ( vg[j-1][k] > vg[j-1][k+1] ) r = vg[j-1][k]; else r = vg[j-1][k+1]; s = vf[j-1][k]; t = br; } else { if ( vg[j][k] > vg[j][k+1] ) r = vg[j][k]; else r = vg[j][k+1]; s = vf[j][k]; t = ar; } vs[j][k] = sqrt( vh[j][k]*vh[j][k] + r*r )* t / s; } } endloop (15); } while (count < loop); /* ******************************************************************* * Kernel 16 -- Monte Carlo search loop ******************************************************************* */ parameters (16); ii = n / 3; lb = ii + ii; k3 = k2 = 0; do { i1 = m16 = 1; label410: j2 = ( n + n )*( m16 - 1 ) + 1; for ( k=1 ; k<=n ; k++ ) { k2++; j4 = j2 + k + k; j5 = zone[j4-1]; if ( j5 < n ) { if ( j5+lb < n ) { /* 420 */ tmp = plan[j5-1] - t; /* 435 */ } else { if ( j5+ii < n ) { /* 415 */ tmp = plan[j5-1] - s; /* 430 */ } else { tmp = plan[j5-1] - r; /* 425 */ } } } else if( j5 == n ) { break; /* 475 */ } else { k3++; /* 450 */ tmp=(d[j5-1]-(d[j5-2]*(t-d[j5-3])*(t-d[j5-3])+(s-d[j5-4])* (s-d[j5-4])+(r-d[j5-5])*(r-d[j5-5]))); } if ( tmp < 0.0 ) { if ( zone[j4-2] < 0 ) /* 445 */ continue; /* 470 */ else if ( !zone[j4-2] ) break; /* 480 */ } else if ( tmp ) { if ( zone[j4-2] > 0 ) /* 440 */ continue; /* 470 */ else if ( !zone[j4-2] ) break; /* 480 */ } else break; /* 485 */ m16++; /* 455 */ if ( m16 > zone[0] ) m16 = 1; /* 460 */ if ( i1-m16 ) /* 465 */ goto label410; else break; } endloop (16); } while (count < loop); /* ******************************************************************* * Kernel 17 -- implicit, conditional computation ******************************************************************* */ parameters (17); do { i = n-1; j = 0; ink = -1; scale = 5.0 / 3.0; xnm = 1.0 / 3.0; e6 = 1.03 / 3.07; goto l61; l60: e6 = xnm*vsp[i] + vstp[i]; vxne[i] = e6; xnm = e6; ve3[i] = e6; i += ink; if ( i==j ) goto l62; l61: e3 = xnm*vlr[i] + vlin[i]; xnei = vxne[i]; vxnd[i] = e6; xnc = scale*e3; if ( xnm > xnc ) goto l60; if ( xnei > xnc ) goto l60; ve3[i] = e3; e6 = e3 + e3 - xnm; vxne[i] = e3 + e3 - xnei; xnm = e6; i += ink; if ( i != j ) goto l61; l62:; endloop (17); } while (count < loop); /* ******************************************************************* * Kernel 18 - 2-D explicit hydrodynamics fragment ******************************************************************* */ parameters (18); do { t = 0.0037; s = 0.0041; kn = 6; jn = n; for ( k=1 ; k dn ) dn = s; } x[k] = ( ( w[k] + v[k]*dn )* xx[k] + u[k] ) / ( vx[k] + v[k]*dn ); xx[k+1] = ( x[k] - xx[k] )* dn + xx[k]; } endloop (20); } while (count < loop); /* ******************************************************************* * Kernel 21 -- matrix*matrix product ******************************************************************* */ parameters (21); do { for ( k=0 ; k<25 ; k++ ) { for ( i=0 ; i<25 ; i++ ) { for ( j=0 ; j= loop) /* else return */ { /************************************************************************ * End of standard set of loops for one kernel * ************************************************************************/ count2 = count2 + 1; if (count2 == extra_loops[section][which]) /* else re-initialise parameters if required */ { /************************************************************************ * End of extra loops for 5 seconds execution time * ************************************************************************/ count2 = 0; if (which == 1) { for ( k=0 ; k 0) { /************************************************************************ * Compare sumcheck with standard result, calculate accuracy * ************************************************************************/ check (which); printf ("%2d %3d x%4d %2d %13.6e %5.2f%8.2f %4d %22.15e %2d\n", which, xloops[section][which], extra_loops[section][which], xflops[which], FPops[section][which], RunTime[section][which], Mflops[section][which], nspan[section][which], Checksum[section][which], accuracy[section][which]); } } else { /************************************************************************ * Re-initialise data if reqired * ************************************************************************/ count = 0; if (which == 2) { for ( k=0 ; k Mmax) { ix[i] = inset + i + 1 * qq; } } return; }