Skip to content

FIX: Improve cutout speed #845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pyedb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import sys
import warnings

if os.name == "nt":
os.environ["PYTHONMALLOC"] = "malloc"
# if os.name == "nt":
# os.environ["PYTHONMALLOC"] = "malloc"

# By default we use pyedb legacy implementation
if "PYEDB_USE_DOTNET" not in os.environ:
Expand Down
49 changes: 44 additions & 5 deletions src/pyedb/dotnet/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2280,6 +2280,22 @@ def _create_cutout_multithread(
i.delete()
elif net_name in reference_list and id not in pins_to_preserve:
reference_pinsts.append(i)
pins_to_delete = []

def check_instances(item):
net_name = item.net_name
id = item.id
if net_name not in all_list and id not in pins_to_preserve:
pins_to_delete.append(item)
elif net_name in reference_list and id not in pins_to_preserve:
reference_pinsts.append(item)

with ThreadPoolExecutor(number_of_threads) as pool:
pool.map(lambda item: check_instances(item), self.padstacks.instances.values())

for i in pins_to_delete:
i.delete()

for i in self.modeler.primitives:
if i:
net_name = i.net_name
Expand All @@ -2290,6 +2306,26 @@ def _create_cutout_multithread(
reference_paths.append(i)
else:
reference_prims.append(i)

prim_to_delete = []

def check_prims(item):
if item:
net_name = item.net_name
if net_name not in all_list:
prim_to_delete.append(item)
elif net_name in reference_list and not item.is_void:
if keep_lines_as_path and item.type == "Path":
reference_paths.append(item)
else:
reference_prims.append(item)

with ThreadPoolExecutor(number_of_threads) as pool:
pool.map(lambda item: check_prims(item), self.modeler.primitives)

for i in prim_to_delete:
i.delete()

self.logger.info_timer("Net clean up")
self.logger.reset_timer()

Expand Down Expand Up @@ -2424,11 +2460,14 @@ def pins_clean(pinst):

# with ThreadPoolExecutor(number_of_threads) as pool:
# pool.map(lambda item: clip_path(item), reference_paths)

for item in reference_paths:
clip_path(item)
for prim in reference_prims: # removing multithreading as failing with new layer from primitive
clean_prim(prim)
with ThreadPoolExecutor(number_of_threads) as pool:
pool.map(lambda item: clip_path(item), reference_paths)
with ThreadPoolExecutor(number_of_threads) as pool:
pool.map(lambda item: clean_prim(item), reference_prims)
# for item in reference_paths:
# clip_path(item)
# for prim in reference_prims: # removing multithreading as failing with new layer from primitive
# clean_prim(prim)
# with ThreadPoolExecutor(number_of_threads) as pool:
# pool.map(lambda item: clean_prim(item), reference_prims)

Expand Down
10 changes: 8 additions & 2 deletions src/pyedb/dotnet/edb_core/cell/primitive/primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class Primitive(Connectable):
def __init__(self, pedb, edb_object):
super().__init__(pedb, edb_object)
self._app = self._pedb
self._core_stackup = pedb.stackup
self._core_net = pedb.nets
self.primitive_object = self._edb_object

bondwire_type = self._pedb._edb.Cell.Primitive.BondwireType
Expand All @@ -62,6 +60,14 @@ def __init__(self, pedb, edb_object):
"rectangle": bondwire_cross_section_type.BondwireRectangle,
}

@property
def _core_stackup(self):
return self._app.stackup

@property
def _core_net(self):
return self._app.nets

@property
def type(self):
"""Return the type of the primitive.
Expand Down
Loading