qc-parallelizer 1.3.2__tar.gz → 2.0.1__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.
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/.github/workflows/publish.yml +1 -1
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/.gitignore +6 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/.pre-commit-config.yaml +2 -2
- {qc_parallelizer-1.3.2/src/qc_parallelizer.egg-info → qc_parallelizer-2.0.1}/PKG-INFO +11 -7
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/README.md +36 -19
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/README.pypi.md +4 -4
- qc_parallelizer-2.0.1/notebooks/README.md +29 -0
- qc_parallelizer-2.0.1/notebooks/circuit-layouts.ipynb +271 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/notebooks/circuit-packers.ipynb +120 -116
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/notebooks/helpers.py +3 -33
- qc_parallelizer-2.0.1/notebooks/parallel-circuits-introduction.ipynb +843 -0
- qc_parallelizer-2.0.1/notebooks/parallelizer-v2.drawio.png +0 -0
- qc_parallelizer-2.0.1/notebooks/ring-packing.ipynb +130 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/pyproject.toml +7 -5
- qc_parallelizer-2.0.1/src/qc_parallelizer/__init__.py +3 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/backends/__init__.py +7 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/backends/circuitbin.py +205 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/backends/manager.py +183 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/base.py +11 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/interfaces/__init__.py +15 -0
- {qc_parallelizer-1.3.2/src/qc_parallelizer/extensions → qc_parallelizer-2.0.1/src/qc_parallelizer/interfaces}/backend.py +49 -8
- {qc_parallelizer-1.3.2/src/qc_parallelizer/extensions → qc_parallelizer-2.0.1/src/qc_parallelizer/interfaces}/circuit.py +32 -12
- qc_parallelizer-2.0.1/src/qc_parallelizer/interfaces/conversions.py +194 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/jobs/__init__.py +6 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/jobs/job.py +427 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/packers/__init__.py +15 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/packers/base.py +116 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/packers/smt.py +324 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/packers/vf2.py +150 -0
- qc_parallelizer-2.0.1/src/qc_parallelizer/parallelizer.py +138 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/util/__init__.py +5 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/util/layouts.py +6 -3
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/util/logging.py +71 -47
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/util/translation.py +33 -13
- {qc_parallelizer-1.3.2/src/qc_parallelizer/extensions → qc_parallelizer-2.0.1/src/qc_parallelizer/util}/typing.py +1 -1
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1/src/qc_parallelizer.egg-info}/PKG-INFO +11 -7
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer.egg-info/SOURCES.txt +18 -11
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer.egg-info/requires.txt +6 -1
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/benchmark_parallelizer.py +14 -11
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/test_extensions.py +2 -1
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/test_parallelizer.py +14 -11
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/utils.py +3 -4
- qc_parallelizer-1.3.2/notebooks/circuit-layouts.ipynb +0 -253
- qc_parallelizer-1.3.2/notebooks/parallel-circuits-introduction.ipynb +0 -608
- qc_parallelizer-1.3.2/src/qc_parallelizer/__init__.py +0 -3
- qc_parallelizer-1.3.2/src/qc_parallelizer/bins/circuitbin.py +0 -164
- qc_parallelizer-1.3.2/src/qc_parallelizer/bins/manager.py +0 -192
- qc_parallelizer-1.3.2/src/qc_parallelizer/extensions/__init__.py +0 -3
- qc_parallelizer-1.3.2/src/qc_parallelizer/packers.py +0 -568
- qc_parallelizer-1.3.2/src/qc_parallelizer/parallelizer.py +0 -219
- qc_parallelizer-1.3.2/src/qc_parallelizer/results/paralleljob.py +0 -97
- qc_parallelizer-1.3.2/src/qc_parallelizer/results/postprocessing.py +0 -180
- qc_parallelizer-1.3.2/src/qc_parallelizer/results/visualization.py +0 -70
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/LICENSE +0 -0
- /qc_parallelizer-1.3.2/notebooks/parallelizer-full.drawio.png → /qc_parallelizer-2.0.1/notebooks/parallelizer-v1.drawio.png +0 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/setup.cfg +0 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer.egg-info/dependency_links.txt +0 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer.egg-info/top_level.txt +0 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/__init__.py +0 -0
- {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/test_util.py +0 -0
|
@@ -13,9 +13,9 @@ repos:
|
|
|
13
13
|
hooks:
|
|
14
14
|
- id: ruff
|
|
15
15
|
args: [ --fix ]
|
|
16
|
-
types_or: [ python, pyi
|
|
16
|
+
types_or: [ python, pyi ]
|
|
17
17
|
- id: ruff-format
|
|
18
|
-
types_or: [ python, pyi
|
|
18
|
+
types_or: [ python, pyi ]
|
|
19
19
|
|
|
20
20
|
- repo: https://github.com/asottile/add-trailing-comma
|
|
21
21
|
rev: v3.1.0
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qc-parallelizer
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: A module for optimally combining and distributing quantum circuits
|
|
5
5
|
Author-email: Henri Ahola <firstname.lastname@vtt.fi>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: GitHub, https://github.com/vttresearch/qc-parallelizer
|
|
8
8
|
Project-URL: Notebooks, https://github.com/vttresearch/qc-parallelizer/tree/main/notebooks
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
-
Requires-Dist: qiskit<
|
|
12
|
+
Requires-Dist: qiskit<2.2,>=1.0
|
|
13
13
|
Requires-Dist: z3-solver>=4.0.0.0
|
|
14
14
|
Requires-Dist: rustworkx>=0.15.0
|
|
15
15
|
Provides-Extra: tests
|
|
@@ -21,19 +21,23 @@ Requires-Dist: iqm-client[qiskit]; extra == "notebooks"
|
|
|
21
21
|
Requires-Dist: ipykernel; extra == "notebooks"
|
|
22
22
|
Requires-Dist: matplotlib; extra == "notebooks"
|
|
23
23
|
Requires-Dist: pylatexenc; extra == "notebooks"
|
|
24
|
+
Requires-Dist: ipywidgets; extra == "notebooks"
|
|
25
|
+
Provides-Extra: visualization
|
|
26
|
+
Requires-Dist: matplotlib; extra == "visualization"
|
|
27
|
+
Requires-Dist: pylatexenc; extra == "visualization"
|
|
24
28
|
Dynamic: license-file
|
|
25
29
|
|
|
26
30
|
# Quantum Circuit Parallelizer
|
|
27
31
|
|
|
28
|
-
[](https://www.python.org)
|
|
29
33
|
[](https://pypi.org/project/qc-parallelizer)
|
|
30
34
|
[](https://opensource.org/licenses/MIT)
|
|
31
35
|
|
|
32
36
|
A Python module for optimally combining and distributing quantum circuits. Please find the source
|
|
33
|
-
code, examples, and documentation, [on GitHub](https://github.com/vttresearch/qc-parallelizer).
|
|
34
|
-
diagram below illustrates the module's operation on a high level.
|
|
37
|
+
code, examples, and documentation, [on GitHub](https://github.com/vttresearch/qc-parallelizer).
|
|
38
|
+
The diagram below illustrates the module's operation on a high level.
|
|
35
39
|
|
|
36
|
-

|
|
37
41
|
|
|
38
42
|
## Authors
|
|
39
43
|
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
# Quantum Circuit Parallelizer
|
|
2
2
|
|
|
3
|
-
[](https://www.python.org)
|
|
4
4
|
[](https://pypi.org/project/qc-parallelizer)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
A Python module for optimally combining and distributing quantum circuits. See the
|
|
9
8
|
[included notebooks](./notebooks/) for examples and documentation.
|
|
10
9
|
|
|
11
10
|
For an operational overview, see the diagram below.
|
|
12
11
|
|
|
13
|
-

|
|
14
13
|
|
|
15
14
|
## Why?
|
|
16
15
|
|
|
@@ -53,19 +52,39 @@ circuits = [QuantumCircuit(...), QuantumCircuit(...), ...]
|
|
|
53
52
|
import iqm.qiskit_iqm as iqm
|
|
54
53
|
backends = [iqm.IQMFakeAdonis(), iqm.IQMFakeAdonis()]
|
|
55
54
|
|
|
56
|
-
#
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
import qc_parallelizer as parallelizer
|
|
60
|
-
job = parallelizer.execute(circuits, backends=backends)
|
|
55
|
+
# Instantiate the parallelizer, define usable backends, and run the circuits.
|
|
56
|
+
from qc_parallelizer import Parallelizer
|
|
57
|
+
job = Parallelizer().across(backends).run(circuits)
|
|
61
58
|
|
|
62
59
|
# Fetch and handle results. This plots the first circuit's result histogram, for example.
|
|
63
|
-
results = job.
|
|
64
|
-
qiskit.visualization.plot_histogram(
|
|
65
|
-
#
|
|
60
|
+
results = job.result()
|
|
61
|
+
qiskit.visualization.plot_histogram(results.get_counts(0))
|
|
62
|
+
# Information about the execution is also available.
|
|
66
63
|
print("Job IDs:")
|
|
67
|
-
for
|
|
68
|
-
print(f"
|
|
64
|
+
for job, id in job.remote_ids.items():
|
|
65
|
+
print(f"- {id} (on '{job.remote_backend.name}')")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The parallelizer also supports emulation of a virtual parallelized backend that can be passed to
|
|
69
|
+
other software. It functions as a regular backend, but automatically parallelizes any circuits that
|
|
70
|
+
are submitted to it:
|
|
71
|
+
|
|
72
|
+
```py
|
|
73
|
+
>>> backend = Parallelizer().across(backends).as_qiskit_backend
|
|
74
|
+
>>> isinstance(backend, BackendV2)
|
|
75
|
+
True
|
|
76
|
+
>>> backend.target
|
|
77
|
+
<qiskit.transpiler.target.Target object at 0x71f0deadbeef>
|
|
78
|
+
>>> job = backend.run(circuits)
|
|
79
|
+
>>> isinstance(job, JobV1)
|
|
80
|
+
True
|
|
81
|
+
>>> job.result()
|
|
82
|
+
Result(
|
|
83
|
+
backend_name='ParallelizedQiskitBackendAdapter',
|
|
84
|
+
backend_version='2',
|
|
85
|
+
job_id='8b019556-bb08-40b5-93ff-788ff1f7fb89',
|
|
86
|
+
results=[...]
|
|
87
|
+
)
|
|
69
88
|
```
|
|
70
89
|
|
|
71
90
|
## Development setup
|
|
@@ -73,7 +92,7 @@ for job_id in job.job_id():
|
|
|
73
92
|
For the following commands, a virtual environment or equivalent isolation is recommended. This can
|
|
74
93
|
be done with Conda, for example, with
|
|
75
94
|
```bash
|
|
76
|
-
conda create --name parallelizer python=3.
|
|
95
|
+
conda create --name parallelizer python=3.11 pip
|
|
77
96
|
conda activate parallelizer
|
|
78
97
|
```
|
|
79
98
|
|
|
@@ -111,12 +130,10 @@ from the repository root. Additionally, there is a benchmarking script in the `t
|
|
|
111
130
|
the data manually. This is of course possible with custom packers already.
|
|
112
131
|
- Add more tests! Numerous configurations have been tested manually with notebooks but more should
|
|
113
132
|
be covered with unit testing.
|
|
114
|
-
-
|
|
115
|
-
batching can make a big difference.
|
|
116
|
-
- Is there a more efficient bin packing system? The problem is NP-hard, so this might require some
|
|
117
|
-
research on its own.
|
|
133
|
+
- Batch jobs with identical measurements together. On backends with relatively long initialization
|
|
134
|
+
times, batching can make a big difference.
|
|
118
135
|
- Allow circuits to share physical qubits for temporally non-overlapping parts. This requires reset
|
|
119
|
-
instructions and makes the problem
|
|
136
|
+
instructions and makes the problem computationally harder, so this a step for the distant future.
|
|
120
137
|
|
|
121
138
|
## Authors
|
|
122
139
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Quantum Circuit Parallelizer
|
|
2
2
|
|
|
3
|
-
[](https://www.python.org)
|
|
4
4
|
[](https://pypi.org/project/qc-parallelizer)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
7
|
A Python module for optimally combining and distributing quantum circuits. Please find the source
|
|
8
|
-
code, examples, and documentation, [on GitHub](https://github.com/vttresearch/qc-parallelizer).
|
|
9
|
-
diagram below illustrates the module's operation on a high level.
|
|
8
|
+
code, examples, and documentation, [on GitHub](https://github.com/vttresearch/qc-parallelizer).
|
|
9
|
+
The diagram below illustrates the module's operation on a high level.
|
|
10
10
|
|
|
11
|
-

|
|
12
12
|
|
|
13
13
|
## Authors
|
|
14
14
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Parallelizer notebooks
|
|
2
|
+
|
|
3
|
+
This folder contains example notebooks for demonstration and documentation purposes.
|
|
4
|
+
|
|
5
|
+
## General
|
|
6
|
+
|
|
7
|
+
- **[Introduction](./parallel-circuits-introduction.ipynb)**
|
|
8
|
+
|
|
9
|
+
This covers the motivation, basic idea, and usage of the package. If the project is new to you,
|
|
10
|
+
start with this notebook.
|
|
11
|
+
|
|
12
|
+
## Feature-specific
|
|
13
|
+
|
|
14
|
+
- **[Layouts](./circuit-layouts.ipynb)**
|
|
15
|
+
|
|
16
|
+
Details on how layout information can be passed to the parallelizer. This is practical if certain
|
|
17
|
+
circuit qubits need to be forced onto certain physical qubits.
|
|
18
|
+
|
|
19
|
+
- **[Packers](./circuit-packers.ipynb)**
|
|
20
|
+
|
|
21
|
+
A list and documentation of circuit packers. Packers control the physical placement of circuits,
|
|
22
|
+
considering the backend's topology and positioning relative to other circuits.
|
|
23
|
+
|
|
24
|
+
## Other examples
|
|
25
|
+
|
|
26
|
+
- **[Ring packing](./ring-packing.ipynb)**
|
|
27
|
+
|
|
28
|
+
A minimally documented example of using the parallelizer to pack circuits with cyclical topology
|
|
29
|
+
onto the VTT Q50.
|