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.
Files changed (60) hide show
  1. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/.github/workflows/publish.yml +1 -1
  2. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/.gitignore +6 -0
  3. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/.pre-commit-config.yaml +2 -2
  4. {qc_parallelizer-1.3.2/src/qc_parallelizer.egg-info → qc_parallelizer-2.0.1}/PKG-INFO +11 -7
  5. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/README.md +36 -19
  6. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/README.pypi.md +4 -4
  7. qc_parallelizer-2.0.1/notebooks/README.md +29 -0
  8. qc_parallelizer-2.0.1/notebooks/circuit-layouts.ipynb +271 -0
  9. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/notebooks/circuit-packers.ipynb +120 -116
  10. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/notebooks/helpers.py +3 -33
  11. qc_parallelizer-2.0.1/notebooks/parallel-circuits-introduction.ipynb +843 -0
  12. qc_parallelizer-2.0.1/notebooks/parallelizer-v2.drawio.png +0 -0
  13. qc_parallelizer-2.0.1/notebooks/ring-packing.ipynb +130 -0
  14. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/pyproject.toml +7 -5
  15. qc_parallelizer-2.0.1/src/qc_parallelizer/__init__.py +3 -0
  16. qc_parallelizer-2.0.1/src/qc_parallelizer/backends/__init__.py +7 -0
  17. qc_parallelizer-2.0.1/src/qc_parallelizer/backends/circuitbin.py +205 -0
  18. qc_parallelizer-2.0.1/src/qc_parallelizer/backends/manager.py +183 -0
  19. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/base.py +11 -0
  20. qc_parallelizer-2.0.1/src/qc_parallelizer/interfaces/__init__.py +15 -0
  21. {qc_parallelizer-1.3.2/src/qc_parallelizer/extensions → qc_parallelizer-2.0.1/src/qc_parallelizer/interfaces}/backend.py +49 -8
  22. {qc_parallelizer-1.3.2/src/qc_parallelizer/extensions → qc_parallelizer-2.0.1/src/qc_parallelizer/interfaces}/circuit.py +32 -12
  23. qc_parallelizer-2.0.1/src/qc_parallelizer/interfaces/conversions.py +194 -0
  24. qc_parallelizer-2.0.1/src/qc_parallelizer/jobs/__init__.py +6 -0
  25. qc_parallelizer-2.0.1/src/qc_parallelizer/jobs/job.py +427 -0
  26. qc_parallelizer-2.0.1/src/qc_parallelizer/packers/__init__.py +15 -0
  27. qc_parallelizer-2.0.1/src/qc_parallelizer/packers/base.py +116 -0
  28. qc_parallelizer-2.0.1/src/qc_parallelizer/packers/smt.py +324 -0
  29. qc_parallelizer-2.0.1/src/qc_parallelizer/packers/vf2.py +150 -0
  30. qc_parallelizer-2.0.1/src/qc_parallelizer/parallelizer.py +138 -0
  31. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/util/__init__.py +5 -0
  32. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/util/layouts.py +6 -3
  33. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/util/logging.py +71 -47
  34. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer/util/translation.py +33 -13
  35. {qc_parallelizer-1.3.2/src/qc_parallelizer/extensions → qc_parallelizer-2.0.1/src/qc_parallelizer/util}/typing.py +1 -1
  36. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1/src/qc_parallelizer.egg-info}/PKG-INFO +11 -7
  37. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer.egg-info/SOURCES.txt +18 -11
  38. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer.egg-info/requires.txt +6 -1
  39. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/benchmark_parallelizer.py +14 -11
  40. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/test_extensions.py +2 -1
  41. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/test_parallelizer.py +14 -11
  42. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/utils.py +3 -4
  43. qc_parallelizer-1.3.2/notebooks/circuit-layouts.ipynb +0 -253
  44. qc_parallelizer-1.3.2/notebooks/parallel-circuits-introduction.ipynb +0 -608
  45. qc_parallelizer-1.3.2/src/qc_parallelizer/__init__.py +0 -3
  46. qc_parallelizer-1.3.2/src/qc_parallelizer/bins/circuitbin.py +0 -164
  47. qc_parallelizer-1.3.2/src/qc_parallelizer/bins/manager.py +0 -192
  48. qc_parallelizer-1.3.2/src/qc_parallelizer/extensions/__init__.py +0 -3
  49. qc_parallelizer-1.3.2/src/qc_parallelizer/packers.py +0 -568
  50. qc_parallelizer-1.3.2/src/qc_parallelizer/parallelizer.py +0 -219
  51. qc_parallelizer-1.3.2/src/qc_parallelizer/results/paralleljob.py +0 -97
  52. qc_parallelizer-1.3.2/src/qc_parallelizer/results/postprocessing.py +0 -180
  53. qc_parallelizer-1.3.2/src/qc_parallelizer/results/visualization.py +0 -70
  54. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/LICENSE +0 -0
  55. /qc_parallelizer-1.3.2/notebooks/parallelizer-full.drawio.png → /qc_parallelizer-2.0.1/notebooks/parallelizer-v1.drawio.png +0 -0
  56. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/setup.cfg +0 -0
  57. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer.egg-info/dependency_links.txt +0 -0
  58. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/src/qc_parallelizer.egg-info/top_level.txt +0 -0
  59. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/__init__.py +0 -0
  60. {qc_parallelizer-1.3.2 → qc_parallelizer-2.0.1}/tests/test_util.py +0 -0
