Skip to content
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

Avoiding mp.Pool in case of using only 1 worker for easier pdb debugging #127

Merged
Merged
Changes from all 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
8 changes: 6 additions & 2 deletions src/qonnx/transformation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ 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
Expand Down
Loading