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

Use Qiskit Runtime SamplerV2 in local mode instead of BackendSamplerV2 in test #513

Merged
merged 5 commits into from
Apr 17, 2024
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ dependencies = [
"numpy>=1.23.0",
"scipy>=1.5.2",
"rustworkx>=0.14.0",
"qiskit-aer>=0.13.3",
"qiskit-aer>=0.14.0.1",
"qiskit>=1.0.0, <2.0",
"qiskit-ibm-runtime>=0.21.0",
"qiskit-ibm-runtime>=0.23.0",
]

[project.optional-dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
upgrade:
- |
CKT now requires updated versions of some dependencies: ``qiskit``
1.0 or later, ``qiskit-aer`` 0.13.3 or later, and
``qiskit-ibm-runtime`` 0.21.0 or later.
1.0 or later, ``qiskit-aer`` 0.14.0 or later, and
``qiskit-ibm-runtime`` 0.23.0 or later.
18 changes: 3 additions & 15 deletions test/cutting/test_cutting_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@
from qiskit.quantum_info import PauliList
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.providers.fake_provider import GenericBackendV2

try:
from qiskit.primitives import BackendSamplerV2
except ImportError:
backendsamplerv2_available = False
else:
backendsamplerv2_available = True
from qiskit_ibm_runtime import SamplerV2
from qiskit_aer.primitives import Sampler
from qiskit_aer import AerSimulator

Expand Down Expand Up @@ -190,10 +184,6 @@ def test_wire_cut_workflow_with_reused_qubits():
assert "reset" not in subexpt.count_ops()


@pytest.mark.skipif(
not backendsamplerv2_available,
reason="BackendSamplerV2 is not available in Qiskit < 1.1",
)
def test_reconstruction_with_samplerv2():
"""Smoke test for reconstruction using samplerv2"""
qc = QuantumCircuit(4)
Expand All @@ -213,11 +203,9 @@ def test_reconstruction_with_samplerv2():
num_samples=100,
)

# Use BackendSamplerV2 with AerSimulator, following
# https://github.com/Qiskit/qiskit-aer/issues/2078#issuecomment-1971498534
# Use SamplerV2 in local mode with AerSimulator
samplers = {
label: BackendSamplerV2(backend=AerSimulator())
for label in subexperiments.keys()
label: SamplerV2(backend=AerSimulator()) for label in subexperiments.keys()
caleb-johnson marked this conversation as resolved.
Show resolved Hide resolved
}
results = {
label: sampler.run(subexperiments[label], shots=128).result()
Expand Down