예제 #1
0
            protected MemoryContainer <MemoryContainer <FT> > m_A;  //plib::parray2D<FT, SIZE, m_pitch_ABS> m_A;


            protected matrix_solver_direct_t(devices.nld_solver main_solver, string name, matrix_solver_t_net_list_t nets, solver.solver_parameters_t params_, size_t size)
                : base(main_solver, name, nets, params_, size)
            {
                m_pitch = m_pitch_ABS != 0 ? m_pitch_ABS : (((size + 0) + 7) / 8) * 8;
                //, m_A(size, m_pitch)
                m_A = new MemoryContainer <MemoryContainer <FT> >((int)size);
                for (int i = 0; i < (int)size; i++)
                {
                    m_A[i] = new MemoryContainer <FT>((int)m_pitch);
                }


                this.build_mat_ptr(m_A);
            }
예제 #2
0
        // performance
        //plib::pperftime_t<true>             m_stat_mainloop;
        //plib::pperfcount_t<true>            m_perf_out_processed;


        public netlist_t(netlist_state_t state, string aname)
        {
            m_state     = state;
            m_solver    = null;
            m_time      = netlist_time_ext.zero();
            m_mainclock = null;
            m_use_stats = false;
            m_queue     = new queue_t(config.MAX_QUEUE_SIZE,
                                      (net) => { return(state.find_net_id(net)); }, //detail::queue_t::id_delegate(&netlist_state_t :: find_net_id, &state),
                                      (id) => { return(state.net_by_id(id)); });    //detail::queue_t::obj_delegate(&netlist_state_t :: net_by_id, &state))


            state.save(this, (plib.state_manager_t.callback_t)m_queue, aname, "m_queue");
            state.save(this, m_time, aname, "m_time");
        }
예제 #3
0
            size_t m_dim;     //const std::size_t m_dim;


            protected matrix_solver_ext_t(devices.nld_solver main_solver, string name, matrix_solver_t_net_list_t nets, solver.solver_parameters_t params_, size_t size)
                : base(main_solver, name, nets, params_)
            {
                m_new_V    = new FT [size];
                m_RHS      = new FT [size];
                m_mat_ptr  = new plib.pmatrix2d <Pointer <FT> >(size, this.max_railstart() + 1);
                m_last_V   = new FT [size]; std.fill(m_last_V, ops.cast(nlconst.zero()));
                m_DD_n_m_1 = new FT [size]; std.fill(m_DD_n_m_1, ops.cast(nlconst.zero()));
                m_h_n_m_1  = new FT [size]; std.fill(m_h_n_m_1, ops.cast(nlconst.magic(1e-6))); // we need a non zero value here
                m_dim      = size;


                //
                // save states
                //
                state().save(this, m_last_V, this.name(), "m_last_V");
                state().save(this, m_DD_n_m_1, this.name(), "m_DD_n_m_1");
                state().save(this, m_h_n_m_1, this.name(), "m_h_n_m_1");
            }
예제 #4
0
        public void reset()
        {
            log().debug.op("Searching for mainclock\n");
            m_mainclock = m_state.get_single_device <devices.nld_mainclock>("mainclock");

            log().debug.op("Searching for solver\n");
            m_solver = m_state.get_single_device <devices.nld_solver>("solver");

            // Don't reset time
            //m_time = netlist_time_ext::zero();
            m_queue.clear();
            if (m_mainclock != null)
            {
                m_mainclock.m_Q.net().set_next_scheduled_time(m_time);
            }
            //if (m_solver != nullptr)
            //  m_solver->reset();

            m_state.reset();
        }
예제 #5
0
            //typedef FT float_type;
            //typedef matrix_solver_direct_t<FT, 1> base_type;


            public matrix_solver_direct1_t(devices.nld_solver main_solver, string name, matrix_solver_t_net_list_t nets, solver.solver_parameters_t params_)
                : base(main_solver, name, nets, params_, 1)
            {
            }
예제 #6
0
            plib.dynproc m_proc;                          //plib::dynproc<void, FT *, nl_fptype *, nl_fptype *, nl_fptype *, nl_fptype ** > m_proc;


            public matrix_solver_GCR_t(devices.nld_solver main_solver, string name, matrix_solver_t_net_list_t nets, solver.solver_parameters_t params_, size_t size)
                : base(main_solver, name, nets, params_, size)
            {
                mat    = new plib.pGEmatrix_cr <FT, FT_OPS, int_SIZE>((uint16_t)size); //mat(static_cast<typename mat_type::index_type>(size))
                m_proc = new plib.dynproc();


                size_t iN = this.size();

                // build the final matrix

                std.vector <std.vector <unsigned> > fill = new std.vector <std.vector <unsigned> >(iN);
                fill.Fill(() => { return(new std.vector <unsigned>()); });

                size_t raw_elements = 0;

                for (size_t k = 0; k < iN; k++)
                {
                    fill[k].resize(iN, (unsigned)plib.pGEmatrix_cr <FT, FT_OPS, int_SIZE> .constants_e.FILL_INFINITY);
                    foreach (var j in this.m_terms[k].m_nz)
                    {
                        fill[k][j] = 0;
                        raw_elements++;
                    }
                }

                var gr = mat.gaussian_extend_fill_mat(fill);

                this.log_fill(fill, mat);

                mat.build_from_fill_mat(fill);

                for (mat_index_type k = 0; k < iN; k++)
                {
                    size_t cnt = 0;
                    // build pointers into the compressed row format matrix for each terminal
                    for (size_t j = 0; j < this.m_terms[k].railstart(); j++)
                    {
                        int other = this.m_terms[k].m_connected_net_idx[j];
                        for (var i = mat.row_idx[k]; i < mat.row_idx[k + 1]; i++)
                        {
                            if (other == (int)mat.col_idx[i])
                            {
                                this.m_mat_ptr.op(k)[j] = new Pointer <FT>(mat.A, i);  //this->m_mat_ptr[k][j] = &mat.A[i];
                                cnt++;
                                break;
                            }
                        }
                    }

                    nl_assert(cnt == this.m_terms[k].railstart());
                    this.m_mat_ptr.op(k)[this.m_terms[k].railstart()] = new Pointer <FT>(mat.A, mat.diag[k]);  //this->m_mat_ptr[k][this->m_terms[k].railstart()] = &mat.A[mat.diag[k]];
                }

                this.state().log().verbose.op("maximum fill: {0}", gr.first);
                this.state().log().verbose.op("Post elimination occupancy ratio: {1} Ops: {0}", gr.second,
                                              (matrix_solver_t_fptype)mat.nz_num / (matrix_solver_t_fptype)(iN * iN));
                this.state().log().verbose.op(" Pre elimination occupancy ratio: {0}",
                                              (matrix_solver_t_fptype)raw_elements / (matrix_solver_t_fptype)(iN * iN));

                // FIXME: Move me
                //

                if (this.state().static_solver_lib().isLoaded())
                {
                    string symname = static_compile_name();
                    m_proc.load(this.state().static_solver_lib(), symname);
                    if (m_proc.resolved())
                    {
                        this.state().log().info.op("External static solver {0} found ...", symname);
                    }
                    else
                    {
                        this.state().log().warning.op("External static solver {0} not found ...", symname);
                    }
                }
            }
예제 #7
0
 matrix_solver_SOR_mat_t(devices.nld_solver main_solver, string name, matrix_solver_t_net_list_t nets, solver_parameters_t params_, size_t size)
     : base(main_solver, name, nets, params_, size)
 {
     m_omega = new state_var <FT>(this, "m_omega", ops.cast(params_.m_gs_sor.op()));
 }