This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 160
Migrate Quantum Volume circuits to use circuit library #460
Merged
Conversation
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
This commit starts the process of using the terra circuits library by refactoring the quantum volume circuit generator function to internally use the quantum volume circuit from the library instead of constructing it manually. It also tries to rationalize the input parameters since several didn't have any effect and others were not properly listed as required. Partially addresses qiskit-community#395
Also |
Previously the results from executionn of qv circuits on Aer were run once and stored in the repo. Then the fitters tests would just load the stored results and fit that data. This was presumably done for run time, however in practice it only takes a few seconds to simulate the circuits and is not a significant overhead. This commit removes the generated data and moves the circuit execution pieces from the generation script into the test file.
I did some testing locally and adding the QV circuit simulations in the fitter test only took about 5-6 seconds on my laptop. So instead of updating the results I just baked the simulation into the fitter test directly in 936d64e. That way we don't have to worry about updating it every time. |
mtreinish
changed the title
[WIP] Migrate Quantum Volume circuits to use circuit library
Migrate Quantum Volume circuits to use circuit library
Jul 31, 2020
chriseclectic
approved these changes
Jul 31, 2020
mtreinish
added a commit
to mtreinish/qiskit-ignis
that referenced
this pull request
Aug 4, 2020
In qiskit-community#460 we migrated the QV circuit generation to use the QV circuit from terra's circuit library instead of constructing it from scratch. As part of that the circuit generation was updated to construct a single virtual circuit via the library and just copy it for the no measure output circuits. However, this was done using a shallow copy (in the interest of performance) which means that any references between the circuits will not be duplicated. For cases where the qubit_lists input is not a contiguous list this would result in the measurements showing up in the no measurement circuits because of shared references. This commit fixes this by using deepcopy instead of a shallow copy so that there are no shared references between the measurement circuit and the no measurement circuit.
mtreinish
added a commit
to mtreinish/qiskit-ignis
that referenced
this pull request
Aug 4, 2020
In qiskit-community#460 we migrated the QV circuit generation to use the QV circuit from terra's circuit library instead of constructing it from scratch. As part of that the circuit generation was updated to construct a single virtual circuit via the library and just copy it for the no measure output circuits. However, this was done using a shallow copy (in the interest of performance) which means that any references between the circuits will not be duplicated. For cases where the qubit_lists input is not a contiguous list this would result in the measurements showing up in the no measurement circuits because of shared references. This commit fixes this by using deepcopy instead of a shallow copy so that there are no shared references between the measurement circuit and the no measurement circuit.
chriseclectic
pushed a commit
that referenced
this pull request
Aug 5, 2020
* Replace shallow copy with deepcopy in QV circuit generation In #460 we migrated the QV circuit generation to use the QV circuit from terra's circuit library instead of constructing it from scratch. As part of that the circuit generation was updated to construct a single virtual circuit via the library and just copy it for the no measure output circuits. However, this was done using a shallow copy (in the interest of performance) which means that any references between the circuits will not be duplicated. For cases where the qubit_lists input is not a contiguous list this would result in the measurements showing up in the no measurement circuits because of shared references. This commit fixes this by using deepcopy instead of a shallow copy so that there are no shared references between the measurement circuit and the no measurement circuit. * Fix lint * Adjust seed usage to account for QuantumVolume class rng usage The seed parameter beign passed directly to the QuantumVolume circuit library resulted in the generated circuits all being identical. To ensure that we get reproducible but useful output this changes the seed usage to create it's own random Generator and use the seed parameter as the seed for that. Then the generator is used to generate a sequence of random integers which get passed to each QuantumVolume object.
mtreinish
added
Changelog: Deprecation
Include in Deprecated section of changelog
Changelog: New Feature
Include in the Added section of the changelog
labels
Aug 6, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Changelog: Deprecation
Include in Deprecated section of changelog
Changelog: New Feature
Include in the Added section of the changelog
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This commit starts the process of using the terra circuits library by
refactoring the quantum volume circuit generator function to internally
use the quantum volume circuit from the library instead of constructing
it manually. It also tries to rationalize the input parameters since
several didn't have any effect and others were not properly listed as
required. This is done in a backwards compatible manner to not break
existing users.
Moving forward we probably want to deprecate this entire function and write a new implementation that has simpler and more flexible inputs. The current function is both trying to do too much (ie handle layout via qubit_lists) and not doing enough (ie not giving flexibility on depth). We should figure out how we expect people to want to be able run QV experiments and what the inputs to that would look like and use that as the model for how circuit generation is done.
Details and comments
Partially addresses #395