Skip to content
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

Fix calling backend.name() for backendV2 (backport #11065) #11076

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions qiskit/utils/backend_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,21 @@ def is_statevector_backend(backend):
Returns:
bool: True is statevector
"""
if backend is None:
return False
backend_interface_version = _get_backend_interface_version(backend)
if has_aer():
from qiskit.providers.aer.backends import AerSimulator, StatevectorSimulator

if isinstance(backend, StatevectorSimulator):
return True
if isinstance(backend, AerSimulator) and "aer_simulator_statevector" in backend.name():
return True
if backend is None:
return False
backend_interface_version = _get_backend_interface_version(backend)
if isinstance(backend, AerSimulator):
if backend_interface_version <= 1:
name = backend.name()
else:
name = backend.name
if "aer_simulator_statevector" in name:
return True
if backend_interface_version <= 1:
return backend.name().startswith("statevector")
else:
Expand Down
7 changes: 7 additions & 0 deletions releasenotes/notes/fix_backend_name-e84661707058b529.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
fixes:
- |
Fixed an issue in the :class:`.QuantumInstance` class where it was assuming
all ``AerSimulator`` backends were always :class:`.BackendV1`. This would cause
combatibility issues with the 0.13.0 release of ``qiskit-aer`` which is starting to
use :class:`.BackendV2` for `AerSimulator`` backends.