Beispiel #1
0
        public void runBenchMark()
        {
            BMArgs.Banner(BMName, CLASS, serial, num_threads);
            Console.WriteLine(" Size = " + nx + " X " + ny + " X " + nz
                              + " niter = " + niter_default);
            setTimers();
            timer.resetAllTimers();

            if (serial)
            {
                appft_serial();
            }

            if (timeron)
            {
                timer.start(14);
            }
            int verified = verify(4, nx, ny, nz, niter_default, checksum);

            if (timeron)
            {
                timer.stop(14);
            }
            timer.stop(1);

            double time = timer.readTimer(1);

            results = new BMResults(BMName,
                                    CLASS,
                                    nx,
                                    ny,
                                    nz,
                                    niter_default,
                                    time,
                                    getMFLOPS(time, nx, ny, nz),
                                    "floating point",
                                    verified,
                                    serial,
                                    num_threads,
                                    bid);
            results.print();
            if (timeron)
            {
                printTimers();
            }
            done = true;
        }
        private void runBenchmark()
        {
            setup_mpi();

            if (!active)
            {
                Console.WriteLine("not active !");
                System.Environment.Exit(0);
            }
            //int niter = -1;
            if (node == root)
            {
                BMArgs.Banner(BMName, problem_class.ToString()[0], false, total_nodes);
            }

            // Process.make_set();

            for (int c = 0; c < ncells; c++)
            {
                if ((cell_size[c, 0] > Problem.IMAX) ||
                    (cell_size[c, 1] > Problem.JMAX) ||
                    (cell_size[c, 2] > Problem.KMAX))
                {
                    Console.WriteLine("Problem size too big for compiled array sizes");
                    System.Environment.Exit(0);
                }
            }

            //Problem.initialize_problem_data();
            //Problem.set_constants(0);

            Initialize.go();
            Lhsinit.go();
            Exact_rhs.go();
            //compute_buffer_size(5);

            //---------------------------------------------------------------------
            //      do one time step to touch all code, and reinitialize
            //---------------------------------------------------------------------
            Adi.go();
            Initialize.go();

            //---------------------------------------------------------------------
            //      Synchronize before placing time stamp
            //---------------------------------------------------------------------

            comm_setup.Barrier();

            Timer.resetAllTimers();
            Timer.start(t_total);

            Console.WriteLine("STARTING"); Console.Out.Flush();

            for (int step = 1; step <= niter; step++)
            {
                if (node == 0 && (step % 20 == 0 || step == 1 || step == niter))
                {
                    Console.WriteLine("Time step " + step);
                }
                Adi.go();
            }

            Timer.stop(1);

            Verify.go();
            int verified = Verify.Verified;

            double tmax = Timer.readTimerGlobal(t_total);

            if (node == root)
            {
                double time = Timer.readTimer(t_total);
                results = new BMResults(BMName,
                                        problem_class.ToString()[0],
                                        grid_points[0],
                                        grid_points[1],
                                        grid_points[2],
                                        niter,
                                        time,
                                        getMFLOPS(time, niter),
                                        "floating point",
                                        verified,
                                        true,
                                        total_nodes,
                                        bid);
                results.print();
            }
            worldcomm.Barrier();
        }
