Skip to content

Commit 17bd6d0

Browse files
committed
avoiding mp.Pool in case of using only 1 worker for easier pdb debugging
1 parent db969e6 commit 17bd6d0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/qonnx/transformation/base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,14 @@ def apply(self, model):
107107
old_nodes.append(model.graph.node.pop())
108108

109109
# Execute transformation in parallel
110-
with mp.Pool(self._num_workers) as p:
111-
new_nodes_and_bool = p.map(self.applyNodeLocal, old_nodes, chunksize=1)
110+
if self._num_workers > 1:
111+
with mp.Pool(self._num_workers) as p:
112+
new_nodes_and_bool = p.map(self.applyNodeLocal, old_nodes, chunksize=1)
113+
# execute without mp.Pool in case of 1 worker to simplify debugging
114+
else:
115+
new_nodes_and_bool = [self.applyNodeLocal(node) for node in old_nodes]
116+
117+
112118

113119
# extract nodes and check if the transformation needs to run again
114120
# Note: .pop() had initially reversed the node order

0 commit comments

Comments
 (0)