-
Notifications
You must be signed in to change notification settings - Fork 6
Nexus worker improvements, graphs and docs #207
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
Changes from all commits
f8acb4b
d3ce725
0f07850
7a2c72e
74e24bc
7fba3f6
dcd8593
d38d894
ae2f2ef
5f08165
c82563c
38f1297
89acc96
52e7e66
4c43244
2104ed4
fb82aae
b08cf56
5947d74
dd77d65
312e023
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Nexus worker |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| OPENQASM 2.0; | ||
| include "qelib1.inc"; | ||
| qreg q[23]; | ||
| creg c[23]; | ||
| creg meas[23]; | ||
| h q[0]; | ||
| cx q[0],q[1]; | ||
| cx q[1],q[2]; | ||
| cx q[2],q[3]; | ||
| cx q[3],q[4]; | ||
| cx q[4],q[5]; | ||
| cx q[5],q[6]; | ||
| cx q[6],q[7]; | ||
| cx q[7],q[8]; | ||
| cx q[8],q[9]; | ||
| cx q[9],q[10]; | ||
| cx q[10],q[11]; | ||
| cx q[11],q[12]; | ||
| cx q[12],q[13]; | ||
| cx q[13],q[14]; | ||
| cx q[14],q[15]; | ||
| cx q[15],q[16]; | ||
| cx q[16],q[17]; | ||
| cx q[17],q[18]; | ||
| cx q[18],q[19]; | ||
| cx q[19],q[20]; | ||
| cx q[20],q[21]; | ||
| cx q[21],q[22]; | ||
| barrier q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],q[8],q[9],q[10],q[11],q[12],q[13],q[14],q[15],q[16],q[17],q[18],q[19],q[20],q[21],q[22]; | ||
| measure q[0] -> meas[0]; | ||
|
Collaborator
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. I think its possible to do
Collaborator
Author
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. No doubt you have a better idea than me. I'm using this (from https://github.com/pnnl/QASMBench/tree/master/medium/ghz_state_n23). |
||
| measure q[1] -> meas[1]; | ||
| measure q[2] -> meas[2]; | ||
| measure q[3] -> meas[3]; | ||
| measure q[4] -> meas[4]; | ||
| measure q[5] -> meas[5]; | ||
| measure q[6] -> meas[6]; | ||
| measure q[7] -> meas[7]; | ||
| measure q[8] -> meas[8]; | ||
| measure q[9] -> meas[9]; | ||
| measure q[10] -> meas[10]; | ||
| measure q[11] -> meas[11]; | ||
| measure q[12] -> meas[12]; | ||
| measure q[13] -> meas[13]; | ||
| measure q[14] -> meas[14]; | ||
| measure q[15] -> meas[15]; | ||
| measure q[16] -> meas[16]; | ||
| measure q[17] -> meas[17]; | ||
| measure q[18] -> meas[18]; | ||
| measure q[19] -> meas[19]; | ||
| measure q[20] -> meas[20]; | ||
| measure q[21] -> meas[21]; | ||
| measure q[22] -> meas[22]; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| OPENQASM 2.0; | ||
| include "hqslib1.inc"; | ||
|
|
||
| qreg q[2]; | ||
| creg c[2]; | ||
| U1q(0.20000000000000012*pi,0.0*pi) q[0]; | ||
| U1q(0.5*pi,0.5*pi) q[1]; | ||
| RZZ(0.5*pi) q[0],q[1]; | ||
| measure q[0] -> c[0]; | ||
| U1q(0.5*pi,0.0*pi) q[1]; | ||
| measure q[1] -> c[1]; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| from pathlib import Path | ||
| from uuid import UUID | ||
| from qnexus import AerConfig | ||
| from pytket.qasm.qasm import circuit_from_qasm | ||
|
|
||
| from tierkreis.consts import PACKAGE_PATH | ||
| from tierkreis.controller import run_graph | ||
| from tierkreis.graphs.nexus.submit_poll import nexus_submit_and_poll | ||
| from tierkreis.storage import FileStorage, read_outputs | ||
| from tierkreis.executor import UvExecutor | ||
|
|
||
| aer_config = AerConfig() | ||
| circuit = circuit_from_qasm(Path(__file__).parent / "data" / "ghz_state_n23.qasm") | ||
| circuits = [circuit] | ||
|
|
||
|
|
||
| def main(): | ||
| g = nexus_submit_and_poll() | ||
| storage = FileStorage(UUID(int=107), do_cleanup=True) | ||
| executor = UvExecutor(PACKAGE_PATH / ".." / "tierkreis_workers", storage.logs_path) | ||
|
|
||
| run_graph( | ||
| storage, | ||
| executor, | ||
| g, | ||
| { | ||
| "project_name": "2025-tkr-test", | ||
| "job_name": "job-1", | ||
| "circuits": circuits, | ||
| "n_shots": [30] * len(circuits), | ||
| "backend_config": aer_config, | ||
| }, | ||
| polling_interval_seconds=0.1, | ||
| ) | ||
| res = read_outputs(g, storage) | ||
| print(res) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| """Code generated from TestNamespace namespace. Please do not edit.""" | ||
|
|
||
| from typing import NamedTuple, Protocol | ||
| from tierkreis.controller.data.models import TKR | ||
| from tierkreis.controller.data.types import PType, Struct | ||
|
|
||
|
|
||
| class A(NamedTuple): | ||
| age: TKR[int] # noqa: F821 # fmt: skip | ||
| name: TKR[dict[str, str]] # noqa: F821 # fmt: skip | ||
|
|
||
|
|
||
| class B(Struct, Protocol): | ||
| age: int # noqa: F821 # fmt: skip | ||
| name: dict[str, str] # noqa: F821 # fmt: skip | ||
|
|
||
|
|
||
| class C[T: PType](Struct, Protocol): | ||
| a: list[int] # noqa: F821 # fmt: skip | ||
| b: B # noqa: F821 # fmt: skip | ||
| t: T # noqa: F821 # fmt: skip | ||
|
|
||
|
|
||
| class foo(NamedTuple): | ||
| a: TKR[int] # noqa: F821 # fmt: skip | ||
| b: TKR[str] # noqa: F821 # fmt: skip | ||
|
|
||
| @staticmethod | ||
| def out() -> type[A]: # noqa: F821 # fmt: skip | ||
| return A # noqa: F821 # fmt: skip | ||
|
|
||
| @property | ||
| def namespace(self) -> str: | ||
| return "TestNamespace" | ||
|
|
||
|
|
||
| class bar(NamedTuple): | ||
| @staticmethod | ||
| def out() -> type[TKR[B]]: # noqa: F821 # fmt: skip | ||
| return TKR[B] # noqa: F821 # fmt: skip | ||
|
|
||
| @property | ||
| def namespace(self) -> str: | ||
| return "TestNamespace" | ||
|
|
||
|
|
||
| class z[T: PType](NamedTuple): | ||
| c: TKR[C[T]] # noqa: F821 # fmt: skip | ||
|
|
||
| @staticmethod | ||
| def out() -> type[TKR[C[T]]]: # noqa: F821 # fmt: skip | ||
| return TKR[C[T]] # noqa: F821 # fmt: skip | ||
|
|
||
| @property | ||
| def namespace(self) -> str: | ||
| return "TestNamespace" |
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.
do we need this?