-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate lists for argument input on transpile() (#8835)
* Deprecate lists for argument input on transpile() Right now the support for the argument broadcasting with list inputs for various transpiler options on the transpile() function causes a significant performance overhead to support, primarily do to how we have to handle the multiple arguments across a parallel dispatch boundary. It also significantly increases the code complexity of the function to support more than one input for each argument (except circuits). The utility of doing this type of argument handling is quite limited since a similar result can be achieved with a for loop and would like be simpler for users to reason about. When weighing all these factors the best path forward is to just remove this functionality. This commit starts the process of removing this feature by marking it as deprecated. Once the deprecation cycle is complete we can greatly simplify the code in transpile and primarily replace it with a call to generate_preset_pass_manager() and passmanager.run() (the only thing I think we'll have to handle out of band is faulty qubits defined in a BackendProperties for BackendV1). Related to #7741 * Update qiskit/compiler/transpiler.py Co-authored-by: Kevin Hartman <[email protected]> * Update qiskit/compiler/transpiler.py Co-authored-by: Kevin Hartman <[email protected]> * Fix release note typo Co-authored-by: Kevin Hartman <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c34e0b9
commit 696e53d
Showing
2 changed files
with
88 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
releasenotes/notes/deprecate-list-args-transpile-f92e5b3d411f361f.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
deprecations: | ||
- | | ||
Support for passing in lists of argument values to the :func:`~.transpile` | ||
function is deprecated and will be removed in the 0.25.0 release. This | ||
is being done to facilitate greatly reducing the overhead for parallel | ||
execution for transpiling multiple circuits at once. If you're using | ||
this functionality currently you can call :func:`~.transpile` multiple | ||
times instead. For example if you were previously doing something like:: | ||
from qiskit.transpiler import CouplingMap | ||
from qiskit import QuantumCircuit | ||
from qiskit import transpile | ||
qc = QuantumCircuit(2) | ||
qc.h(0) | ||
qc.cx(0, 1) | ||
qc.measure_all() | ||
cmaps = [CouplingMap.from_heavy_hex(d) for d in range(3, 15, 2)] | ||
results = transpile([qc] * 6, coupling_map=cmaps) | ||
instead you should run something like:: | ||
from itertools import cycle | ||
from qiskit.transpiler import CouplingMap | ||
from qiskit import QuantumCircuit | ||
from qiskit import transpile | ||
qc = QuantumCircuit(2) | ||
qc.h(0) | ||
qc.cx(0, 1) | ||
qc.measure_all() | ||
cmaps = [CouplingMap.from_heavy_hex(d) for d in range(3, 15, 2)] | ||
results = [] | ||
for qc, cmap in zip(cycle([qc]), cmaps): | ||
results.append(transpile(qc, coupling_map=cmap)) | ||
You can also leverage :func:`~.parallel_map` or ``multiprocessing`` from | ||
the Python standard library if you want to run this in parallel. |