-
Notifications
You must be signed in to change notification settings - Fork 126
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
Refactor T2HahnBackend to use qiskit-aer #1040
Conversation
} | ||
else: | ||
for circuit in circuits: | ||
if circuit.num_qubits > self.num_qubits: |
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.
This test doesn't help too much for experiments because by the time an experiment gets to run() it has already done a transpile and if there are more qubits in the circuit than in the Target there would have been a transpile error.
Waiting for #1042. If that one won't be reviewed quickly, we could ignore the issues pylint is flagging. |
Comment moved out of the PR description since it shouldn't end up in the commit message: Since I have not done that much with qiskit-aer. There might be a different way to set up the simulator without adding the extra transpiler passes for preparation error and qubit frequency drift. |
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.
Thanks @wshanks! It's a nice PR. I wrote only three minor cosmetic comments.
This reverts commit 83615b6. Since the pylint PR can likely be merged soon, we can just wait for it and merge this one without workarounds.
@yaelbh Your comments were straightforward, but I went a little further. Do you want to check my new changes? |
### Summary This change set updates the `FakeBackend` used by some tests to derive from `BackendV2` rather than `BackendV1` ### Details and comments When combined with [#900](#900) which updates some calibration tests and [#1040](#1040) which updates `T2HahnBackend`, this change results in almost all the tests in the test suite using `BackendV2`. The remaining tests using a `Backend` that is not `BackendV2` use the `AerSimulator` which will be updated to `BackendV2` in the future (tracked in Qiskit/qiskit-aer#1681). The check for backend type was performed by merging the calibration and `T2HahnBackend` branches into this branch and running the tests with `BaseExperiment.run()`, `BaseExperiment._set_backend()`, and `Calibrations.from_backend()` updated to error if the `backend` argument was not `BackendV2` or `AerSimulator` and confirming that all the tests passed.
Summary
This commit refactors
T2HahnBackend
to use qiskit-aer for improved performance.Details and comments
The T2 tests were quite slow, taking around 149 seconds of run time in testing.
T2HahnBackend
was doing a form of simple Monte Carlo simulation, stepping through each circuit and flipping the qubit based on error probabilities. This behavior scales linearly with number of shots which is not good when running 1000 shots on around 100 circuits for each test. This commit switchesT2HahnBackend
to useAerSimulator
which simulates each circuit only one time to determine the final output probability. It can then produce as many shot results as needed quickly by sampling from this distribution.With the switch to
AerSimulator
, the run time of the T2 tests dropped from 149 seconds to 12 seconds. The simulation speed up was more significant than that because the test time is now not limited by simulation (simulation is around 0.5 seconds now).