This release is a pre-release and may not be stable for production use.
qcc-device-recommender
サブ量子回路の実行に適したデバイスを推薦するプログラムです。
使い方
ライブラリのインポート
from device_recommender import match_subqc_to_device
サブ量子回路のリストを用意する。"qasm"はqasmファイルのパスでも、qasm自体(str)でも可能。
subqc_lst = []
subqc_info = {"name": "a",
"qasm": "data/qasm3_sample/circuit_1.qasm3",
"nshot": 1000}
subqc_lst.append(subqc_info)
subqc_info = {"name": "bb",
"qasm": "data/qasm3_sample/circuit_2.qasm3",
"nshot": 2000}
subqc_lst.append(subqc_info)
subqc_info = {"name": "ccc",
"qasm": "data/qasm3_sample/circuit_3.qasm3",
"nshot": 1000}
subqc_lst.append(subqc_info)
デバイスのリストを用意する。
device_lst = []
device_info = {"name": "qpu_1",
"n_qubit": 10,
"coupling_map": [[0, 1],
[1, 0],
[1, 2],
[2, 1],
[2, 3],
[3, 2],
[3, 4],
[4, 3],
[4, 5],
[5, 4],
[5, 6],
[6, 5],
[6, 7],
[7, 6],
[7, 8],
[8, 7],
[8, 9],
[9, 8]],
"gate_speed": 2e-9}
device_lst.append(device_info)
device_info = {"name": "qpu_2",
"n_qubit": 10,
"coupling_map": [[0, 1],
[1, 0],
[3, 4],
[4, 3],
[6, 7],
[7, 6],
[1, 2],
[2, 1],
[4, 5],
[5, 4],
[7, 8],
[8, 7],
[0, 3],
[3, 0],
[3, 6],
[6, 3],
[6, 9],
[9, 6],
[1, 4],
[4, 1],
[4, 7],
[7, 4],
[2, 5],
[5, 2],
[5, 8],
[8, 5]],
"gate_speed": 3e-9}
device_lst.append(device_info)
関数match_subqc_to_deviceにサブ量子回路のリストとデバイスのリストを渡して実行する
subqc2device = match_subqc_to_device(subqc_lst, device_lst, verbose=True)
subqc a
device: qpu_1, expected_time: 6.6e-05
depth: 11, depth_compiled: 33
device: qpu_2, expected_time: 5.9999999999999995e-05
depth: 11, depth_compiled: 20
subqc bb
device: qpu_1, expected_time: 0.00027600000000000004
depth: 20, depth_compiled: 69
device: qpu_2, expected_time: 0.000228
depth: 20, depth_compiled: 38
subqc ccc
device: qpu_1, expected_time: 2.2000000000000003e-05
depth: 11, depth_compiled: 11
device: qpu_2, expected_time: 3.2999999999999996e-05
depth: 11, depth_compiled: 11
結果の確認
subqc2device
{'a': {'device': 'qpu_2', 'expected_time': 5.9999999999999995e-05},
'bb': {'device': 'qpu_2', 'expected_time': 0.000228},
'ccc': {'device': 'qpu_1', 'expected_time': 2.2000000000000003e-05}}
サブ回路"a"と"bb"には"qpu_2"が最適、サブ回路"ccc"には"qpu_1"が最適という結果が得られている。
Metadata
Release files for qcc-device-recommender 0.2.0.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qcc_device_recommender-0.2.0.dev0.tar.gz | 68.1 kB | Without provenance | Details for qcc_device_recommender-0.2.0.dev0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qcc_device_recommender-0.2.0.dev0-py3-none-any.whl | Python 3 | none | any | Details for qcc_device_recommender-0.2.0.dev0-py3-none-any.whl |
Total release size: 134.9 kB
Release files / qcc_device_recommender-0.2.0.dev0.tar.gz
| Download URL | qcc_device_recommender-0.2.0.dev0.tar.gz |
|---|---|
| Size | 68.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
268c0f156e260059842f12162bdf588b3f8f1cad5d9c05689c35090ca16bd854
|
|
BLAKE2b-256 checksum How to use checksums |
01ca10e1ccccfe9e1da178aede54ca54becc14f5d7f6f2b1139b152917752b89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / qcc_device_recommender-0.2.0.dev0-py3-none-any.whl
| Download URL | qcc_device_recommender-0.2.0.dev0-py3-none-any.whl |
|---|---|
| Size | 66.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74f21cfded107b48fb7332743ae8ada828978bc8a734f1c2c4d0046af3f58e33
|
|
BLAKE2b-256 checksum How to use checksums |
347d2b9aa9290e1051ba4ec0e4c1826967ab71470f3c0dbe2a078899409addac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Security for qcc-device-recommender 0.2.0.dev0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.