Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Deprecate BasicSimulator.configuration #13367

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

ElePT
Copy link
Contributor

@ElePT ElePT commented Oct 24, 2024

Summary

Closes #12843.

Details and comments

@ElePT ElePT added the Changelog: Deprecation Include in "Deprecated" section of changelog label Oct 24, 2024
@ElePT ElePT added this to the 1.3.0 milestone Oct 24, 2024
@ElePT ElePT requested review from jyu00 and a team as code owners October 24, 2024 15:22
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Oct 25, 2024

Pull Request Test Coverage Report for Build 11594412911

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 2 files are covered.
  • 705 unchanged lines in 9 files lost coverage.
  • Overall coverage increased (+0.03%) to 88.692%

Files with Coverage Reduction New Missed Lines %
qiskit/circuit/library/iqp.py 1 96.15%
qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py 2 97.01%
crates/qasm2/src/lex.rs 5 91.98%
qiskit/qasm3/exporter.py 17 96.14%
crates/qasm2/src/parse.rs 18 96.69%
qiskit/quantum_info/operators/symplectic/base_pauli.py 30 88.55%
crates/accelerate/src/sparse_observable.rs 54 95.42%
crates/circuit/src/operations.rs 145 89.21%
crates/circuit/src/dag_circuit.rs 433 88.65%
Totals Coverage Status
Change from base Build 11578734687: 0.03%
Covered Lines: 75502
Relevant Lines: 85128

💛 - Coveralls

mtreinish
mtreinish previously approved these changes Oct 29, 2024
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fun cycle of deprecations getting emitted between assemble and the backend. Personally I'm not sure the filterwarnings inline in code because that can hide things when we need to rely on it later. But in this case I think it's fine especially as all of this functionality will be removed at a high level in 2.0.

The only comment I really had was about maybe adding a link to the backend version migration guide in the release note. Although it is also maybe a question of whether we need to improve the docs in the migration guide too? (like is it missing something). But if you're happy with the release note or want to fix them in a follow up, potentially post rc1 that's fine and feel free to enqueue this for merging.

Comment on lines +192 to +201
# Note for future: this method is used in `BasicSimulator` and may need to be kept past the
# `assemble` removal deadline (2.0). If it is kept (potentially in a different location),
# we will need an alternative for the backend.configuration() access that currently takes
# place in L566 (`parse_circuit_args`) and L351 (`parse_common_args`)
# because backend.configuration() is also set for removal in 2.0.
# The ultimate goal will be to move away from relying on any kind of `assemble` implementation
# because of how tightly coupled it is to these legacy data structures. But as a transition step,
# given that we would only have to support the subcase of `BasicSimulator`, we could probably just
# inline the relevant config values that are already hardcoded in the basic simulator configuration
# generator.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, it should not be hard to rewrite the run_experiment method of basic simulator to avoid needing qobj. The assemble usage in there is kind of a weird legacy from BaseBackend which required a qobj get passed to the run() method.

Comment on lines 10 to 29
Here is a quick guide for accessing the most common ``BackendConfiguration`` attributes in the
:class:`BackendV2` model:""

BackendV1 model (deprecated) ------------> BackendV2 model
---------------------------- ---------------
backend.configuration().backend_name backend.name
backend.configuration().backend_version backend.backend_version
backend.configuration().n_qubits backend.num_qubits
backend.configuration().num_qubits backend.num_qubits
backend.configuration().basis_gates backend.target.operation_names (*)
backend.configuration().coupling_map backend.target.build_coupling_map()
backend.configuration().local No representation
backend.configuration().simulator No representation
backend.configuration().conditional No representation
backend.configuration().open_pulse No representation
backend.configuration().memory No representation
backend.configuration().max_shots No representation

(*) Note that ``backend.target.operation_names`` includes ``basis_gates`` and additional
non-gate instructions, in some implementations it might be necessary to filter the output.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't a lot of extra information but I added it in case the migration guide gets improvements (I know there's an open issue for that).

@mtreinish mtreinish enabled auto-merge October 30, 2024 14:24
@mtreinish mtreinish added this pull request to the merge queue Oct 30, 2024
Merged via the queue into Qiskit:main with commit e07becb Oct 30, 2024
17 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Changelog: Deprecation Include in "Deprecated" section of changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BasicSimulator uses deprecated BackendConfiguration
4 participants