Beispiel #3
0
        public int verify(int ires, int n1, int n2, int n3, int nt, double[,] cksum)
        {
            int verified = -1;

            bool[] temp = new bool[niter_default];
            double[,] cexpd = new double[21, 2];
            if ((n1 == 64) && (n2 == 64) && (n3 == 64) && (nt == 6))
            {
                //
                // Class S reference values.
                //
                cexpd[0, REAL] = 554.6087004964;
                cexpd[1, REAL] = 554.6385409189;
                cexpd[2, REAL] = 554.6148406171;
                cexpd[3, REAL] = 554.5423607415;
                cexpd[4, REAL] = 554.4255039624;
                cexpd[5, REAL] = 554.2683411902;

                cexpd[0, IMAG] = 484.5363331978;
                cexpd[1, IMAG] = 486.5304269511;
                cexpd[2, IMAG] = 488.3910722336;
                cexpd[3, IMAG] = 490.1273169046;
                cexpd[4, IMAG] = 491.7475857993;
                cexpd[5, IMAG] = 493.2597244941;
            }
            else if ((n1 == 128) && (n2 == 128) && (n3 == 32) && (nt == 6))
            {
                //
                // Class W reference values.
                //
                cexpd[0, REAL] = 567.3612178944;
                cexpd[1, REAL] = 563.1436885271;
                cexpd[2, REAL] = 559.4024089970;
                cexpd[3, REAL] = 556.0698047020;
                cexpd[4, REAL] = 553.0898991250;
                cexpd[5, REAL] = 550.4159734538;

                cexpd[0, IMAG] = 529.3246849175;
                cexpd[1, IMAG] = 528.2149986629;
                cexpd[2, IMAG] = 527.0996558037;
                cexpd[3, IMAG] = 526.0027904925;
                cexpd[4, IMAG] = 524.9400845633;
                cexpd[5, IMAG] = 523.9212247086;
                //
            }
            else if ((n1 == 256) && (n2 == 256) && (n3 == 128) && (nt == 6))
            {
                //
                // Class A reference values.
                //
                cexpd[0, REAL] = 504.6735008193;
                cexpd[1, REAL] = 505.9412319734;
                cexpd[2, REAL] = 506.9376896287;
                cexpd[3, REAL] = 507.7892868474;
                cexpd[4, REAL] = 508.5233095391;
                cexpd[5, REAL] = 509.1487099959;

                cexpd[0, IMAG] = 511.4047905510;
                cexpd[1, IMAG] = 509.8809666433;
                cexpd[2, IMAG] = 509.8144042213;
                cexpd[3, IMAG] = 510.1336130759;
                cexpd[4, IMAG] = 510.4914655194;
                cexpd[5, IMAG] = 510.7917842803;
                //
            }
            else if ((n1 == 512) && (n2 == 256) && (n3 == 256) && (nt == 20))
            {
                //
                // Class B reference values.
                //
                cexpd[0, REAL]  = 517.7643571579;
                cexpd[1, REAL]  = 515.4521291263;
                cexpd[2, REAL]  = 514.6409228649;
                cexpd[3, REAL]  = 514.2378756213;
                cexpd[4, REAL]  = 513.9626667737;
                cexpd[5, REAL]  = 513.7423460082;
                cexpd[6, REAL]  = 513.5547056878;
                cexpd[7, REAL]  = 513.3910925466;
                cexpd[8, REAL]  = 513.2470705390;
                cexpd[9, REAL]  = 513.1197729984;
                cexpd[10, REAL] = 513.0070319283;
                cexpd[11, REAL] = 512.9070537032;
                cexpd[12, REAL] = 512.8182883502;
                cexpd[13, REAL] = 512.7393733383;
                cexpd[14, REAL] = 512.6691062020;
                cexpd[15, REAL] = 512.6064276004;
                cexpd[16, REAL] = 512.5504076570;
                cexpd[17, REAL] = 512.5002331720;
                cexpd[18, REAL] = 512.4551951846;
                cexpd[19, REAL] = 512.4146770029;

                cexpd[0, IMAG]  = 507.7803458597;
                cexpd[1, IMAG]  = 508.8249431599;
                cexpd[2, IMAG]  = 509.6208912659;
                cexpd[3, IMAG]  = 510.1023387619;
                cexpd[4, IMAG]  = 510.3976610617;
                cexpd[5, IMAG]  = 510.5948019802;
                cexpd[6, IMAG]  = 510.7404165783;
                cexpd[7, IMAG]  = 510.8576573661;
                cexpd[8, IMAG]  = 510.9577278523;
                cexpd[9, IMAG]  = 511.0460304483;
                cexpd[10, IMAG] = 511.1252433800;
                cexpd[11, IMAG] = 511.1968077718;
                cexpd[12, IMAG] = 511.2616233064;
                cexpd[13, IMAG] = 511.3203605551;
                cexpd[14, IMAG] = 511.3735928093;
                cexpd[15, IMAG] = 511.4218460548;
                cexpd[16, IMAG] = 511.4656139760;
                cexpd[17, IMAG] = 511.5053595966;
                cexpd[18, IMAG] = 511.5415130407;
                cexpd[19, IMAG] = 511.5744692211;
                //
            }
            else if ((n1 == 512) && (n2 == 512) &&
                     (n3 == 512) && (nt == 20))
            {
                //
                // Class C reference values.
                //
                cexpd[0, REAL]  = 519.5078707457;
                cexpd[1, REAL]  = 515.5422171134;
                cexpd[2, REAL]  = 514.4678022222;
                cexpd[3, REAL]  = 514.0150594328;
                cexpd[4, REAL]  = 513.7550426810;
                cexpd[5, REAL]  = 513.5811056728;
                cexpd[6, REAL]  = 513.4569343165;
                cexpd[7, REAL]  = 513.3651975661;
                cexpd[8, REAL]  = 513.2955192805;
                cexpd[9, REAL]  = 513.2410471738;
                cexpd[10, REAL] = 513.1971141679;
                cexpd[11, REAL] = 513.1605205716;
                cexpd[12, REAL] = 513.1290734194;
                cexpd[13, REAL] = 513.1012720314;
                cexpd[14, REAL] = 513.0760908195;
                cexpd[15, REAL] = 513.0528295923;
                cexpd[16, REAL] = 513.0310107773;
                cexpd[17, REAL] = 513.0103090133;
                cexpd[18, REAL] = 512.9905029333;
                cexpd[19, REAL] = 512.9714421109;

                cexpd[0, IMAG]  = 514.9019699238;
                cexpd[1, IMAG]  = 512.7578201997;
                cexpd[2, IMAG]  = 512.2251847514;
                cexpd[3, IMAG]  = 512.1090289018;
                cexpd[4, IMAG]  = 512.1143685824;
                cexpd[5, IMAG]  = 512.1496764568;
                cexpd[6, IMAG]  = 512.1870921893;
                cexpd[7, IMAG]  = 512.2193250322;
                cexpd[8, IMAG]  = 512.2454735794;
                cexpd[9, IMAG]  = 512.2663649603;
                cexpd[10, IMAG] = 512.2830879827;
                cexpd[11, IMAG] = 512.2965869718;
                cexpd[12, IMAG] = 512.3075927445;
                cexpd[13, IMAG] = 512.3166486553;
                cexpd[14, IMAG] = 512.3241541685;
                cexpd[15, IMAG] = 512.3304037599;
                cexpd[16, IMAG] = 512.3356167976;
                cexpd[17, IMAG] = 512.3399592211;
                cexpd[18, IMAG] = 512.3435588985;
                cexpd[19, IMAG] = 512.3465164008;
            }
            double epsilon = 1.0E-12;

            //
            // Verification test for results.
            //
            if (nt <= 0)
            {
            }
            else
            {
                for (int it = 0; it < nt; it++)
                {
                    double csumr = (cksum[it, REAL] - cexpd[it, REAL]) / cexpd[it, REAL];
                    double csumi = (cksum[it, IMAG] - cexpd[it, IMAG]) / cexpd[it, IMAG];
                    if (Math.Abs(csumr) <= epsilon ||
                        Math.Abs(csumi) <= epsilon
                        )
                    {
                        if (verified == -1)
                        {
                            verified = 1;
                        }
                    }
                    else
                    {
                        verified = 0;
                    }
                }
            }
            BMResults.printVerificationStatus(CLASS, verified, BMName);
            return(verified);
        }
        public override int go()
        {
            int    no_time_steps = Instance.niter_default;
            double dt            = Instance.dt_default;

            grid_points = Problem.grid_points;

            double[] xcrref = Instance.xcrref, xceref = Instance.xceref,
            xcrdif = new double[5], xcedif = new double[5],
            xce    = Error_norm.xce, xcr = Rhs_norm.xcr;
            double dtref = Instance.dtref;
            int    m;

            PROBLEM_CLASS clss = Instance.CLASS;

            //---------------------------------------------------------------------
            //   compute the error norm and the residual norm, and exit if not printing
            //---------------------------------------------------------------------

            // error_norm(xce);
            Error_norm.go();

            // copy_faces();
            if (Ranks.Length > 1)
            {
                Copy_faces.go();
            }

            Compute_rhs.go();

            //rhs_norm(xcr);
            Rhs_norm.go();

            for (m = 0; m < 5; m++)
            {
                xcr[m] /= dt;
            }

            //for (m = 0; m < 5; m++)
            //{
            //    xcrref[m] = 1.0d;
            //    xceref[m] = 1.0d;
            //}

            //---------------------------------------------------------------------
            //    verification test for residuals if gridsize is either 12X12X12 or
            //    64X64X64 or 102X102X102 or 162X162X162
            //---------------------------------------------------------------------

            //---------------------------------------------------------------------
            //    Compute the difference of solution values and the known reference values.
            //---------------------------------------------------------------------
            for (m = 0; m < 5; m++)
            {
                xcrdif[m] = Math.Abs((xcr[m] - xcrref[m]) / xcrref[m]);
                xcedif[m] = Math.Abs((xce[m] - xceref[m]) / xceref[m]);
            }
            //---------------------------------------------------------------------
            //   tolerance level
            //---------------------------------------------------------------------
            double epsilon = 1.0E-8d;

            //---------------------------------------------------------------------
            //    Output the comparison of computed results to known cases.
            //---------------------------------------------------------------------
            if (clss != PROBLEM_CLASS.U)
            {
                Console.WriteLine(" Verification being performed for class " + clss);
                Console.WriteLine(" Accuracy setting for epsilon = " + epsilon);
                if (Math.Abs(dt - dtref) <= epsilon)
                {
                    if (verified == -1)
                    {
                        verified = 1;
                    }
                }
                else
                {
                    verified = 0;
                    clss     = PROBLEM_CLASS.U;
                    Console.WriteLine("DT does not match the reference value of " + dtref);
                }
                Console.WriteLine(" Comparison of RMS-norms of residual");
            }
            else
            {
                Console.WriteLine(" Unknown CLASS");
                Console.WriteLine(" RMS-norms of residual");
            }
            verified = BMResults.printComparisonStatus(clss.ToString()[0], verified, epsilon,
                                                       xcr, xcrref, xcrdif);
            if (clss != PROBLEM_CLASS.U)
            {
                Console.WriteLine(" Comparison of RMS-norms of solution error");
            }
            else
            {
                Console.WriteLine(" RMS-norms of solution error");
            }
            verified = BMResults.printComparisonStatus(clss.ToString()[0], verified, epsilon,
                                                       xce, xceref, xcedif);

            BMResults.printVerificationStatus(clss.ToString()[0], verified, BMName);

            return(0);
        } // end activate method
        private void runBenchmark()
        {
            int node = worldcomm.Rank;

            num = worldcomm.Size;
            if (node == 0)
            {
                Console.WriteLine(" Size: " + isiz01 + " x " + isiz02 + " x " + isiz03);
            }
            if (node == 0)
            {
                Console.WriteLine(" Iterations: " + itmax);
            }
            if (node == 0)
            {
                Console.WriteLine(" Number of processes: " + num);
            }
//            proc_grid();
//            neighbors();
//            subdomain();
//            setConstants();
            // Process.configBlock();

            //---------------------------------------------------------------------
            //   set the boundary values for dependent variables
            //---------------------------------------------------------------------
            Setbv.go();

            //---------------------------------------------------------------------
            //   set the initial values for dependent variables
            //---------------------------------------------------------------------
            Setiv.go();

            //---------------------------------------------------------------------
            //   compute the forcing term based on prescribed exact solution
            //---------------------------------------------------------------------
            Erhs.go();

            //---------------------------------------------------------------------
            //   perform one SSOR iteration to touch all data and program pages
            //---------------------------------------------------------------------
            Ssor.setParameters(1);
            Ssor.go();

            //---------------------------------------------------------------------
            //   reset the boundary and initial values
            //---------------------------------------------------------------------
            Setbv.go();
            Setiv.go();

            //---------------------------------------------------------------------
            //   perform the SSOR iterations
            //---------------------------------------------------------------------
            Ssor.setParameters(itmax);
            Ssor.go();
            double[] rsdnm = Ssor.Rsdnm;

            //---------------------------------------------------------------------
            //   compute the solution error
            //---------------------------------------------------------------------
            Error.go();
            double[] errnm = Error.Errnm;

            //---------------------------------------------------------------------
            //   compute the surface integral
            //---------------------------------------------------------------------
            Pintgr.go();
            double frc = Pintgr.Frc;

            //---------------------------------------------------------------------
            //   verification test
            //---------------------------------------------------------------------
            double maxtime = Ssor.Maxtime;

            if (node == 0)
            {
                double mflops = ((double)(itmax)) * (1984.77 * ((double)(nx0)) * ((double)(ny0)) * ((double)(nz0)) - 10923.3 * pow2((((double)(nx0 + ny0 + nz0)) / 3.0)) + 27770.9 * ((double)(nx0 + ny0 + nz0)) / 3.0 - 144010.0) / (maxtime * 1000000.0);
                Verify.setParameters(rsdnm, errnm, frc);
                Verify.go();
                int       verified = Verify.Verified;
                BMResults results  = new BMResults(BMName,
                                                   problem_class.ToString()[0],
                                                   nx0,
                                                   ny0,
                                                   nz0,
                                                   itmax,
                                                   maxtime,
                                                   mflops,
                                                   "floating point",
                                                   verified,
                                                   true,
                                                   num,
                                                   -1);
                results.print();
            }
        }
        public void runBenchMark()
        {
            worldcomm = this.WorldComm;
            np        = worldcomm.Size;
            node      = worldcomm.Rank;
            for (int i = 1; i <= T_max; i++)
            {
                Timer.resetTimer(i);
            }
            int niter = initialConfig();

            Problem.problemConfig(np1, np2, layout_type);
            Blocks.blocksConfig(nx, ny, nz, np1, np2, layout_type);

            dims    = Problem.dims;
            twiddle = Problem.twiddle;
            u0      = Problem.Field_u0;
            u1      = Problem.Field_u1;
            u2      = Problem.Field_u2;

            Compute_index_map.setParameters(twiddle, dims[0, 2], dims[1, 2], dims[2, 2]);
            Compute_index_map.go();
            Compute_initial_conditions.setParameters(u1);
            Compute_initial_conditions.go();
            Fftinit.setParameters(dims[0, 0]);
            Fftinit.go();
            Fft.setParameters(1, u1, u0);
            Fft.go();

            for (int i = 1; i <= T_max; i++)
            {
                Timer.resetTimer(i);
            }
            worldcomm.Barrier();

            Timer.start(T_total);

            Compute_index_map.setParameters(twiddle, dims[0, 2], dims[1, 2], dims[2, 2]);
            Compute_index_map.go();
            Compute_initial_conditions.setParameters(u1);
            Compute_initial_conditions.go();
            Fftinit.setParameters(dims[0, 0]);
            Fftinit.go();

            Fft.setParameters(1, u1, u0);
            Fft.go();

            double[] sums = new double[niter_default * 2];
            for (int iter = 0; iter < niter; iter++)
            {
                Evolve.setParameters(u0, u1, twiddle, dims[0, 0], dims[1, 0], dims[2, 0]);
                Evolve.go();
                Fft.setParameters(-1, u1, u2);
                Fft.go();
                Checksum.setParameters(iter, sums, u2, dims[0, 0], dims[1, 0], dims[2, 0]);
                Checksum.go();
            }
            Verify.setParameters(niter, sums);
            int verified = Verify.go();

            Timer.stop(T_total);
            double total_time = Timer.readTimer(T_total);

            double ntotal_f = (double)(nx * ny * nz);
            double mflops   = 0.0;

            if (total_time != 0)
            {
                mflops = 0.000001 * ntotal_f * (14.8157 + 7.19641 * Math.Log(ntotal_f) + (5.23518 + 7.21113 * Math.Log(ntotal_f)) * niter) / total_time;
            }
            else
            {
                mflops = 0.0;
            }
            if (node == 0)
            {
                BMResults results = new BMResults(BMName,
                                                  problem_class.ToString()[0],
                                                  nx,
                                                  ny,
                                                  nz,
                                                  niter,
                                                  total_time,
                                                  mflops,
                                                  "floating point",
                                                  verified,
                                                  true,
                                                  np,
                                                  -1);
                results.print();
            }
        }