Example #1
0
        public void run_benchmark_cpu_mt()
        {
            log.Add("running the Mersenne Twister benchmark on the CPU");

            int nscen_per_batch = 4096 * 25;
            int nbatches = 2000;

            int nth = Environment.ProcessorCount;
            OPModel.Types.CRangen.mtinit(nth);

            float[] host_unif_scen_th = new float[nscen_per_batch * nth];

            OPModel.Types.CJobQueue Queue = new OPModel.Types.CJobQueue();
            object[] p_b = new object[nbatches];
            for (int b = 0; b < nbatches; b++)
            {
                host_d_mc_mt_func_input input = new host_d_mc_mt_func_input();
                input.nth = nth;
                input.batch = b;
                input.nscen_per_batch = nscen_per_batch;
                input.host_unif_scen_th = host_unif_scen_th;
                p_b[b] = input;
            }

            CStopWatch sw = new CStopWatch();
            sw.Reset();
            Queue.Exec(host_d_mc_mt_func, null, p_b, nth);
            double time = sw.Peek();

            double nevals = (double)nbatches * (double)nscen_per_batch;
            double milion_evals_per_second = nevals / (1000000 * time);

            if (benchmarks == null) benchmarks = new SBenchmarks();
            benchmarks.cpu_mt_performance = milion_evals_per_second;
            log.Add("mt performance: " + String.Format("{0:0.0}", milion_evals_per_second) + " milion eval/sec");
            host_unif_scen_th = null;
            System.GC.Collect();
        }
Example #2
0
        public void host_d_mc_run1f(double[] payoff_a, CMCEvaluator Evaluator)
        {
            OPModel.Types.CJobQueue Queue = new OPModel.Types.CJobQueue();
            object[] p_b = new object[mcplan._nbatches];
            for (int b = 0; b < mcplan._nbatches; b++)
            {
                host_d_mc_run1f_func_input input = new host_d_mc_run1f_func_input();
                input.batch = b;
                input.Evaluator = Evaluator;
                p_b[b] = input;

            }
            Queue.Exec(host_d_mc_run1f_func, null, p_b, mcplan.nth);
        }