mirror of https://github.com/KLayout/klayout.git
Parallelize netlist extraction (LVS) with OpenMP
This commit is contained in:
parent
197aad9c89
commit
ba5b41feee
|
|
@ -2945,10 +2945,23 @@ template <class T>
|
|||
void
|
||||
hier_clusters<T>::build_hier_connections_for_cells (cell_clusters_box_converter<T> &cbc, const db::Layout &layout, const std::vector<db::cell_index_type> &cells, const db::Connectivity &conn, const std::set<db::cell_index_type> *breakout_cells, tl::RelativeProgress &progress, instance_interaction_cache_type &instance_interaction_cache, bool separate_attributes)
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (long long i = 0; i < (long long)cells.size (); ++i) {
|
||||
db::cell_index_type c = cells[i];
|
||||
build_hier_connections (cbc, layout, layout.cell (c), conn, breakout_cells, instance_interaction_cache, separate_attributes);
|
||||
|
||||
#pragma omp critical
|
||||
{
|
||||
++progress;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (std::vector<db::cell_index_type>::const_iterator c = cells.begin (); c != cells.end (); ++c) {
|
||||
build_hier_connections (cbc, layout, layout.cell (*c), conn, breakout_cells, instance_interaction_cache, separate_attributes);
|
||||
++progress;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
|||
|
|
@ -1110,6 +1110,7 @@ public:
|
|||
|
||||
size_t size () const
|
||||
{
|
||||
tl::MutexLocker lock (&m_mutex);
|
||||
MemStatisticsSimple ms;
|
||||
ms << m_map;
|
||||
return ms.used ();
|
||||
|
|
@ -1127,6 +1128,7 @@ public:
|
|||
|
||||
const Value *find (db::cell_index_type ci1, db::cell_index_type ci2, const Key &key) const
|
||||
{
|
||||
tl::MutexLocker lock (&m_mutex);
|
||||
typename std::map <std::pair<db::cell_index_type, db::cell_index_type>, std::list <std::pair<Key, Value> > >::iterator i1 = m_map.find (std::make_pair (ci1, ci2));
|
||||
if (i1 == m_map.end ()) {
|
||||
++m_misses;
|
||||
|
|
@ -1156,6 +1158,7 @@ public:
|
|||
{
|
||||
const size_t instance_cache_variant_threshold = 20;
|
||||
|
||||
tl::MutexLocker lock (&m_mutex);
|
||||
std::list <std::pair<Key, Value> > &m = m_map [std::make_pair (ci1, ci2)];
|
||||
if (m.size () >= instance_cache_variant_threshold) {
|
||||
m.pop_back ();
|
||||
|
|
@ -1166,6 +1169,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
mutable tl::Mutex m_mutex;
|
||||
mutable size_t m_hits, m_misses;
|
||||
mutable std::map <std::pair<db::cell_index_type, db::cell_index_type>, std::list <std::pair<Key, Value> > > m_map;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue