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

Always run vf2 scoring serially #11112

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 0 additions & 6 deletions qiskit/transpiler/passes/layout/vf2_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


"""VF2Layout pass to find a layout using subgraph isomorphism"""
import os
from enum import Enum
import itertools
import logging
Expand Down Expand Up @@ -172,10 +171,6 @@ def run(self, dag):
chosen_layout_score = None
start_time = time.time()
trials = 0
run_in_parallel = (
os.getenv("QISKIT_IN_PARALLEL", "FALSE").upper() != "TRUE"
or os.getenv("QISKIT_FORCE_THREADS", "FALSE").upper() == "TRUE"
)

def mapping_to_layout(layout_mapping):
return Layout({reverse_im_graph_node_map[k]: v for k, v in layout_mapping.items()})
Expand Down Expand Up @@ -204,7 +199,6 @@ def mapping_to_layout(layout_mapping):
reverse_im_graph_node_map,
im_graph,
self.strict_direction,
run_in_parallel,
)
# If the layout score is 0 we can't do any better and we'll just
# waste time finding additional mappings that will at best match
Expand Down
7 changes: 0 additions & 7 deletions qiskit/transpiler/passes/layout/vf2_post_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


"""VF2PostLayout pass to find a layout after transpile using subgraph isomorphism"""
import os
from enum import Enum
import logging
import inspect
Expand Down Expand Up @@ -253,10 +252,6 @@ def run(self, dag):
call_limit=self.call_limit,
)
chosen_layout = None
run_in_parallel = (
os.getenv("QISKIT_IN_PARALLEL", "FALSE").upper() != "TRUE"
or os.getenv("QISKIT_FORCE_THREADS", "FALSE").upper() == "TRUE"
)
try:
if self.strict_direction:
initial_layout = Layout({bit: index for index, bit in enumerate(dag.qubits)})
Expand All @@ -276,7 +271,6 @@ def run(self, dag):
reverse_im_graph_node_map,
im_graph,
self.strict_direction,
run_in_parallel,
)
# Circuit not in basis so we have nothing to compare against return here
except KeyError:
Expand Down Expand Up @@ -309,7 +303,6 @@ def run(self, dag):
reverse_im_graph_node_map,
im_graph,
self.strict_direction,
run_in_parallel,
)
logger.debug("Trial %s has score %s", trials, layout_score)
if layout_score < chosen_layout_score:
Expand Down
2 changes: 1 addition & 1 deletion qiskit/transpiler/passes/layout/vf2_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def score_layout(
_reverse_bit_map,
im_graph,
strict_direction=False,
run_in_parallel=True,
run_in_parallel=False,
):
"""Score a layout given an average error map."""
if layout_mapping:
Expand Down
8 changes: 8 additions & 0 deletions releasenotes/notes/vf2-threading-b778a36de5b8832a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
other:
- |
The :class:`.VF2Layout` and :class:`.VF2PostLayout` transpiler passes previously would
potentially run their internal scoring using multithreading if the input
circuit's were sufficiently large. However, the multithreading usage has
been removed from the passes as it was shown to cause a performance
regression instead of an improvement like originally intended.