Skip to content

Commit 2281a77

Browse files
authored
Merge pull request #127 from lstasytis/fix/avoid-mp-pool-with-one-worker
Avoiding mp.Pool in case of using only 1 worker for easier pdb debugging
2 parents c4c16f7 + 3835a37 commit 2281a77

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/qonnx/transformation/base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,12 @@ 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]
112116

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

0 commit comments

Comments
 (0)