@@ -45,7 +45,7 @@ jobs:
45
45
  - name: Set up Python
46
46
  uses: actions/setup-python@v5
47
47
  with:
48
- python-version: "3.10"
48
+ python-version: "3.11"
49
49
  - name: Install build
50
50
  run: python3 -m pip install build --user
51
51
  - name: Build package
@@ -175,3 +175,9 @@ cython_debug/
175
175
 
176
176
  # Profiling
177
177
  *.prof
178
+
179
+ # VS Code
180
+ .vscode/
181
+
182
+ # Hidden notebooks
183
+ .*.ipynb
@@ -13,9 +13,9 @@ repos:
13
13
  hooks:
14
14
  - id: ruff
15
15
  args: [ --fix ]
16
- types_or: [ python, pyi, jupyter ]
16
+ types_or: [ python, pyi ]
17
17
  - id: ruff-format
18
- types_or: [ python, pyi, jupyter ]
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: 1.3.2
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.10
9
+ Requires-Python: >=3.11
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
- Requires-Dist: qiskit<1.3,>=1.0
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
- [![python](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org)
32
+ [![python](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org)
29
33
  [![PyPI version](https://badge.fury.io/py/qc-parallelizer.svg)](https://pypi.org/project/qc-parallelizer)
30
34
  [![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](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). The
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
- ![](https://raw.githubusercontent.com/vttresearch/qc-parallelizer/refs/heads/main/notebooks/parallelizer-full.drawio.png)
40
+ ![the parallelizer diagram](https://raw.githubusercontent.com/vttresearch/qc-parallelizer/refs/heads/main/notebooks/parallelizer-v2.drawio.png)
37
41
 
38
42
  ## Authors
39
43
 
@@ -1,16 +1,15 @@
1
1
  # Quantum Circuit Parallelizer
2
2
 
3
- [![python](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org)
3
+ [![python](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org)
4
4
  [![PyPI version](https://badge.fury.io/py/qc-parallelizer.svg)](https://pypi.org/project/qc-parallelizer)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](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
- ![diagram describing the module's internal operation](./notebooks/parallelizer-full.drawio.png)
12
+ ![the parallelizer diagram](./notebooks/parallelizer-v2.drawio.png)
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
- # Parallelize and execute. This call will
57
- # 1. determine how to combine the circuits and for which backends, and
58
- # 2. submit jobs to the backends.
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.results()
64
- qiskit.visualization.plot_histogram(result[0].get_counts())
65
- # The job object behaves just like a regular Qiskit Job object, but values are arrays.
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 job_id in job.job_id():
68
- print(f" - {job_id}")
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.10 pip
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
- - Make `.execute()` batch jobs together. On backends with relatively long initialization times,
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 even more complex, so this a step for the distant future.
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
- [![python](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org)
3
+ [![python](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org)
4
4
  [![PyPI version](https://badge.fury.io/py/qc-parallelizer.svg)](https://pypi.org/project/qc-parallelizer)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](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). The
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
- ![](https://raw.githubusercontent.com/vttresearch/qc-parallelizer/refs/heads/main/notebooks/parallelizer-full.drawio.png)
11
+ ![the parallelizer diagram](https://raw.githubusercontent.com/vttresearch/qc-parallelizer/refs/heads/main/notebooks/parallelizer-v2.drawio.png)
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.