azure-quantum 2.2.0.dev6__py3-none-any.whl → 2.3.0__py3-none-any.whl
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.
- azure/quantum/_client/_version.py +1 -1
- azure/quantum/argument_types/__init__.py +1 -1
- azure/quantum/cirq/service.py +0 -30
- azure/quantum/cirq/targets/ionq.py +0 -31
- azure/quantum/cirq/targets/quantinuum.py +0 -20
- azure/quantum/qiskit/backends/__init__.py +0 -5
- azure/quantum/qiskit/backends/backend.py +2 -19
- azure/quantum/qiskit/backends/ionq.py +0 -15
- azure/quantum/qiskit/backends/quantinuum.py +1 -32
- azure/quantum/qiskit/job.py +2 -8
- azure/quantum/target/ionq.py +0 -111
- azure/quantum/target/microsoft/elements/dft/job.py +108 -2
- azure/quantum/target/microsoft/elements/dft/target.py +157 -8
- azure/quantum/target/microsoft/target.py +0 -329
- azure/quantum/target/quantinuum.py +0 -123
- azure/quantum/target/rigetti/target.py +5 -0
- azure/quantum/target/target.py +1 -11
- azure/quantum/version.py +1 -1
- {azure_quantum-2.2.0.dev6.dist-info → azure_quantum-2.3.0.dist-info}/METADATA +3 -3
- {azure_quantum-2.2.0.dev6.dist-info → azure_quantum-2.3.0.dist-info}/RECORD +22 -28
- {azure_quantum-2.2.0.dev6.dist-info → azure_quantum-2.3.0.dist-info}/WHEEL +1 -1
- azure/quantum/qiskit/backends/microsoft.py +0 -149
- azure/quantum/qiskit/results/__init__.py +0 -0
- azure/quantum/qiskit/results/resource_estimator.py +0 -25
- azure/quantum/target/microsoft/__init__.py +0 -15
- azure/quantum/target/microsoft/job.py +0 -35
- azure/quantum/target/microsoft/result.py +0 -497
- {azure_quantum-2.2.0.dev6.dist-info → azure_quantum-2.3.0.dist-info}/top_level.txt +0 -0
azure/quantum/target/target.py
CHANGED
|
@@ -80,7 +80,7 @@ class Target(abc.ABC, SessionHost):
|
|
|
80
80
|
:type name: str
|
|
81
81
|
:param input_data_format: Format of input data (ex. "qir.v1")
|
|
82
82
|
:type input_data_format: str
|
|
83
|
-
:param output_data_format: Format of output data (ex. "microsoft.
|
|
83
|
+
:param output_data_format: Format of output data (ex. "microsoft.quantum-log.v1")
|
|
84
84
|
:type output_data_format: str
|
|
85
85
|
:param capability: QIR capability. Deprecated, use `target_profile`
|
|
86
86
|
:type capability: str
|
|
@@ -330,16 +330,6 @@ target '{self.name}' of provider '{self.provider_id}' not found."
|
|
|
330
330
|
"""
|
|
331
331
|
return InputParams()
|
|
332
332
|
|
|
333
|
-
def estimate_cost(
|
|
334
|
-
self,
|
|
335
|
-
input_data: Any,
|
|
336
|
-
input_params: Union[Dict[str, Any], None] = None
|
|
337
|
-
):
|
|
338
|
-
"""
|
|
339
|
-
Estimate the cost for a given circuit.
|
|
340
|
-
"""
|
|
341
|
-
return NotImplementedError("Price estimation is not implemented yet for this target.")
|
|
342
|
-
|
|
343
333
|
def _get_azure_workspace(self) -> "Workspace":
|
|
344
334
|
return self.workspace
|
|
345
335
|
|
azure/quantum/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: azure-quantum
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: Python client for Azure Quantum
|
|
5
5
|
Home-page: https://github.com/microsoft/azure-quantum-python
|
|
6
6
|
Author: Microsoft
|
|
@@ -27,7 +27,7 @@ Requires-Dist: graphviz>=0.20.1; extra == "all"
|
|
|
27
27
|
Requires-Dist: pulser<0.19,>=0.18; extra == "all"
|
|
28
28
|
Requires-Dist: qiskit-ionq<0.6,>=0.5; extra == "all"
|
|
29
29
|
Requires-Dist: qsharp[qiskit]<2.0,>=1.9.0; extra == "all"
|
|
30
|
-
Requires-Dist: pyqir<0.11,>=0.10.
|
|
30
|
+
Requires-Dist: pyqir<0.11,>=0.10.6; extra == "all"
|
|
31
31
|
Requires-Dist: Markdown<4.0,>=3.4.1; extra == "all"
|
|
32
32
|
Requires-Dist: python-markdown-math<1.0,>=0.8.0; extra == "all"
|
|
33
33
|
Requires-Dist: qsharp<2.0,>=1.0.33; extra == "all"
|
|
@@ -44,7 +44,7 @@ Requires-Dist: pulser<0.19,>=0.18; extra == "pulser"
|
|
|
44
44
|
Provides-Extra: qiskit
|
|
45
45
|
Requires-Dist: qiskit-ionq<0.6,>=0.5; extra == "qiskit"
|
|
46
46
|
Requires-Dist: qsharp[qiskit]<2.0,>=1.9.0; extra == "qiskit"
|
|
47
|
-
Requires-Dist: pyqir<0.11,>=0.10.
|
|
47
|
+
Requires-Dist: pyqir<0.11,>=0.10.6; extra == "qiskit"
|
|
48
48
|
Requires-Dist: Markdown<4.0,>=3.4.1; extra == "qiskit"
|
|
49
49
|
Requires-Dist: python-markdown-math<1.0,>=0.8.0; extra == "qiskit"
|
|
50
50
|
Provides-Extra: qsharp
|
|
@@ -2,7 +2,7 @@ azure/quantum/__init__.py,sha256=Za8xZY4lzFkW8m4ero-bqrfN437D2NRukM77ukb4GPM,508
|
|
|
2
2
|
azure/quantum/_constants.py,sha256=nDL_QrGdI_Zz_cvTB9nVgfE7J6A_Boo1ollMYqsiEBs,3499
|
|
3
3
|
azure/quantum/_workspace_connection_params.py,sha256=KoT90U89Dj6pVwAKp_ENJL1hyTF0oQe7w0QioOGvjXg,21685
|
|
4
4
|
azure/quantum/storage.py,sha256=_4bMniDk9LrB_K5CQwuCivJFZXdmhRvU2b6Z3xxXw9I,12556
|
|
5
|
-
azure/quantum/version.py,sha256=
|
|
5
|
+
azure/quantum/version.py,sha256=GEd2ft3bCMWju8VtjXrAo-KCleey7-8UKW4slWuuFhA,235
|
|
6
6
|
azure/quantum/workspace.py,sha256=1__iZTe59ozAsAGJ4nECxmk_211Dm8ALJi-MFIdrg4o,23438
|
|
7
7
|
azure/quantum/_authentication/__init__.py,sha256=bniNZlS0hMIjO_y7DevGBAS6MixyA5pbPHcdGipUWM4,236
|
|
8
8
|
azure/quantum/_authentication/_chained.py,sha256=0rdohB_fVGFHUhlly9sGxqQTBTZGpGxtlBqNHDFbAqE,4848
|
|
@@ -14,7 +14,7 @@ azure/quantum/_client/_configuration.py,sha256=5uktKtZxoVVAoSyeL0VNGS9AfPERp-9rU
|
|
|
14
14
|
azure/quantum/_client/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
15
15
|
azure/quantum/_client/_serialization.py,sha256=KJSS6KWgnKcz-cENQCmWZ9Ziv303lnBbLwFIpYZeKFU,81097
|
|
16
16
|
azure/quantum/_client/_vendor.py,sha256=h8ByiyZ4cCQyFxqnuhTQdv1Rms3dVjKsrgZDzwMcSJ0,996
|
|
17
|
-
azure/quantum/_client/_version.py,sha256=
|
|
17
|
+
azure/quantum/_client/_version.py,sha256=P1f813gUNzQVuJ1KodrFeYe048KTdzHTQu2R3CDqRlg,495
|
|
18
18
|
azure/quantum/_client/models/__init__.py,sha256=c1PRpzNsQTcDk4GkrFMMIlwNQQa2c0p5N0Lzd-23YBA,2100
|
|
19
19
|
azure/quantum/_client/models/_enums.py,sha256=omj_B8_E8ONzTHg5hLgDlFYibRRbdr9sEN298im_otA,2977
|
|
20
20
|
azure/quantum/_client/models/_models.py,sha256=wktCM5oBVfwQetNoHobL1wNsC3knXV-HmqBq_Q77Kw4,41810
|
|
@@ -22,15 +22,15 @@ azure/quantum/_client/models/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb
|
|
|
22
22
|
azure/quantum/_client/operations/__init__.py,sha256=1mIl1WjHa-yFdX45TZayC1JfYeEPj5v7E2i7vck69qM,1154
|
|
23
23
|
azure/quantum/_client/operations/_operations.py,sha256=N_96-hfw6dYL3xfOI1mrYiXWAbWhNBNsV8EFpHtjW4U,81928
|
|
24
24
|
azure/quantum/_client/operations/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
25
|
-
azure/quantum/argument_types/__init__.py,sha256=
|
|
25
|
+
azure/quantum/argument_types/__init__.py,sha256=AEDyuUMipR2za248GrRzqxfzr0Ysd8tj2F0OQBSFKWg,255
|
|
26
26
|
azure/quantum/argument_types/types.py,sha256=2mM8s37DKgNfSsjzwmg4dnmj9roSeHY1ZT5vKnpjAYM,1041
|
|
27
27
|
azure/quantum/chemistry/__init__.py,sha256=IWy-J-agQviD6GN5Px9c3X6MgMO_QhUKon5ZvQWEHJM,351
|
|
28
28
|
azure/quantum/cirq/__init__.py,sha256=AJT_qCdxfqgeiPmqmbxQgCzETCOIJyHYoy6pCs-OskQ,227
|
|
29
29
|
azure/quantum/cirq/job.py,sha256=Wm52HFYel9Di6xGdzDdYfBLM3ZklaE1qOQ9YNg87eeY,3031
|
|
30
|
-
azure/quantum/cirq/service.py,sha256=
|
|
30
|
+
azure/quantum/cirq/service.py,sha256=5TcBvdULJJD_KsZna35dWYfkn7EY8Rge0ucnkwgJS3w,7833
|
|
31
31
|
azure/quantum/cirq/targets/__init__.py,sha256=cpb677Kg1V5cdI0kdgkLafI8xfwYZZYx0tc6qc024gE,574
|
|
32
|
-
azure/quantum/cirq/targets/ionq.py,sha256
|
|
33
|
-
azure/quantum/cirq/targets/quantinuum.py,sha256=
|
|
32
|
+
azure/quantum/cirq/targets/ionq.py,sha256=PIX6jGgzhfRdXOXuwGxATuiMr_Le0XNEJJ6-Itit_Ws,5998
|
|
33
|
+
azure/quantum/cirq/targets/quantinuum.py,sha256=I0uxYV90jCSq-rttSTHbv7yuruqyxI5FCMJYdhkXhOI,3939
|
|
34
34
|
azure/quantum/cirq/targets/target.py,sha256=1EEog72dFZoiOTQP7obOrCuO3VH0yjXGAIMeO6bm22o,2184
|
|
35
35
|
azure/quantum/job/__init__.py,sha256=nFuOsG25a8WzYFLwA2fhA0JMNWtblfDjV5WRgB6UQbw,829
|
|
36
36
|
azure/quantum/job/base_job.py,sha256=NwtI-dcpOfKp-ANnLAPKQVgT3t9BEv_MQSp1N47oKM0,13876
|
|
@@ -41,38 +41,32 @@ azure/quantum/job/session.py,sha256=EEJVKEEB5g0yyH963aaR0GY0Cd0axrX-49gwDWxBcfE,
|
|
|
41
41
|
azure/quantum/job/workspace_item.py,sha256=lyBIJCtUfIZMGJYJkX7Se8IDnXhXe4JU0RnqzSuhhI4,1380
|
|
42
42
|
azure/quantum/job/workspace_item_factory.py,sha256=QRWyrtgcKZqUucJOFi9V_SYMV3lj6S74tGRrPtk3NE0,1200
|
|
43
43
|
azure/quantum/qiskit/__init__.py,sha256=gjKsmRwtVNcbbsuOvy2wT0ASELh5NXGmuwaEwjZcVQo,314
|
|
44
|
-
azure/quantum/qiskit/job.py,sha256=
|
|
44
|
+
azure/quantum/qiskit/job.py,sha256=El1wyQ98WZaR96IICkDV8kToRtcA7yG24L2eE9Wdx2c,14539
|
|
45
45
|
azure/quantum/qiskit/provider.py,sha256=kbZJgDX-hI-AD5rQfik4JHNnNd74oyfrKYauosqBRxw,10966
|
|
46
|
-
azure/quantum/qiskit/backends/__init__.py,sha256=
|
|
47
|
-
azure/quantum/qiskit/backends/backend.py,sha256=
|
|
48
|
-
azure/quantum/qiskit/backends/ionq.py,sha256=
|
|
49
|
-
azure/quantum/qiskit/backends/microsoft.py,sha256=okn5J1Ddcmg2_8pSjrn1uykp6p7tLw1sQCkoeo0HTXw,5540
|
|
46
|
+
azure/quantum/qiskit/backends/__init__.py,sha256=Ygx3GwVHbIJ9Bi-_KqVQsL7B3QfeL-qUKIMIEfuStGw,994
|
|
47
|
+
azure/quantum/qiskit/backends/backend.py,sha256=pE5FSsLRy6JpfCGDWd7SFcnH8k8qz6-eJRwZ31fh58o,23361
|
|
48
|
+
azure/quantum/qiskit/backends/ionq.py,sha256=YivsJSuLBWmOxpK1qk4aEr1eJvQkWHTG4y8Ak6t-QN8,13781
|
|
50
49
|
azure/quantum/qiskit/backends/qci.py,sha256=c0YK-znG8TSAnFmeszo7mpKhM624QHszTQoapOqOvHg,4794
|
|
51
|
-
azure/quantum/qiskit/backends/quantinuum.py,sha256=
|
|
50
|
+
azure/quantum/qiskit/backends/quantinuum.py,sha256=VjNoBzdmhRizcW7cHzFQWTEvpiftbJtg1FzNCQatuvk,12513
|
|
52
51
|
azure/quantum/qiskit/backends/rigetti.py,sha256=lTsa0UjPdsAZUvvfnBge7H22TvA7c-_3fU09ZTA4ARs,4146
|
|
53
|
-
azure/quantum/qiskit/results/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
|
-
azure/quantum/qiskit/results/resource_estimator.py,sha256=pAP5ZpVxdzNekQ_qXfSdSKYWWuqL_Vq7WK6pWU4wbEQ,814
|
|
55
52
|
azure/quantum/target/__init__.py,sha256=F0nIEJdlbczmxAdtvPDWf8J1Y33_XjPzloliHeWpJos,689
|
|
56
|
-
azure/quantum/target/ionq.py,sha256=
|
|
53
|
+
azure/quantum/target/ionq.py,sha256=2iS4H-fBJYRTCM7VJse3Hqya_y2iEuU5QBG3Oj4c-SU,3931
|
|
57
54
|
azure/quantum/target/params.py,sha256=oI-35HUEMCskNjpxCJU3tjL664K-TxqAg5LA5xU0nso,9130
|
|
58
|
-
azure/quantum/target/quantinuum.py,sha256=
|
|
59
|
-
azure/quantum/target/target.py,sha256=
|
|
55
|
+
azure/quantum/target/quantinuum.py,sha256=a8cfthXeR2wE8ktNzgexEmoZ3EBw-VRRwFuPSLATGjI,3207
|
|
56
|
+
azure/quantum/target/target.py,sha256=Iz8GAM-4AjVnKHaI12By1G3wzT5ZUWQau8BVCFU7Vvo,16679
|
|
60
57
|
azure/quantum/target/target_factory.py,sha256=jjZ9zxWaNDkcvslKV02GSP8rtXwStJ7EmVXQSOFh_j8,5266
|
|
61
|
-
azure/quantum/target/microsoft/
|
|
62
|
-
azure/quantum/target/microsoft/job.py,sha256=GM4OA-rxFUqQzsH8V59pVc4BmBaPYvd99E26pyPwxto,1249
|
|
63
|
-
azure/quantum/target/microsoft/result.py,sha256=AntJptXKHNRdRR6oxhTlKKPOJVSU7u9fIfH2GXJqfx0,18784
|
|
64
|
-
azure/quantum/target/microsoft/target.py,sha256=prjaHSjBQe6kfFSRq8E_SdIaS0SYmu-UbtaKqTKJGfw,18700
|
|
58
|
+
azure/quantum/target/microsoft/target.py,sha256=MlEBPhXYcHPBuORSeoslFgpw31C_cwJBf-xl0F18Jc8,6226
|
|
65
59
|
azure/quantum/target/microsoft/elements/__init__.py,sha256=gVVpaN5086iuBnajtvTjSd7MLExtnsR6RDCmcgz6xpE,70
|
|
66
60
|
azure/quantum/target/microsoft/elements/dft/__init__.py,sha256=kCXOA9HT-gb23An-A0eyktlB66VoH6EwNO4gPM97l3U,224
|
|
67
|
-
azure/quantum/target/microsoft/elements/dft/job.py,sha256=
|
|
68
|
-
azure/quantum/target/microsoft/elements/dft/target.py,sha256=
|
|
61
|
+
azure/quantum/target/microsoft/elements/dft/job.py,sha256=6v7lZwXyUGrOI8J17akanMrFXrPVDhsZR3c6AFpa5So,6942
|
|
62
|
+
azure/quantum/target/microsoft/elements/dft/target.py,sha256=I1JBTqsZ_S8rDig2yIJYa6SEthVtgHmDaq5_GVk_Pv4,9018
|
|
69
63
|
azure/quantum/target/pasqal/__init__.py,sha256=qbe6oWTQTsnTYwY3xZr32z4AWaYIchx71bYlqC2rQqw,348
|
|
70
64
|
azure/quantum/target/pasqal/result.py,sha256=SUvpnrtgvCGiepmNpyifW8b4p14-SZZ1ToCC0NAdIwg,1463
|
|
71
65
|
azure/quantum/target/pasqal/target.py,sha256=K_vqavov6gvS84voRKeBx9pO8g4LrtWrlZ5-RMLWozw,5139
|
|
72
66
|
azure/quantum/target/rigetti/__init__.py,sha256=I1vyzZBYGI540pauTqJd0RSSyTShGqkEL7Yjo25_RNY,378
|
|
73
67
|
azure/quantum/target/rigetti/result.py,sha256=65mtAZxfdNrTWNjWPqgfwt2BZN6Nllo4g_bls7-Nm68,2334
|
|
74
|
-
azure/quantum/target/rigetti/target.py,sha256=
|
|
75
|
-
azure_quantum-2.
|
|
76
|
-
azure_quantum-2.
|
|
77
|
-
azure_quantum-2.
|
|
78
|
-
azure_quantum-2.
|
|
68
|
+
azure/quantum/target/rigetti/target.py,sha256=rjartYFzD5DulRDLo6Y0XeGlosBcvPiOmmzNVdtDZik,7580
|
|
69
|
+
azure_quantum-2.3.0.dist-info/METADATA,sha256=x93a5w-nEHM8bmk0D5onA5pnSH2WfERXzZx5JHmu--4,7357
|
|
70
|
+
azure_quantum-2.3.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
71
|
+
azure_quantum-2.3.0.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
|
|
72
|
+
azure_quantum-2.3.0.dist-info/RECORD,,
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Copyright (c) Microsoft Corporation.
|
|
3
|
-
# Licensed under the MIT License.
|
|
4
|
-
##
|
|
5
|
-
|
|
6
|
-
from typing import TYPE_CHECKING, Any, Dict, List, Union
|
|
7
|
-
from azure.quantum.version import __version__
|
|
8
|
-
from qiskit import QuantumCircuit
|
|
9
|
-
from abc import abstractmethod
|
|
10
|
-
from .backend import AzureQirBackend, QIR_BASIS_GATES
|
|
11
|
-
|
|
12
|
-
from qiskit.providers.models import BackendConfiguration
|
|
13
|
-
from qiskit.providers import Options, Provider
|
|
14
|
-
from qsharp import TargetProfile
|
|
15
|
-
from qsharp.interop.qiskit import ResourceEstimatorBackend
|
|
16
|
-
import pyqir as pyqir
|
|
17
|
-
|
|
18
|
-
if TYPE_CHECKING:
|
|
19
|
-
from azure.quantum.qiskit import AzureQuantumProvider
|
|
20
|
-
|
|
21
|
-
import logging
|
|
22
|
-
|
|
23
|
-
logger = logging.getLogger(__name__)
|
|
24
|
-
|
|
25
|
-
__all__ = ["MicrosoftBackend", "MicrosoftResourceEstimationBackend"]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class MicrosoftBackend(AzureQirBackend):
|
|
29
|
-
"""Base class for interfacing with a Microsoft backend in Azure Quantum"""
|
|
30
|
-
|
|
31
|
-
@abstractmethod
|
|
32
|
-
def __init__(
|
|
33
|
-
self, configuration: BackendConfiguration, provider: Provider = None, **fields
|
|
34
|
-
):
|
|
35
|
-
super().__init__(configuration, provider, **fields)
|
|
36
|
-
|
|
37
|
-
@classmethod
|
|
38
|
-
def _default_options(cls):
|
|
39
|
-
return Options(target_profile=TargetProfile.Adaptive_RI)
|
|
40
|
-
|
|
41
|
-
def _azure_config(self) -> Dict[str, str]:
|
|
42
|
-
config = super()._azure_config()
|
|
43
|
-
config.update(
|
|
44
|
-
{
|
|
45
|
-
"provider_id": "microsoft-qc",
|
|
46
|
-
"output_data_format": "microsoft.resource-estimates.v1",
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
return config
|
|
50
|
-
|
|
51
|
-
def _translate_input(
|
|
52
|
-
self,
|
|
53
|
-
circuits: Union[QuantumCircuit, List[QuantumCircuit]],
|
|
54
|
-
input_params: Dict[str, Any],
|
|
55
|
-
) -> bytes:
|
|
56
|
-
"""Translates the input values to the QIR expected by the Backend."""
|
|
57
|
-
# All the logic is in the base class, but we need to override
|
|
58
|
-
# this method to ensure that the bitcode QIR format is used for RE.
|
|
59
|
-
|
|
60
|
-
# normal translation is to QIR text format in utf-8 encoded bytes
|
|
61
|
-
ir_byte_str = super()._translate_input(circuits, input_params)
|
|
62
|
-
# decode the utf-8 encoded bytes to a string
|
|
63
|
-
ir_str = ir_byte_str.decode('utf-8')
|
|
64
|
-
# convert the QIR text format to QIR bitcode format
|
|
65
|
-
module = pyqir.Module.from_ir(pyqir.Context(), ir_str)
|
|
66
|
-
return module.bitcode
|
|
67
|
-
|
|
68
|
-
def _generate_qir(
|
|
69
|
-
self, circuits: List[QuantumCircuit], target_profile: TargetProfile, **kwargs
|
|
70
|
-
) -> pyqir.Module:
|
|
71
|
-
if len(circuits) == 0:
|
|
72
|
-
raise ValueError("No QuantumCircuits provided")
|
|
73
|
-
|
|
74
|
-
name = "circuits"
|
|
75
|
-
if isinstance(circuits, QuantumCircuit):
|
|
76
|
-
name = circuits.name
|
|
77
|
-
circuits = [circuits]
|
|
78
|
-
elif isinstance(circuits, list):
|
|
79
|
-
for value in circuits:
|
|
80
|
-
if not isinstance(value, QuantumCircuit):
|
|
81
|
-
raise ValueError(
|
|
82
|
-
"Input must be Union[QuantumCircuit, List[QuantumCircuit]]"
|
|
83
|
-
)
|
|
84
|
-
else:
|
|
85
|
-
raise ValueError(
|
|
86
|
-
"Input must be Union[QuantumCircuit, List[QuantumCircuit]]"
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
skip_transpilation = kwargs.pop("skip_transpilation", False)
|
|
90
|
-
backend = ResourceEstimatorBackend(
|
|
91
|
-
skip_transpilation=skip_transpilation, **kwargs
|
|
92
|
-
)
|
|
93
|
-
context = pyqir.Context()
|
|
94
|
-
llvm_module = pyqir.qir_module(context, name)
|
|
95
|
-
for circuit in circuits:
|
|
96
|
-
qir_str = backend.qir(circuit, target_profile=target_profile)
|
|
97
|
-
module = pyqir.Module.from_ir(context, qir_str)
|
|
98
|
-
llvm_module.link(module)
|
|
99
|
-
|
|
100
|
-
err = llvm_module.verify()
|
|
101
|
-
if err is not None:
|
|
102
|
-
raise Exception(err)
|
|
103
|
-
|
|
104
|
-
return llvm_module
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
class MicrosoftResourceEstimationBackend(MicrosoftBackend):
|
|
108
|
-
"""Backend class for interfacing with the resource estimator target"""
|
|
109
|
-
|
|
110
|
-
backend_names = ("microsoft.estimator",)
|
|
111
|
-
|
|
112
|
-
@classmethod
|
|
113
|
-
def _default_options(cls):
|
|
114
|
-
return Options(
|
|
115
|
-
target_profile=TargetProfile.Adaptive_RI,
|
|
116
|
-
errorBudget=1e-3,
|
|
117
|
-
qubitParams={"name": "qubit_gate_ns_e3"},
|
|
118
|
-
qecScheme={"name": "surface_code"}
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs):
|
|
122
|
-
"""Constructor for class to interface with the resource estimator target"""
|
|
123
|
-
default_config = BackendConfiguration.from_dict(
|
|
124
|
-
{
|
|
125
|
-
"backend_name": name,
|
|
126
|
-
"backend_version": __version__,
|
|
127
|
-
"simulator": True,
|
|
128
|
-
"local": False,
|
|
129
|
-
"coupling_map": None,
|
|
130
|
-
"description": "Resource estimator on Azure Quantum",
|
|
131
|
-
"basis_gates": QIR_BASIS_GATES,
|
|
132
|
-
"memory": False,
|
|
133
|
-
"n_qubits": 0xFFFFFFFFFFFFFFFF, # NOTE: maximum 64-bit unsigned value
|
|
134
|
-
"conditional": True,
|
|
135
|
-
"max_shots": 1,
|
|
136
|
-
"max_experiments": 1,
|
|
137
|
-
"open_pulse": False,
|
|
138
|
-
"gates": [
|
|
139
|
-
{"name": "TODO", "parameters": [], "qasm_def": "TODO"}
|
|
140
|
-
], # NOTE: copied from other backends
|
|
141
|
-
"azure": self._azure_config(),
|
|
142
|
-
"is_default": True,
|
|
143
|
-
}
|
|
144
|
-
)
|
|
145
|
-
logger.info("Initializing MicrosoftResourceEstimationBackend")
|
|
146
|
-
configuration: BackendConfiguration = kwargs.pop(
|
|
147
|
-
"configuration", default_config
|
|
148
|
-
)
|
|
149
|
-
super().__init__(configuration=configuration, provider=provider, **kwargs)
|
|
File without changes
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
##
|
|
4
|
-
# resource_estimator.py: Qiskit result for microsoft.estimator target.
|
|
5
|
-
##
|
|
6
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
# Licensed under the MIT License.
|
|
8
|
-
##
|
|
9
|
-
from azure.quantum.target.microsoft import MicrosoftEstimatorResult
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def make_estimator_result(data):
|
|
13
|
-
if not data["success"]:
|
|
14
|
-
error_data = data["error_data"]
|
|
15
|
-
message = "Cannot retrieve results as job execution failed " \
|
|
16
|
-
f"({error_data['code']}: {error_data['message']})"
|
|
17
|
-
|
|
18
|
-
raise RuntimeError(message)
|
|
19
|
-
|
|
20
|
-
results = data["results"]
|
|
21
|
-
if len(results) == 1:
|
|
22
|
-
data = results[0]['data']
|
|
23
|
-
return MicrosoftEstimatorResult(data)
|
|
24
|
-
else:
|
|
25
|
-
raise ValueError("Expected Qiskit results for RE be of length 1")
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License.
|
|
4
|
-
##
|
|
5
|
-
|
|
6
|
-
"""Defines classes for interacting with Microsoft Estimator"""
|
|
7
|
-
|
|
8
|
-
__all__ = ["ErrorBudgetPartition", "MicrosoftEstimator",
|
|
9
|
-
"MicrosoftEstimatorJob", "MicrosoftEstimatorResult",
|
|
10
|
-
"MicrosoftEstimatorParams", "QECScheme", "QubitParams"]
|
|
11
|
-
|
|
12
|
-
from .job import MicrosoftEstimatorJob
|
|
13
|
-
from .result import MicrosoftEstimatorResult
|
|
14
|
-
from .target import ErrorBudgetPartition, MicrosoftEstimator, \
|
|
15
|
-
MicrosoftEstimatorParams, QECScheme, QubitParams
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License.
|
|
4
|
-
##
|
|
5
|
-
from ... import Job
|
|
6
|
-
from ...job.base_job import DEFAULT_TIMEOUT
|
|
7
|
-
from ..._client.models import JobDetails
|
|
8
|
-
from .result import MicrosoftEstimatorResult
|
|
9
|
-
|
|
10
|
-
class MicrosoftEstimatorJob(Job):
|
|
11
|
-
"""
|
|
12
|
-
A dedicated job class for jobs from the microsoft.estimator target.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
def __init__(self, workspace, job_details: JobDetails, **kwargs):
|
|
16
|
-
super().__init__(workspace, job_details, **kwargs)
|
|
17
|
-
|
|
18
|
-
def get_results(self, timeout_secs: float = DEFAULT_TIMEOUT) -> MicrosoftEstimatorResult:
|
|
19
|
-
"""
|
|
20
|
-
Get estimation result.
|
|
21
|
-
|
|
22
|
-
:param timeout_secs: Timeout in seconds, defaults to 300 sec.
|
|
23
|
-
:type timeout_secs: float
|
|
24
|
-
:return: Estimation result
|
|
25
|
-
:rtype: MicrosoftEstimatorResult
|
|
26
|
-
"""
|
|
27
|
-
try:
|
|
28
|
-
results = super().get_results(timeout_secs)
|
|
29
|
-
return MicrosoftEstimatorResult(results)
|
|
30
|
-
except RuntimeError:
|
|
31
|
-
error_obj = self.details.error_data
|
|
32
|
-
message = "Cannot retrieve results as job execution failed " \
|
|
33
|
-
f"({error_obj.code}: {error_obj.message})"
|
|
34
|
-
raise RuntimeError(message)
|
|
35
|
-
|