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 Aer's SamplerV2 instead of SamplerV1 #643

Merged
merged 2 commits into from
Jul 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
5 changes: 4 additions & 1 deletion test/cutting/test_cutting_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
)
from qiskit.quantum_info import PauliList, random_unitary
from qiskit.primitives import Estimator
from qiskit_ibm_runtime import SamplerV2
from qiskit_aer import AerSimulator
from qiskit_aer.primitives import Sampler

from circuit_knitting.utils.simulation import ExactSampler
Expand Down Expand Up @@ -172,7 +174,8 @@ def test_cutting_exact_reconstruction(example_circuit):


@pytest.mark.parametrize(
"sampler,is_exact_sampler", [(Sampler(), False), (ExactSampler(), True)]
"sampler,is_exact_sampler",
[(Sampler(), False), (SamplerV2(AerSimulator()), False), (ExactSampler(), True)],
)
def test_sampler_with_identity_subobservable(sampler, is_exact_sampler):
"""This test ensures that the sampler works for a subcircuit with no observable measurements.
Expand Down
7 changes: 3 additions & 4 deletions test/cutting/test_cutting_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.providers.fake_provider import GenericBackendV2
from qiskit_ibm_runtime import SamplerV2
from qiskit_aer.primitives import Sampler
from qiskit_aer import AerSimulator

from circuit_knitting.cutting.qpd.instructions import SingleQubitQPDGate
Expand Down Expand Up @@ -89,11 +88,11 @@ def test_exotic_labels(label1, label2):
assert subexperiments.keys() == subcircuits.keys()

samplers = {
label1: Sampler(run_options={"shots": 10}),
label2: Sampler(run_options={"shots": 10}),
label1: SamplerV2(AerSimulator()),
label2: SamplerV2(AerSimulator()),
}
results = {
label: sampler.run(subexperiments[label]).result()
label: sampler.run(subexperiments[label], shots=10).result()
for label, sampler in samplers.items()
}

Expand Down