-
Notifications
You must be signed in to change notification settings - Fork 2
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
CSU-10 Add QPU information endpoints to ZMQ server #5
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
75d64c9
Add QPU information endpoints to ZMQ server
jfriel-oqc c541472
update dependancies and codeowners
jfriel-oqc 99b0a4a
add .vscode to .gitignore
bgsach 1557552
Merge branch 'main' into feature/qpu_info_endpoints
bgsach 3f86e3f
bump to qat 2.2.0
bgsach 6bcb655
bug fix
bgsach 0f06b84
updated qat
bgsach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# For now everyone gets added to all PRs by default. Fine while the PR velocity is small, we'll change if | ||
# necessary as time goes on. | ||
* @jfriel-oqc @keriksson-rosenqvist @owen-oqc @hamidelmaazouz @chemix-lunacy @bgsach | ||
* @keriksson-rosenqvist @owen-oqc @hamidelmaazouz @bgsach @daria-oqc @lcauser-oqc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,9 @@ logs/ | |
# PyCharm | ||
.idea/ | ||
|
||
# VS Code | ||
.vscode | ||
|
||
# C extensions | ||
*.so | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
import threading | ||
from importlib.metadata import version | ||
|
||
import pytest | ||
from qat.purr.compiler.config import CompilerConfig | ||
from compiler_config.config import CompilerConfig | ||
from qat.purr.backends.echo import ( | ||
add_direction_couplings_to_hardware, | ||
get_default_echo_hardware, | ||
) | ||
|
||
from qat_rpc.utils.constants import PROMETHEUS_PORT | ||
from qat_rpc.utils.metrics import MetricExporter, PrometheusReceiver | ||
from qat_rpc.zmq.wrappers import ZMQClient, ZMQServer | ||
|
||
qubit_count = 8 | ||
qpu_couplings = [(i, j) for i in range(qubit_count) for j in range(qubit_count) if i != j] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was previously no check that i!=j which caused flakeyness in the tests. |
||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
def server(): | ||
hardware = get_default_echo_hardware(qubit_count=qubit_count) | ||
hardware = add_direction_couplings_to_hardware(hardware, qpu_couplings) | ||
server = ZMQServer( | ||
metric_exporter=MetricExporter(backend=PrometheusReceiver(PROMETHEUS_PORT)) | ||
hardware=hardware, | ||
metric_exporter=MetricExporter(backend=PrometheusReceiver(PROMETHEUS_PORT)), | ||
) | ||
server_thread = threading.Thread(target=server.run, daemon=True) | ||
server_thread.start() | ||
|
@@ -27,17 +38,6 @@ def server(): | |
""" | ||
|
||
|
||
def test_zmq_flow(): | ||
client = ZMQClient() | ||
|
||
config = CompilerConfig() | ||
config.results_format.binary_count() | ||
config.repeats = 100 | ||
|
||
response = client.execute_task(program, config) | ||
assert response["results"]["c"]["00"] == 100 | ||
|
||
|
||
def test_zmq_exception(): | ||
client = ZMQClient() | ||
|
||
|
@@ -84,3 +84,50 @@ def test_two_zmq_clients(): | |
thread00.join() | ||
thread01.join() | ||
thread10.join() | ||
|
||
|
||
def test_program(): | ||
client = ZMQClient() | ||
|
||
config = CompilerConfig() | ||
config.results_format.binary_count() | ||
config.repeats = 100 | ||
|
||
response = client.execute_task(program, config) | ||
assert response["results"]["c"]["00"] == 100 | ||
|
||
|
||
def test_program_backwards_compatible(): | ||
client = ZMQClient() | ||
|
||
config = CompilerConfig() | ||
config.results_format.binary_count() | ||
config.repeats = 100 | ||
|
||
response = client._send((program, config.to_json())) | ||
print(response) | ||
assert response["results"]["c"]["00"] == 100 | ||
|
||
|
||
def test_api_version(): | ||
client = ZMQClient() | ||
api_version = client.api_version() | ||
assert api_version["qat_rpc_version"] == version("qat_rpc") | ||
|
||
|
||
def test_couplings(): | ||
client = ZMQClient() | ||
couplings = client.qpu_couplings() | ||
assert couplings["couplings"] == qpu_couplings | ||
|
||
|
||
def test_qubit_info(): | ||
client = ZMQClient() | ||
qubit_info = client.qubit_info() | ||
assert qubit_info["Exception"] is not None | ||
|
||
|
||
def test_qpu_info(): | ||
client = ZMQClient() | ||
qpu_info = client.qpu_info() | ||
assert qpu_info["qpu_info"] is not None |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some of this should live in a
qat_rpc/utils.py
module or even a centralServer
class, as it's not ZMQ specific, and there's potentially going to be other rpc methods in the future.OK for now though.