Exemplo n.º 1
0
        public void device_mc_run1f(double[] payoff_a, CMCEvaluator evaluator)
        {
            if (mcplan._nscen_per_batch % 4096 != 0) throw new System.Exception();
            CArray device_y_sk = new CArray(mcplan.nk * mcplan._nscen_per_batch, EType.short_t, EMemorySpace.device, this, "_device_volatile_buf");

            for (int b = 0; b < mcplan._nbatches; b++)
            {
                unsafe
                {
                    fixed (short* yhost_sk = &mcbuf.host_y_sk_th[0])
                    {
                        int status = opcuda_mc1f(mcbuf._device_rgstatus.ptr, grid.y0,
                                                   device_y_sk.ptr,
                                                   mcplan._nscen_per_batch, mcplan.nk, grid.d,
                                                   mcbuf._device_ctpk_yy_m.ptr, mcbuf._device_m_k.ptr,
                                                   (uint)yhost_sk);

                        if (status > 0) throw new System.Exception();
                        device_thread_synchronize();

                        evaluator.eval(yhost_sk, 0, b);
                    }
                }
            }
        }
Exemplo n.º 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);
        }