Prepare for Qiskit 2.0 by addressing removed classes and methods#1526
Conversation
|
Thanks @wshanks for including my
|
|
Thanks, @eliarbel. I have been keeping an eye on Qiskit/qiskit#13793, but I have only been testing against Qiskit |
|
FYI @wshanks, I've opened a PR in |
…55) BackendV1 and qiskit.qobj removals in Qiskit/qiskit#13793 cause the test in qiskit_neko/tests/experiments/test_tomography.py to fail. This is part of the tests that are blocking the Qiskit/qiskit#13793 and Qiskit/qiskit#13872 PR in Qiskit from being merged. There is a PR in Qiskit Experiments that address these removals: qiskit-community/qiskit-experiments#1526. Until it is merged, we need to skip this failing test. Tracked in #54
|
Sounds good @eliarbel. It is a bit hard to complete this PR right now because testing it requires Qiskit/qiskit#13793 and qiskit-ibm-runtime is not ready for that change plus other changes in Qiskit |
* Vendor MeasLevel/MeasReturnType from qiskit.qobj.utils. These classes were never public and the usage here does not rely class identity, just class member values. * Address `Result` header now being a dict rather than a class. * Address removal of `calibrate_instructions` from `GenericBackendV2`. * Fix performance issue with `QuantumVolume` and Qiskit Aer. When Aer was used to calculate the ideal probabilities for quantum volume circuits it was spending most of its time generating a `Target` for transpiling the circuit before simulating it. This was addressed by transpiling all the circuits in one `transpile` call. * Update `QuantumVolume` stored results in tests for Qiskit 2.0 (circuit generation algorithm changed).
4a6ee21 to
375fea0
Compare
375fea0 to
5274970
Compare
|
Note -- this PR passes the tests for me with Qiskit |
nkanazawa1989
left a comment
There was a problem hiding this comment.
LGTM. Just one comment
| if "u_channel_lo" not in self._backend._conf_dict: | ||
| self._backend._conf_dict["u_channel_lo"] = [] # to avoid qiskit bug | ||
| self._pulse_conf = PulseBackendConfiguration.from_dict(self._backend._conf_dict) | ||
| self._v1 = isinstance(backend, BackendV1) |
There was a problem hiding this comment.
We should at least add deprecation warning in here. I prefer completely removing BackendV1 usage because we cannot guarantee the rest of our software properly works with this backend.
There was a problem hiding this comment.
The release note had a line about support for BackendV1 being removed in a future release, but I added an explicit deprecations entry about it as well. Also, I added a deprecation warning here. It is hard to do because this code gets called at varying levels of the stack and Python by default only shows deprecation warnings if the stack level is right. Python 3.12 added a cool skip_file_prefixes option so I used that and it seemed to work well on 3.12+ -- it showed my user level code as responsible for the warning whether I created BackendData directly or created a T1 experiment that creates BackendData four levels lower down in the stack. Users on <=3.11 might not see the warning depending on how they are using BackendV1.
My thought was that we are not planning much change to the repo in the near term and it was easy enough to hide the import here. Qiskit 1 will go out of support in six months and we don't need to support unsupported Qiskit versions, I think. I specified this in the deprecation note.
95690c5 to
352264a
Compare
352264a to
1a11e89
Compare
These functions are planned to be removed from the public Qiskit API in a future release (see Qiskit/qiskit#11296 (review)).
8d5398b to
acbf2a6
Compare
nkanazawa1989
left a comment
There was a problem hiding this comment.
Thanks, let's merge this for #1529
This change prepares for Qiskit 2.0 by guarding or replacing references to objects removed in Qiskit 2.0.
Detailed list of changes:
Compatibility changes:
BackendV1.BackendV1was removed in Qiskit 2.0. There were only a few remaining references toBackendV1after the previous removal of pulse support, so it was not hard to keep the remaining support for now but it should be removed when Qiskit 1 is no longer supported.qiskit.result.Result.headerto expect a dict (Qiskit 2) as well as a class (Qiskit 1).ExperimentDatagets the circuit metadata from the header (by convention the metadata is copied into the result andExperimentDatarelies on this).MeasLevelandMeasReturnTypeto enumerate the expected measurement level (kerneled or classified) and return type (averaged or not). Previously, private classes of Qiskit were inadvertently used for these purposes but they were removed in Qiskit 2.0.inst_maptranspile options from experiments. These should have been removed along with the rest of pulse support.GenericBackendV2or a customBackendV2in place of removedFakeOpenPulse2QandFake5QV1backends from Qiskit.ProviderV1in tests.QuantumVolumeresults for Qiskit 2.0's change in the quantum volume algorithm.Other changes
LocalReadouMitigatorif it is used with a backend without aproperties()method or with a backend that does not the required readout error properties.QuantumVolume. When Qiskit Aer is installed,QuantumVolumeusesAerSimulatorto simulate the outcomes of the quantum volume circuits to determine the heavy output probabilities. In its default instantiation,AerSimulatorregenerates itsTargetevery time it is accessed and this generation takes an appreciable amount of time. Because the target was being accessed separately for every circuit, this overhead could accumulate to over a minute in the standard 100 circuit experiment. This overhead was reduced by processing all the circuits in one pass.FineFrequencytests to useT2HahnBackendin placeMockIQBackendsince it provides a more realistic backend emulation.stacklevelon the deprecation warning forRestlessNode.