-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Dispatch a builder with backendV1 and backendV2 #10150
Changes from 10 commits
6a3b145
3cd1192
58023f5
93a9262
2cc5451
a21cc84
b3607ee
bd1e169
d70796f
2a651dd
8d92531
9b2b80d
891c1bd
1d3b471
a6363c3
3aeba17
f3127df
9fee85e
c8d13f5
fecdcae
f0ee72f
c7a36dc
117931d
817d04a
0e204eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,9 @@ | |
# that they have been altered from the originals. | ||
|
||
"""Module for common pulse programming utilities.""" | ||
from typing import List, Dict, Union | ||
from __future__ import annotations | ||
|
||
from typing import List, Dict, Union, TYPE_CHECKING | ||
import warnings | ||
|
||
import numpy as np | ||
|
@@ -20,6 +22,9 @@ | |
from qiskit.pulse.exceptions import UnassignedDurationError, QiskitError | ||
from qiskit.utils.deprecation import deprecate_func, deprecate_function | ||
|
||
if TYPE_CHECKING: | ||
from qiskit.providers.backend import BackendV2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this is needed? Likely BackendV2 type is not newly introduced in this file with this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to remove it. FIxed at 9fee85e . |
||
|
||
|
||
def format_meas_map(meas_map: List[List[int]]) -> Dict[int, List[int]]: | ||
""" | ||
|
@@ -125,3 +130,24 @@ def deprecated_functionality(func): | |
stacklevel=2, | ||
since="0.22.0", | ||
)(func) | ||
|
||
|
||
def get_qubit_channels(backend: BackendV2, qubit: int): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry my previous comment was wrong. This is also API change (i.e. new feature) and we should wait for another release. To make this PR a part of patch release, you need to embed this logic in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed at 9b2b80d. |
||
r"""Return a list of channels which operate on the given ``qubit``. | ||
Returns: | ||
List of ``Channel``\s operated on my the given ``qubit``. | ||
""" | ||
channels = [] | ||
|
||
# add multi-qubit channels | ||
for node_qubits in backend.coupling_map: | ||
if qubit in node_qubits: | ||
control_channels = backend.control_channel(node_qubits) | ||
if control_channels: | ||
channels.extend(control_channels) | ||
|
||
# add single qubit channels | ||
channels.append(backend.drive_channel(qubit)) | ||
channels.append(backend.measure_channel(qubit)) | ||
channels.append(backend.acquire_channel(qubit)) | ||
return channels |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed an failure that attributes of :class:`.BackendV2` backends cannot be used | ||
by introducing dispatching with backends in a builder. | ||
to24toro marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this logic to get dt everywhere in this file. This is of course not the scope of this PR, but could you please add new builder command to get backend dt in 0.25 for cleanup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to add like below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, in the followup PR for 0.25. I think this makes some logic cleaner.