mirror of https://github.com/KLayout/klayout.git
Partially enabled progress for hierarchical processor.
This commit is contained in:
parent
212bd86aab
commit
2fa7c4b6d4
|
|
@ -441,6 +441,7 @@ local_processor_cell_contexts<TS, TI, TR>::compute_results (const local_processo
|
|||
|
||||
for (typename std::vector<std::pair<const context_key_type *, db::local_processor_cell_context<TS, TI, TR> *> >::const_iterator c = sorted_contexts.begin (); c != sorted_contexts.end (); ++c) {
|
||||
|
||||
proc->next ();
|
||||
++index;
|
||||
|
||||
if (tl::verbosity () >= proc->base_verbosity () + 20) {
|
||||
|
|
@ -1046,14 +1047,14 @@ template class DB_PUBLIC local_processor_result_computation_task<db::Edge, db::E
|
|||
|
||||
template <class TS, class TI, class TR>
|
||||
local_processor<TS, TI, TR>::local_processor (db::Layout *layout, db::Cell *top)
|
||||
: mp_subject_layout (layout), mp_intruder_layout (layout), mp_subject_top (top), mp_intruder_top (top), m_nthreads (0), m_max_vertex_count (0), m_area_ratio (0.0), m_base_verbosity (30)
|
||||
: mp_subject_layout (layout), mp_intruder_layout (layout), mp_subject_top (top), mp_intruder_top (top), m_nthreads (0), m_max_vertex_count (0), m_area_ratio (0.0), m_base_verbosity (30), m_progress (0), mp_progress (0)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
template <class TS, class TI, class TR>
|
||||
local_processor<TS, TI, TR>::local_processor (db::Layout *subject_layout, db::Cell *subject_top, const db::Layout *intruder_layout, const db::Cell *intruder_top)
|
||||
: mp_subject_layout (subject_layout), mp_intruder_layout (intruder_layout), mp_subject_top (subject_top), mp_intruder_top (intruder_top), m_nthreads (0), m_max_vertex_count (0), m_area_ratio (0.0), m_base_verbosity (30)
|
||||
: mp_subject_layout (subject_layout), mp_intruder_layout (intruder_layout), mp_subject_top (subject_top), mp_intruder_top (intruder_top), m_nthreads (0), m_max_vertex_count (0), m_area_ratio (0.0), m_base_verbosity (30), m_progress (0), mp_progress (0)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
|
@ -1068,6 +1069,31 @@ std::string local_processor<TS, TI, TR>::description (const local_operation<TS,
|
|||
}
|
||||
}
|
||||
|
||||
template <class TS, class TI, class TR>
|
||||
void local_processor<TS, TI, TR>::next () const
|
||||
{
|
||||
static tl::Mutex s_lock;
|
||||
tl::MutexLocker locker (&s_lock);
|
||||
++m_progress;
|
||||
|
||||
tl::RelativeProgress *rp = dynamic_cast<tl::RelativeProgress *> (mp_progress);
|
||||
if (rp) {
|
||||
rp->set (m_progress);
|
||||
}
|
||||
}
|
||||
|
||||
template <class TS, class TI, class TR>
|
||||
size_t local_processor<TS, TI, TR>::get_progress () const
|
||||
{
|
||||
size_t p = 0;
|
||||
{
|
||||
static tl::Mutex s_lock;
|
||||
tl::MutexLocker locker (&s_lock);
|
||||
p = m_progress;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
template <class TS, class TI, class TR>
|
||||
void local_processor<TS, TI, TR>::run (local_operation<TS, TI, TR> *op, unsigned int subject_layer, unsigned int intruder_layer, unsigned int output_layer)
|
||||
{
|
||||
|
|
@ -1416,6 +1442,16 @@ local_processor<TS, TI, TR>::compute_results (local_processor_contexts<TS, TI, T
|
|||
mp_subject_layout->update ();
|
||||
db::LayoutLocker layout_update_locker (mp_subject_layout);
|
||||
|
||||
// prepare a progress for the computation tasks
|
||||
size_t comp_effort = 0;
|
||||
for (typename local_processor_contexts<TS, TI, TR>::iterator c = contexts.begin (); c != contexts.end (); ++c) {
|
||||
comp_effort += c->second.size ();
|
||||
}
|
||||
|
||||
tl::RelativeProgress progress (description (op), comp_effort, 1);
|
||||
m_progress = 0;
|
||||
mp_progress = 0;
|
||||
|
||||
if (m_nthreads > 0) {
|
||||
|
||||
std::auto_ptr<tl::Job<local_processor_result_computation_worker<TS, TI, TR> > > rc_job (new tl::Job<local_processor_result_computation_worker<TS, TI, TR> > (m_nthreads));
|
||||
|
|
@ -1471,22 +1507,44 @@ local_processor<TS, TI, TR>::compute_results (local_processor_contexts<TS, TI, T
|
|||
}
|
||||
|
||||
if (rc_job.get ()) {
|
||||
rc_job->start ();
|
||||
rc_job->wait ();
|
||||
|
||||
try {
|
||||
|
||||
rc_job->start ();
|
||||
while (! rc_job->wait (10)) {
|
||||
progress.set (get_progress ());
|
||||
}
|
||||
|
||||
} catch (...) {
|
||||
rc_job->terminate ();
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for (db::Layout::bottom_up_const_iterator bu = mp_subject_layout->begin_bottom_up (); bu != mp_subject_layout->end_bottom_up (); ++bu) {
|
||||
try {
|
||||
|
||||
mp_progress = &progress;
|
||||
|
||||
for (db::Layout::bottom_up_const_iterator bu = mp_subject_layout->begin_bottom_up (); bu != mp_subject_layout->end_bottom_up (); ++bu) {
|
||||
|
||||
typename local_processor_contexts<TS, TI, TR>::iterator cpc = contexts.context_map ().find (&mp_subject_layout->cell (*bu));
|
||||
if (cpc != contexts.context_map ().end ()) {
|
||||
cpc->second.compute_results (contexts, cpc->first, op, output_layer, this);
|
||||
contexts.context_map ().erase (cpc);
|
||||
}
|
||||
|
||||
typename local_processor_contexts<TS, TI, TR>::iterator cpc = contexts.context_map ().find (&mp_subject_layout->cell (*bu));
|
||||
if (cpc != contexts.context_map ().end ()) {
|
||||
cpc->second.compute_results (contexts, cpc->first, op, output_layer, this);
|
||||
contexts.context_map ().erase (cpc);
|
||||
}
|
||||
|
||||
mp_progress = 0;
|
||||
|
||||
} catch (...) {
|
||||
mp_progress = 0;
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "dbLayout.h"
|
||||
#include "dbLocalOperation.h"
|
||||
#include "tlThreadedWorkers.h"
|
||||
#include "tlProgress.h"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
|
@ -193,6 +194,11 @@ public:
|
|||
db::local_processor_cell_context<TS, TI, TR> *create (const context_key_type &intruders);
|
||||
void compute_results (const local_processor_contexts<TS, TI, TR> &contexts, db::Cell *cell, const local_operation<TS, TI, TR> *op, unsigned int output_layer, const local_processor<TS, TI, TR> *proc);
|
||||
|
||||
size_t size () const
|
||||
{
|
||||
return m_contexts.size ();
|
||||
}
|
||||
|
||||
iterator begin () const
|
||||
{
|
||||
return m_contexts.begin ();
|
||||
|
|
@ -427,8 +433,12 @@ private:
|
|||
double m_area_ratio;
|
||||
int m_base_verbosity;
|
||||
mutable std::auto_ptr<tl::Job<local_processor_context_computation_worker<TS, TI, TR> > > mp_cc_job;
|
||||
mutable size_t m_progress;
|
||||
mutable tl::Progress *mp_progress;
|
||||
|
||||
std::string description (const local_operation<TS, TI, TR> *op) const;
|
||||
void next () const;
|
||||
size_t get_progress () const;
|
||||
void compute_contexts (db::local_processor_contexts<TS, TI, TR> &contexts, db::local_processor_cell_context<TS, TI, TR> *parent_context, db::Cell *subject_parent, db::Cell *subject_cell, const db::ICplxTrans &subject_cell_inst, const db::Cell *intruder_cell, const typename local_processor_cell_contexts<TS, TI, TR>::context_key_type &intruders, db::Coord dist) const;
|
||||
void do_compute_contexts (db::local_processor_cell_context<TS, TI, TR> *cell_context, const db::local_processor_contexts<TS, TI, TR> &contexts, db::local_processor_cell_context<TS, TI, TR> *parent_context, db::Cell *subject_parent, db::Cell *subject_cell, const db::ICplxTrans &subject_cell_inst, const db::Cell *intruder_cell, const typename local_processor_cell_contexts<TS, TI, TR>::context_key_type &intruders, db::Coord dist) const;
|
||||
void issue_compute_contexts (db::local_processor_contexts<TS, TI, TR> &contexts, db::local_processor_cell_context<TS, TI, TR> *parent_context, db::Cell *subject_parent, db::Cell *subject_cell, const db::ICplxTrans &subject_cell_inst, const db::Cell *intruder_cell, typename local_processor_cell_contexts<TS, TI, TR>::context_key_type &intruders, db::Coord dist) const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue