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

Update tests for Qiskit 1.0 #41

Merged
merged 3 commits into from
Feb 23, 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
2 changes: 1 addition & 1 deletion qiskit_neko/aer_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""Qiskit Aer default backend plugin."""

import qiskit_aer as aer
from qiskit.providers import fake_provider
from qiskit_ibm_runtime import fake_provider

from qiskit_neko import backend_plugin

Expand Down
8 changes: 4 additions & 4 deletions qiskit_neko/tests/circuits/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import math

from qiskit.circuit import QuantumCircuit
from qiskit import execute
from qiskit import transpile

from qiskit_neko import decorators
from qiskit_neko.tests import base
Expand All @@ -40,7 +40,7 @@ def test_bell_execute_fixed_shots(self):
circuit.h(0)
circuit.cx(0, 1)
circuit.measure_all()
job = execute(circuit, self.backend, shots=100)
job = self.backend.run(transpile(circuit, self.backend), shots=100)
result = job.result()
counts = result.get_counts()
self.assertDictAlmostEqual(counts, {"00": 50, "11": 50}, delta=10)
Expand All @@ -53,7 +53,7 @@ def test_bell_execute_default_shots(self):
circuit.cx(0, 1)
circuit.measure_all()
expected_count = self.backend.options.shots / 2
job = execute(circuit, self.backend)
job = self.backend.run(transpile(circuit, self.backend))
result = job.result()
counts = result.get_counts()
delta = 10 ** (math.log10(self.backend.options.shots) - 1)
Expand All @@ -69,7 +69,7 @@ def test_bell_execute_backend_shots_set_options(self):
circuit.cx(0, 1)
circuit.measure_all()
self.backend.set_options(shots=100)
job = execute(circuit, self.backend)
job = self.backend.run(transpile(circuit, self.backend))
result = job.result()
counts = result.get_counts()
self.assertDictAlmostEqual(counts, {"00": 50, "11": 50}, delta=10)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ qiskit-aer
qiskit-nature[pyscf]
qiskit-experiments
qiskit-machine-learning
qiskit-ibm-runtime>=0.19
Copy link
Member

Choose a reason for hiding this comment

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

Is there a potential problem here that Runtime doesn't use Neko, so could merge breaking changes to the Neko actions unknowingly?

Copy link
Member

Choose a reason for hiding this comment

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

During my searching for backend_selection, I also realised that qiskit-algorithms doesn't have a Neko job in CI, so could also break it without us knowing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think it could be worth dropping the backend_selection ability of the Aer plugin to get specific IBM-like devices? On a quick scan, I couldn't see any repos actually using the functionality.

Is there a potential problem here that Runtime doesn't use Neko, so could merge breaking changes to the Neko actions unknowingly?

Yeah, we should add a CI job to qiskit-ibm-runtime if we go this path. We could potentially remove this functionality and just rely on users to make their own backend plugin to use the fake backends. I was using this locally to test things out when I was first getting neko setup, but I don't know how widely used this part of the interface was. The plugin interface supports it but each plugin doesn't need to implement name selection.

During my searching for backend_selection, I also realised that qiskit-algorithms doesn't have a Neko job in CI, so could also break it without us knowing.

Yeah we should add a job to qiskit-algorithms, we can ask @woodsp-ibm or @ElePT about it.

Copy link
Member

Choose a reason for hiding this comment

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

Well we do have a jobs in Algorithms that run all the unit tests against Qiskit Main so at least from that side we can see and it did turn up an issue along the way to the final 1.0. They are not required for CI, all that is is done against stable release, but they are run in each PR and in the nightly CI run.

image

Copy link
Member

Choose a reason for hiding this comment

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

Neko's a bit different to testing against Qiskit main, though - Algorithms running Neko in CI is / would be just as much a protection for all the other Neko users as for Algorithms itself.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've proposed a PR to qiskit-ibm-runtime here: Qiskit/qiskit-ibm-runtime#1422 which adds a matching job. We need to update the custom action to leverage the backend selection mechanism to use the fake backends in the package. But that will have to come after this PR as this is necessary to unblock CI for everyone.

stestr>=3.2.0
testtools>=2.5.0
fixtures>=3.0.0
Expand Down
Loading