From 17bd6d04bfa2e12740073c147f4f9002d4613753 Mon Sep 17 00:00:00 2001 From: lstasytis Date: Fri, 19 Jul 2024 13:58:11 +0100 Subject: [PATCH 1/2] avoiding mp.Pool in case of using only 1 worker for easier pdb debugging --- src/qonnx/transformation/base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/qonnx/transformation/base.py b/src/qonnx/transformation/base.py index 75b16aba..34be0780 100644 --- a/src/qonnx/transformation/base.py +++ b/src/qonnx/transformation/base.py @@ -107,8 +107,14 @@ def apply(self, model): old_nodes.append(model.graph.node.pop()) # Execute transformation in parallel - with mp.Pool(self._num_workers) as p: - new_nodes_and_bool = p.map(self.applyNodeLocal, old_nodes, chunksize=1) + if self._num_workers > 1: + with mp.Pool(self._num_workers) as p: + new_nodes_and_bool = p.map(self.applyNodeLocal, old_nodes, chunksize=1) + # execute without mp.Pool in case of 1 worker to simplify debugging + else: + new_nodes_and_bool = [self.applyNodeLocal(node) for node in old_nodes] + + # extract nodes and check if the transformation needs to run again # Note: .pop() had initially reversed the node order From 3835a37cbaaf2322163641563225ea9f4a813bc5 Mon Sep 17 00:00:00 2001 From: lstasytis Date: Fri, 9 Aug 2024 11:01:57 +0100 Subject: [PATCH 2/2] ran pre-commit --- src/qonnx/transformation/base.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qonnx/transformation/base.py b/src/qonnx/transformation/base.py index 34be0780..eaf73ab9 100644 --- a/src/qonnx/transformation/base.py +++ b/src/qonnx/transformation/base.py @@ -114,8 +114,6 @@ def apply(self, model): else: new_nodes_and_bool = [self.applyNodeLocal(node) for node in old_nodes] - - # extract nodes and check if the transformation needs to run again # Note: .pop() had initially reversed the node order run_again = False