Skip to main content

Software for finding the best quantum device for subcircuit execution.

Project description

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"が最適という結果が得られている。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qcc_device_recommender-0.2.0.dev0.tar.gz (68.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qcc_device_recommender-0.2.0.dev0-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

File details

Details for the file qcc_device_recommender-0.2.0.dev0.tar.gz.

File metadata

File hashes

Hashes for qcc_device_recommender-0.2.0.dev0.tar.gz
Algorithm Hash digest
SHA256 268c0f156e260059842f12162bdf588b3f8f1cad5d9c05689c35090ca16bd854
MD5 2f21fa32139ca106f98b067054e0ced1
BLAKE2b-256 01ca10e1ccccfe9e1da178aede54ca54becc14f5d7f6f2b1139b152917752b89

See more details on using hashes here.

File details

Details for the file qcc_device_recommender-0.2.0.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for qcc_device_recommender-0.2.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 74f21cfded107b48fb7332743ae8ada828978bc8a734f1c2c4d0046af3f58e33
MD5 b0b85ab2686eed9ec7221b7e5c740b24
BLAKE2b-256 347d2b9aa9290e1051ba4ec0e4c1826967ab71470f3c0dbe2a078899409addac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page