diff --git a/qiskit/transpiler/passes/layout/vf2_layout.py b/qiskit/transpiler/passes/layout/vf2_layout.py index 9eb2b4d68284..d6de8f51d31f 100644 --- a/qiskit/transpiler/passes/layout/vf2_layout.py +++ b/qiskit/transpiler/passes/layout/vf2_layout.py @@ -12,7 +12,6 @@ """VF2Layout pass to find a layout using subgraph isomorphism""" -import os from enum import Enum import itertools import logging @@ -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()}) @@ -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 diff --git a/qiskit/transpiler/passes/layout/vf2_post_layout.py b/qiskit/transpiler/passes/layout/vf2_post_layout.py index 96ffc745b451..cee0e1cf04a8 100644 --- a/qiskit/transpiler/passes/layout/vf2_post_layout.py +++ b/qiskit/transpiler/passes/layout/vf2_post_layout.py @@ -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 @@ -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)}) @@ -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: @@ -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: diff --git a/qiskit/transpiler/passes/layout/vf2_utils.py b/qiskit/transpiler/passes/layout/vf2_utils.py index ed14df998caa..b6fc73f18802 100644 --- a/qiskit/transpiler/passes/layout/vf2_utils.py +++ b/qiskit/transpiler/passes/layout/vf2_utils.py @@ -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: diff --git a/releasenotes/notes/vf2-threading-b778a36de5b8832a.yaml b/releasenotes/notes/vf2-threading-b778a36de5b8832a.yaml new file mode 100644 index 000000000000..e813f9ed5129 --- /dev/null +++ b/releasenotes/notes/vf2-threading-b778a36de5b8832a.yaml @@ -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.