-
Notifications
You must be signed in to change notification settings - Fork 60
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
Remove subsystem_labels option from DynamicsBackend #248
Remove subsystem_labels option from DynamicsBackend #248
Conversation
I've now implemented all of the above changes. Here is the summary:
Luckily this change doesn't impact any of the numerical functionality. In addition to the above:
I've also added an |
* ``subsystem_labels``: Integer labels for subsystems. Defaults to ``[0, ..., | ||
len(subsystem_dims) - 1]``. | ||
* ``meas_map``: Measurement map. Defaults to ``[[idx] for idx in subsystem_labels]``. | ||
* ``meas_map``: Measurement map. Defaults to ``[[idx] for idx in range(len(subsystem_dims))]``. |
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.
[Q] What is meas_map
in dynamicsbackend used for ? For bacekndV1 or backendV2 affinity?
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 always forget exactly how meas_map
works. DynamicsBackend
itself doesn't use meas_map
, but I think it's required by transpilation and/or pulse schedule validation. I believe the default meas_map
described here allows measurements of any subset of qubits to pass the validation checks.
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.
The meas_map
is used for mapping qubits which have to be measured concurrently. The configuration of meas_map
used here indicates each qubit can be measured independently.
Just asking, I just understood the need for transpile and pulse validation. Thanks.
pulse.play(pulse.Waveform([0.5, 0.5, 0.5]), pulse.DriveChannel(0)) | ||
pulse.acquire(duration=1, qubit_or_channel=1, register=pulse.MemorySlot(0)) | ||
|
||
self.simple_backend.set_options(subsystem_dims=[2, 1]) |
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.
[Q] What situation is the case that specifying explicitly one of subsystem_dims is 1?
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.
For now I'm putting this test primarily to have a direct/explicit test of how this option behaves on it's own (not just within from_backend
). Maybe a user would want to do this if they are building a custom model for a backend (but again don't want to model every single qubit, as in from_backend
).
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.
If users use like
backend= DynamicsBackend.from_backend(FakeKolkata(), subsystem_list=[1])
do they observe the warning?
If so, I'm not sure why this is necessary.
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.
The warning will be raised if they do
backend= DynamicsBackend.from_backend(FakeKolkata(), subsystem_list=[1])
then submit a schedule or circuit that measures qubit 0. I was imagining in this case that we should let users know that they're measuring a system that has no evolution (which I thought could confuse users if no warning were present).
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.
LGTM!
* adding sympy as an explicit requirement (#233) * Add warning for JAX versions on import of Dynamics (#232) * Add probability normalization to DynamicsBackend sampling routine (#239) * Add warning if digital carrier exceeds Nyquist frequency in pulse -> signal conversion (#242) * Fix bug with carrier_freq being a JAX tracer if envelope is constant in Signal (#247) * Remove subsystem_labels option from DynamicsBackend (#248) * Rename subsystem_dims Dict to subsystem_dims_dict (#250) * Fix ClassicalRegister counting in DynamicsBackend (#252) * temporary fix for docs (#253) * Drop support for backendV2 in from_backend (#249) * incrementing version number * cleaning up reno files --------- Co-authored-by: Kento Ueda <38037695+to24toro@users.noreply.github.com>
Summary
Closes #235
Details and comments (out of date, see next comment)
This is currently a draft to prototype a potential solution to #235, in which the
subsystem_labels
option is removed, and all qubits removed via thesubsystem_list
argument offrom_backend
are actually "kept" as trivial 1-dimensional systems.So far:
subsystem_labels
.subsystem_dims
infrom_backend
has been changed to include all pre-existing subsystems, but setting the dimension of the "removed" subsystems to1
(instead of not including them at all).Initial testing in a jupyter notebook seems to indicate that this behaves as expected:
from_backend
with a non-trivialsubsystem_list
, and the backend is built without issue.To do:
subsystem_labels
option was used to raise errors of non-existent subsystems were measured. As this no longer exists, it would be nice to still warn users if their schedule measures a trivial subsystem.Question:
subsystem_labels
option. I'm not sure how this could be deprecated, because it will literally serve no purpose and have no effect anymore.