pcss-qapi 0.1.2__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/.gitlab-ci.yml +2 -2
- pcss_qapi-0.2.0/.pre-commit-config.yaml +21 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/PKG-INFO +3 -1
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/_static/css/custom.css +4 -2
- pcss_qapi-0.2.0/docs/_static/logo.svg +7 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/conf.py +40 -45
- pcss_qapi-0.2.0/docs/examples.rst +55 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/index.rst +1 -1
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/tutorials.rst +1 -1
- pcss_qapi-0.2.0/examples/orca_dependencyless.ipynb +173 -0
- pcss_qapi-0.2.0/examples/orca_pt1.ipynb +928 -0
- pcss_qapi-0.2.0/jupyter_execute/tutorials/orca.ipynb +302 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi/__init__.py +1 -1
- pcss_qapi-0.2.0/pcss_qapi/api/__init__.py +5 -0
- {pcss_qapi-0.1.2/pcss_qapi → pcss_qapi-0.2.0/pcss_qapi/api}/auth/__init__.py +2 -1
- pcss_qapi-0.2.0/pcss_qapi/api/auth/auth_service.py +123 -0
- {pcss_qapi-0.1.2/pcss_qapi → pcss_qapi-0.2.0/pcss_qapi/api}/auth/oauth_flow.py +22 -31
- pcss_qapi-0.2.0/pcss_qapi/api/connection_base.py +36 -0
- pcss_qapi-0.2.0/pcss_qapi/api/connections.py +18 -0
- pcss_qapi-0.2.0/pcss_qapi/aqt/__init__.py +3 -0
- pcss_qapi-0.2.0/pcss_qapi/aqt/aqt_resource.py +64 -0
- pcss_qapi-0.2.0/pcss_qapi/aqt/provider.py +37 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi/orca/__init__.py +7 -4
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi/orca/backend.py +41 -24
- pcss_qapi-0.1.2/pcss_qapi/base/job_base.py → pcss_qapi-0.2.0/pcss_qapi/orca/base.py +38 -4
- pcss_qapi-0.2.0/pcss_qapi/orca/mock_backend.py +192 -0
- pcss_qapi-0.2.0/pcss_qapi/orca/orca_task.py +145 -0
- pcss_qapi-0.2.0/pcss_qapi/orca/provider.py +58 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi/orca/ptseries_integration/__init__.py +2 -1
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi/orca/ptseries_integration/pt_adapter.py +28 -9
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi/utils/__init__.py +2 -1
- pcss_qapi-0.2.0/pcss_qapi/utils/fs_manager.py +62 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi/utils/requests.py +3 -2
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi.egg-info/PKG-INFO +3 -1
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi.egg-info/SOURCES.txt +15 -9
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi.egg-info/requires.txt +3 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pyproject.toml +8 -1
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/tests/orca/test_imports.py +6 -6
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/tests/orca/test_integration.py +27 -20
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/tests/orca/test_task.py +12 -8
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/tests/test_auth.py +10 -8
- pcss_qapi-0.2.0/tests/utils/auth.py +63 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/tests/utils/conf.py +11 -10
- pcss_qapi-0.2.0/tests/utils/connection.py +13 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/tests/utils/orca.py +13 -14
- pcss_qapi-0.2.0/uv.lock +3371 -0
- pcss_qapi-0.1.2/.pre-commit-config.yaml +0 -16
- pcss_qapi-0.1.2/docs/_static/logo.svg +0 -12
- pcss_qapi-0.1.2/docs/examples.rst +0 -20
- pcss_qapi-0.1.2/pcss_qapi/auth/auth_service.py +0 -132
- pcss_qapi-0.1.2/pcss_qapi/auth/connections.py +0 -15
- pcss_qapi-0.1.2/pcss_qapi/base/connection_base.py +0 -20
- pcss_qapi-0.1.2/pcss_qapi/base/provider_base.py +0 -38
- pcss_qapi-0.1.2/pcss_qapi/orca/orca_task.py +0 -152
- pcss_qapi-0.1.2/pcss_qapi/orca/provider.py +0 -65
- pcss_qapi-0.1.2/pcss_qapi/utils/fs_manager.py +0 -66
- pcss_qapi-0.1.2/pylintrc +0 -7
- pcss_qapi-0.1.2/tests/utils/auth.py +0 -75
- pcss_qapi-0.1.2/tests/utils/connection.py +0 -14
- pcss_qapi-0.1.2/uv.lock +0 -2136
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/.gitignore +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/.python-version +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/.vscode/.gitignore +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/.vscode/settings.json +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/README.md +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/.gitignore +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/Makefile +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/README.md +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/_templates/layour.rst +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/_templates/module.rst +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/_templates/package.rst +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/build.sh +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/make.bat +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/docs/serve.sh +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/examples/orca.ipynb +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi/utils/exceptions.py +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi.egg-info/dependency_links.txt +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/pcss_qapi.egg-info/top_level.txt +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/set_dev_env.sh +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/setup.cfg +0 -0
- {pcss_qapi-0.1.2/pcss_qapi/base → pcss_qapi-0.2.0/tests}/__init__.py +0 -0
- {pcss_qapi-0.1.2/tests → pcss_qapi-0.2.0/tests/aqt}/__init__.py +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/tests/orca/__init__.py +0 -0
- {pcss_qapi-0.1.2 → pcss_qapi-0.2.0}/tests/utils/__init__.py +0 -0
|
@@ -13,14 +13,14 @@ default:
|
|
|
13
13
|
- apt-get install -y git
|
|
14
14
|
- pip install uv
|
|
15
15
|
- uv venv .venv
|
|
16
|
-
- uv sync
|
|
16
|
+
- uv sync --all-extras
|
|
17
17
|
- source .venv/bin/activate
|
|
18
18
|
- uv pip install git+https://ptseries-CI:${PTSERIES_TOKEN}@gitlab.pcss.pl/quantum/ptseries.git
|
|
19
19
|
|
|
20
20
|
pylint_and_pytest:
|
|
21
21
|
stage: testing and code analysis
|
|
22
22
|
script:
|
|
23
|
-
-
|
|
23
|
+
- ruff check pcss_qapi
|
|
24
24
|
- pytest -v tests
|
|
25
25
|
|
|
26
26
|
rules:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/hhatto/autopep8
|
|
3
|
+
rev: v2.3.2
|
|
4
|
+
hooks:
|
|
5
|
+
- id: autopep8
|
|
6
|
+
args: ["--max-line-length=140", "--in-place", "--aggressive", "--aggressive"]
|
|
7
|
+
|
|
8
|
+
# - repo: local
|
|
9
|
+
# hooks:
|
|
10
|
+
# - id: pylint
|
|
11
|
+
# exclude: ^(tests|docs)/.*$
|
|
12
|
+
# name: pylint
|
|
13
|
+
# entry: .venv/bin/pylint
|
|
14
|
+
# language: system
|
|
15
|
+
# types: [python]
|
|
16
|
+
# args: ["-rn", "-sn", "--rcfile=pylintrc"]
|
|
17
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
18
|
+
rev: v0.15.6
|
|
19
|
+
hooks:
|
|
20
|
+
- id: ruff-check
|
|
21
|
+
- id: ruff-format
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pcss_qapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Python client for pcss quantum api
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -11,6 +11,8 @@ Provides-Extra: orca
|
|
|
11
11
|
Requires-Dist: torch>=2.7.0; extra == "orca"
|
|
12
12
|
Requires-Dist: torchaudio>=2.7.0; extra == "orca"
|
|
13
13
|
Requires-Dist: torchvision>=0.22.0; extra == "orca"
|
|
14
|
+
Provides-Extra: aqt
|
|
15
|
+
Requires-Dist: qiskit-aqt-provider>=1.10.0; extra == "aqt"
|
|
14
16
|
|
|
15
17
|
# pcss-python-api
|
|
16
18
|
|
|
@@ -23,9 +23,11 @@ button.sidebar-toggle {
|
|
|
23
23
|
max-height: 300px !important;
|
|
24
24
|
max-width: 300px !important;
|
|
25
25
|
|
|
26
|
-
height:
|
|
27
|
-
width:
|
|
26
|
+
height: auto;
|
|
27
|
+
width: 70%;
|
|
28
28
|
|
|
29
29
|
min-height: 100px !important;
|
|
30
30
|
min-width: 100px !important;
|
|
31
|
+
|
|
32
|
+
margin-bottom: 2rem;
|
|
31
33
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<mask id="circleMask">
|
|
3
|
+
<rect width="100%" height="100%" fill="white"/>
|
|
4
|
+
<circle cx="14" cy="14" r="4" fill="black"/>
|
|
5
|
+
</mask>
|
|
6
|
+
<path d="M28 14C28 17.427 28 23 28 28C23.5 28 18.305 28 14 28C6.26801 28 -4.74968e-07 21.732 -3.0598e-07 14C-1.36992e-07 6.26801 6.26801 1.36992e-07 14 3.0598e-07C21.732 4.74968e-07 28 6.26801 28 14Z" fill="#005AF7" mask="url(#circleMask)"/>
|
|
7
|
+
</svg>
|
|
@@ -4,31 +4,33 @@
|
|
|
4
4
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
from pathlib import Path
|
|
8
8
|
import sys
|
|
9
9
|
import tomllib
|
|
10
10
|
from unittest import mock
|
|
11
11
|
import better_apidoc
|
|
12
12
|
|
|
13
|
-
conf_path =
|
|
14
|
-
project_path =
|
|
15
|
-
lib_path =
|
|
16
|
-
sys.path.insert(0, project_path)
|
|
13
|
+
conf_path = Path(__file__).absolute().parent
|
|
14
|
+
project_path = conf_path.parent
|
|
15
|
+
lib_path = project_path / "pcss_qapi"
|
|
16
|
+
sys.path.insert(0, str(project_path))
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def run_apidoc(app):
|
|
20
20
|
"""Generate API documentation"""
|
|
21
21
|
better_apidoc.APP = app
|
|
22
|
-
better_apidoc.main(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
better_apidoc.main(
|
|
23
|
+
[
|
|
24
|
+
"better-apidoc",
|
|
25
|
+
"-t",
|
|
26
|
+
str(Path(".", "_templates")),
|
|
27
|
+
"--force",
|
|
28
|
+
"--separate",
|
|
29
|
+
"-o",
|
|
30
|
+
str(Path(".", "API")),
|
|
31
|
+
str(lib_path), # Generate docs only for qailab/
|
|
32
|
+
]
|
|
33
|
+
)
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
# -- Project information -----------------------------------------------------
|
|
@@ -36,33 +38,33 @@ def run_apidoc(app):
|
|
|
36
38
|
|
|
37
39
|
# Grab info from pyproject.toml
|
|
38
40
|
|
|
39
|
-
with open(
|
|
41
|
+
with open(project_path / "pyproject.toml", "rb") as f:
|
|
40
42
|
parsed_pyproject = tomllib.load(f)
|
|
41
43
|
|
|
42
|
-
name = parsed_pyproject[
|
|
43
|
-
version = parsed_pyproject[
|
|
44
|
+
name = parsed_pyproject["project"]["name"].replace("_", " ").title()
|
|
45
|
+
version = parsed_pyproject["project"]["version"]
|
|
44
46
|
|
|
45
47
|
project = name
|
|
46
|
-
copyright =
|
|
47
|
-
author =
|
|
48
|
+
copyright = "2025, psnc-qcg"
|
|
49
|
+
author = "pcss"
|
|
48
50
|
release = version
|
|
49
51
|
|
|
50
52
|
# -- General configuration ---------------------------------------------------
|
|
51
53
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
52
54
|
|
|
53
55
|
suppress_warnings = [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
"myst.header", # ipynb linter
|
|
57
|
+
"myst.xref_missing",
|
|
58
|
+
"docutils", # rst linter
|
|
57
59
|
]
|
|
58
60
|
|
|
59
61
|
extensions = [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
"sphinx.ext.autodoc",
|
|
63
|
+
"sphinx.ext.napoleon",
|
|
64
|
+
"sphinx.ext.autosummary",
|
|
65
|
+
"sphinx.ext.viewcode",
|
|
66
|
+
"sphinx_copybutton",
|
|
67
|
+
"myst_nb",
|
|
66
68
|
]
|
|
67
69
|
|
|
68
70
|
myst_enable_extensions = [
|
|
@@ -78,7 +80,7 @@ viewcode_line_numbers = True
|
|
|
78
80
|
autodoc_typehints = "both"
|
|
79
81
|
autodoc_typehints_description_target = "documented"
|
|
80
82
|
|
|
81
|
-
autodoc_mock_imports = [
|
|
83
|
+
autodoc_mock_imports = ["sklearn"]
|
|
82
84
|
|
|
83
85
|
for module in autodoc_mock_imports:
|
|
84
86
|
sys.modules[module] = mock.MagicMock()
|
|
@@ -87,30 +89,23 @@ napoleon_numpy_docstring = False
|
|
|
87
89
|
|
|
88
90
|
nb_execution_mode = "off"
|
|
89
91
|
|
|
90
|
-
templates_path = [
|
|
91
|
-
exclude_patterns = [
|
|
92
|
-
'_build',
|
|
93
|
-
'Thumbs.db',
|
|
94
|
-
'.DS_Store',
|
|
95
|
-
'tests/*',
|
|
96
|
-
'*.md',
|
|
97
|
-
'API/modules.rst'
|
|
98
|
-
]
|
|
92
|
+
templates_path = ["_templates"]
|
|
93
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "tests/*", "*.md", "API/modules.rst"]
|
|
99
94
|
|
|
100
95
|
|
|
101
96
|
# -- Options for HTML output -------------------------------------------------
|
|
102
97
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
103
98
|
|
|
104
|
-
html_static_path = [
|
|
105
|
-
html_css_files = [
|
|
99
|
+
html_static_path = ["_static"]
|
|
100
|
+
html_css_files = ["css/custom.css"]
|
|
106
101
|
|
|
107
|
-
html_theme =
|
|
108
|
-
html_logo =
|
|
102
|
+
html_theme = "sphinx_book_theme"
|
|
103
|
+
html_logo = "_static/logo.svg"
|
|
109
104
|
html_favicon = "_static/logo.svg"
|
|
110
105
|
|
|
111
106
|
html_show_sourcelink = False # Disable option to show .rst source
|
|
112
107
|
|
|
113
108
|
|
|
114
109
|
def setup(app):
|
|
115
|
-
app.connect(
|
|
116
|
-
app.add_css_file(
|
|
110
|
+
app.connect("builder-inited", run_apidoc)
|
|
111
|
+
app.add_css_file("css/custom.css")
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Examples
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
Getting a backend
|
|
5
|
+
------------------
|
|
6
|
+
::
|
|
7
|
+
|
|
8
|
+
from pcss_qapi import AuthorizationService
|
|
9
|
+
from pcss_qapi.orca import OrcaProvider
|
|
10
|
+
|
|
11
|
+
AuthorizationService.login()
|
|
12
|
+
|
|
13
|
+
provider = OrcaProvider()
|
|
14
|
+
|
|
15
|
+
backend = provider.least_busy()
|
|
16
|
+
|
|
17
|
+
TBI sampling
|
|
18
|
+
------------------
|
|
19
|
+
|
|
20
|
+
::
|
|
21
|
+
|
|
22
|
+
backend: OrcaBackend = ...
|
|
23
|
+
|
|
24
|
+
tbi = backend.get_tbi()
|
|
25
|
+
|
|
26
|
+
samples = tbi.sample(input_state=[1, 0], theta_list=[np.pi/4], n_samples=10)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
PTLayer inference
|
|
30
|
+
------------------
|
|
31
|
+
|
|
32
|
+
::
|
|
33
|
+
|
|
34
|
+
import torch
|
|
35
|
+
|
|
36
|
+
backend: OrcaBackend = ...
|
|
37
|
+
|
|
38
|
+
ptlayer = backend.get_ptlayer(in_features=2)
|
|
39
|
+
output = ptlayer(torch.tensor([[1.0,-1.0]],dtype=torch.float32))
|
|
40
|
+
|
|
41
|
+
Binary Bosonic Solver training
|
|
42
|
+
------------------
|
|
43
|
+
|
|
44
|
+
::
|
|
45
|
+
|
|
46
|
+
backend: OrcaBackend = ...
|
|
47
|
+
|
|
48
|
+
objective = lambda sample_array: -sample_array[0] #"optimize" for the first qumode to be a 1
|
|
49
|
+
|
|
50
|
+
bbs = backend.get_bbs(pb_dim = 4, objective = objective_function)
|
|
51
|
+
|
|
52
|
+
bbs.solve(updates=20, print_frequency=2)
|
|
53
|
+
|
|
54
|
+
best_energy = bbs.best_cost
|
|
55
|
+
solution = bbs.best_solution
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"id": "994dd930",
|
|
6
|
+
"metadata": {},
|
|
7
|
+
"source": [
|
|
8
|
+
"# Using PCSS QAPI for ORCA-PT-1 "
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cell_type": "markdown",
|
|
13
|
+
"id": "8d992eb8",
|
|
14
|
+
"metadata": {},
|
|
15
|
+
"source": [
|
|
16
|
+
"## Logging in"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"cell_type": "code",
|
|
21
|
+
"execution_count": null,
|
|
22
|
+
"id": "03500607",
|
|
23
|
+
"metadata": {},
|
|
24
|
+
"outputs": [],
|
|
25
|
+
"source": [
|
|
26
|
+
"from pcss_qapi import AuthorizationService\n",
|
|
27
|
+
"\n",
|
|
28
|
+
"AuthorizationService.login()"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"cell_type": "markdown",
|
|
33
|
+
"id": "925d57fa",
|
|
34
|
+
"metadata": {},
|
|
35
|
+
"source": [
|
|
36
|
+
"## Getting a provider"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"cell_type": "code",
|
|
41
|
+
"execution_count": null,
|
|
42
|
+
"id": "cf329b19",
|
|
43
|
+
"metadata": {},
|
|
44
|
+
"outputs": [],
|
|
45
|
+
"source": [
|
|
46
|
+
"from pcss_qapi.orca import OrcaProvider\n",
|
|
47
|
+
"\n",
|
|
48
|
+
"provider = OrcaProvider()"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"cell_type": "markdown",
|
|
53
|
+
"id": "6e22bc02",
|
|
54
|
+
"metadata": {},
|
|
55
|
+
"source": [
|
|
56
|
+
"## Getting a backend\n",
|
|
57
|
+
"\n",
|
|
58
|
+
"A list of available backends can be fetched from the provider."
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"cell_type": "code",
|
|
63
|
+
"execution_count": null,
|
|
64
|
+
"id": "a5ec92d4",
|
|
65
|
+
"metadata": {},
|
|
66
|
+
"outputs": [],
|
|
67
|
+
"source": [
|
|
68
|
+
"provider.available_backends(simulators=True)"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"cell_type": "code",
|
|
73
|
+
"execution_count": null,
|
|
74
|
+
"id": "dcc9557a",
|
|
75
|
+
"metadata": {},
|
|
76
|
+
"outputs": [],
|
|
77
|
+
"source": [
|
|
78
|
+
"provider.available_backends(simulators=False)"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"cell_type": "markdown",
|
|
83
|
+
"id": "b325f14d",
|
|
84
|
+
"metadata": {},
|
|
85
|
+
"source": [
|
|
86
|
+
"A backend can either be specified by name or automatically fetched based on the smallest queue length (real devices only)."
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"cell_type": "code",
|
|
91
|
+
"execution_count": null,
|
|
92
|
+
"id": "a146e08d",
|
|
93
|
+
"metadata": {},
|
|
94
|
+
"outputs": [],
|
|
95
|
+
"source": [
|
|
96
|
+
"backend = provider.get_backend(\"single_loop_simulator\")\n",
|
|
97
|
+
"backend"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"cell_type": "code",
|
|
102
|
+
"execution_count": null,
|
|
103
|
+
"id": "5bcf00c7",
|
|
104
|
+
"metadata": {},
|
|
105
|
+
"outputs": [],
|
|
106
|
+
"source": [
|
|
107
|
+
"backend = provider.least_busy()\n",
|
|
108
|
+
"backend"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"cell_type": "markdown",
|
|
113
|
+
"id": "42fc4a13",
|
|
114
|
+
"metadata": {},
|
|
115
|
+
"source": [
|
|
116
|
+
"## Using the ORCA-PT-1 quantum computer\n",
|
|
117
|
+
"\n",
|
|
118
|
+
"Each backend represents a single quantum computer (or simulator) and provides a few options of interacting with the device:\n",
|
|
119
|
+
"- A simple TBI (Time Bin Inferometer) class for sampling\n",
|
|
120
|
+
"- A PyTorch compatible layer for integrating the PT-1 into neural networks\n",
|
|
121
|
+
"- A Binary Bosonic Solver class for solving combinatorial optimization problems"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"cell_type": "markdown",
|
|
126
|
+
"id": "f1e9c4c6",
|
|
127
|
+
"metadata": {},
|
|
128
|
+
"source": [
|
|
129
|
+
"### TBI"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"cell_type": "code",
|
|
134
|
+
"execution_count": null,
|
|
135
|
+
"id": "712583f2",
|
|
136
|
+
"metadata": {},
|
|
137
|
+
"outputs": [],
|
|
138
|
+
"source": [
|
|
139
|
+
"tbi = backend.get_tbi(n_loops=1, loop_lengths=[1])\n",
|
|
140
|
+
"tbi.sample(input_state=[0, 1, 0], theta_list=[1, 2], n_samples=200, n_tiling=1)"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"cell_type": "code",
|
|
145
|
+
"execution_count": null,
|
|
146
|
+
"id": "117dbb9e",
|
|
147
|
+
"metadata": {},
|
|
148
|
+
"outputs": [],
|
|
149
|
+
"source": []
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"metadata": {
|
|
153
|
+
"kernelspec": {
|
|
154
|
+
"display_name": "pcss-qapi (3.11.11)",
|
|
155
|
+
"language": "python",
|
|
156
|
+
"name": "python3"
|
|
157
|
+
},
|
|
158
|
+
"language_info": {
|
|
159
|
+
"codemirror_mode": {
|
|
160
|
+
"name": "ipython",
|
|
161
|
+
"version": 3
|
|
162
|
+
},
|
|
163
|
+
"file_extension": ".py",
|
|
164
|
+
"mimetype": "text/x-python",
|
|
165
|
+
"name": "python",
|
|
166
|
+
"nbconvert_exporter": "python",
|
|
167
|
+
"pygments_lexer": "ipython3",
|
|
168
|
+
"version": "3.11.11"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"nbformat": 4,
|
|
172
|
+
"nbformat_minor": 5
|
|
173
|
+
}
|