-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Simulator Interfaces #421
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
Closed
Closed
Simulator Interfaces #421
Conversation
This file contains hidden or 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
… name in all configs.
9 tasks
9 tasks
4b4e77c
to
ea1bc41
Compare
- Parallelisation is now handled exclusively by OpenMP - No longer parallelisation over shots on Xcode-clang build - Also adds text param support for snapshot, save, load instructions
…to interfaces-simulators-python
Opened a new PR with clean history (#435 ) |
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Working towards plug-and-play interchangability of simulator backends, ensuring input/outputs are the same.
Resolves #281 (Simulator Interfaces)
Resolves #314 (Simulator testing)
Resolves #324 (Sympy Simulator testing).
Description
Adds 2 new backends:
statevector_simulator_cpp
andstatevector_simulator_py
, used for simulating the wavefunction for a single shot, without noise and measurement. The result is returned in thequantum_state
field of the result dictionaryAdds a new snapshot command for saving snapshots of simulator internal representations, over all qubits. For the python simulator, this is only the
quantum_state
. For the cpp simulator, this can bequantum_state
,density_matrix
,probabilities
, etc. (refer to doc). The following simulator commands are treated like barriers to prevent reordering:snapshot
,noise
,save
,load
Converts the
qasm_simulator_sympy
tostatevector_simulator_sympy
, since the point of a sympy simulator is to preserve precise amplitudes, not to do measurements and counts.Adds a mechanism for providers to report information about aliased names and deprecated names.
Aliased names are useful since there could be several implementations of functionally similar backends within a provider. So, for example, the user can just write
get_backend('local_qasm_simulator')
, and this would return an instance ofQasmSimulatorCpp()
. If that is not built, then an instance ofQasmSimualtorPy()
.Deprecated names are useful since backend names could change. For example, now all previous code that use
local_qiskit_simulator
will automatically redirect tolocal_qasm_simualtor_cpp
, with a deprecation warning.Adds an optional
compact
flag when inquiring backend names from the wrapper. For example,wrapper.local_backends()
returns:but
wrapper.local_backends(compact=False)
returns:One positive effect of the above is that all previous code that simply used
local_qasm_simulator
now run with a faster version, if available. This speeds up running the test suite.Adds a
_validate()
method to several simulators, which is called immediately before a qobj isrun()
. This can validate semantic things that a schema cannot, such as measurements being at the end of circuit.The behavior of getting the
quantum_state
by settingshots=1
in the simulators is now deprecated. You can either use thelocal_statevector_simulator
to do this automatically, or use thelocal_qasm_simulator
and place an explicitsnapshot
command. However, backwards compatibility is still preserved.This PR touches a lot of files, but most are only minor name changes.
New names are in accordance with this (also see picture below):
PROVIDERNAME_SIMPLEALIAS_simulator_LANGUAGEORPROJECT
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: