quapp-pennylane 0.0.4.dev1__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.
- quapp_pennylane-0.0.4.dev1/LICENSE +8 -0
- quapp_pennylane-0.0.4.dev1/PKG-INFO +37 -0
- quapp_pennylane-0.0.4.dev1/README.md +3 -0
- quapp_pennylane-0.0.4.dev1/pyproject.toml +31 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/async_tasks/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/async_tasks/pennylane_circuit_export_task.py +21 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/component/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/component/backend/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/component/backend/pennylane_invocation.py +54 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/factory/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/factory/pennylane_device_factory.py +40 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/factory/pennylane_handler_factory.py +25 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/factory/pennylane_provider_factory.py +34 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/handler/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/handler/invocation_handler.py +27 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/device/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/device/aws_braket_device.py +92 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/device/ibm_quantum_device.py +27 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/device/pennylane_device.py +60 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/device/qapp_pennylane_device.py +200 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/provider/__init__.py +0 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/provider/aws_braket_provider.py +33 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/provider/ibm_cloud_provider.py +30 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/provider/ibm_quantum_provider.py +27 -0
- quapp_pennylane-0.0.4.dev1/qapp_pennylane/model/provider/qapp_pennylane_provider.py +27 -0
- quapp_pennylane-0.0.4.dev1/quapp_pennylane.egg-info/PKG-INFO +37 -0
- quapp_pennylane-0.0.4.dev1/quapp_pennylane.egg-info/SOURCES.txt +31 -0
- quapp_pennylane-0.0.4.dev1/quapp_pennylane.egg-info/dependency_links.txt +1 -0
- quapp_pennylane-0.0.4.dev1/quapp_pennylane.egg-info/requires.txt +12 -0
- quapp_pennylane-0.0.4.dev1/quapp_pennylane.egg-info/top_level.txt +1 -0
- quapp_pennylane-0.0.4.dev1/setup.cfg +4 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quapp-pennylane
|
|
3
|
+
Version: 0.0.4.dev1
|
|
4
|
+
Summary: Quapp pennylane library supporting Quapp Platform for Quantum Computing
|
|
5
|
+
Author-email: "CITYNOW Co. Ltd. " <corp@citynow.vn>
|
|
6
|
+
License: The MIT License (MIT)
|
|
7
|
+
Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
14
|
+
Project-URL: Homepage, https://citynow.asia/
|
|
15
|
+
Keywords: quapp,quapp-pennylane,pennylane,quantum
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: quapp-common==0.0.11.dev1
|
|
23
|
+
Requires-Dist: pennylane==0.37.0
|
|
24
|
+
Requires-Dist: matplotlib
|
|
25
|
+
Requires-Dist: PennyLane-Rigetti==0.36.0
|
|
26
|
+
Requires-Dist: PennyLane_Lightning==0.37.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: black; extra == "dev"
|
|
29
|
+
Requires-Dist: bumpver; extra == "dev"
|
|
30
|
+
Requires-Dist: isort; extra == "dev"
|
|
31
|
+
Requires-Dist: pip-tools; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# qapp-pennylane 0.0.2
|
|
36
|
+
|
|
37
|
+
Add rigetti device
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "quapp-pennylane"
|
|
7
|
+
version = "0.0.4.dev1"
|
|
8
|
+
description = "Quapp pennylane library supporting Quapp Platform for Quantum Computing"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{ name = "CITYNOW Co. Ltd. ", email = "corp@citynow.vn" }]
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
classifiers = [
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
]
|
|
17
|
+
keywords = ["quapp", "quapp-pennylane", "pennylane", "quantum"]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"quapp-common==0.0.11.dev1",
|
|
20
|
+
"pennylane==0.37.0",
|
|
21
|
+
"matplotlib",
|
|
22
|
+
"PennyLane-Rigetti==0.36.0",
|
|
23
|
+
"PennyLane_Lightning==0.37.0"
|
|
24
|
+
]
|
|
25
|
+
requires-python = ">=3.10"
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = ["black", "bumpver", "isort", "pip-tools", "pytest"]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://citynow.asia/"
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QApp Platform Project pennylane_circuit_export_task.py Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
3
|
+
"""
|
|
4
|
+
from qapp_common.async_tasks.export_circuit_task import CircuitExportTask
|
|
5
|
+
from qapp_common.config.logging_config import logger
|
|
6
|
+
import pennylane as qml
|
|
7
|
+
from io import BytesIO
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PennylaneCircuitExportTask(CircuitExportTask):
|
|
11
|
+
|
|
12
|
+
def _convert(self):
|
|
13
|
+
|
|
14
|
+
logger.debug("[Circuit export] Preparing circuit figure...")
|
|
15
|
+
circuit = self.circuit_data_holder.circuit
|
|
16
|
+
circuit_figure, _ = qml.draw_mpl(circuit)()
|
|
17
|
+
logger.debug("[Circuit export] Converting circuit figure to svg file...")
|
|
18
|
+
figure_buffer = BytesIO()
|
|
19
|
+
circuit_figure.savefig(figure_buffer, format="svg")
|
|
20
|
+
|
|
21
|
+
return figure_buffer
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QApp Platform Project pennylane_invocation.py Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from qapp_common.component.backend.invocation import Invocation
|
|
6
|
+
from qapp_common.config.logging_config import logger
|
|
7
|
+
from qapp_common.config.thread_config import circuit_exporting_pool
|
|
8
|
+
from qapp_common.data.async_task.circuit_export.backend_holder import BackendDataHolder
|
|
9
|
+
from qapp_common.data.async_task.circuit_export.circuit_holder import CircuitDataHolder
|
|
10
|
+
from qapp_common.data.request.invocation_request import InvocationRequest
|
|
11
|
+
from qapp_common.model.provider.provider import Provider
|
|
12
|
+
|
|
13
|
+
from ...async_tasks.pennylane_circuit_export_task import PennylaneCircuitExportTask
|
|
14
|
+
from ...factory.pennylane_device_factory import PennylaneDeviceFactory
|
|
15
|
+
from ...factory.pennylane_provider_factory import PennyLaneProviderFactory
|
|
16
|
+
|
|
17
|
+
from pennylane.tape import QuantumTape
|
|
18
|
+
|
|
19
|
+
class PennylaneInvocation(Invocation):
|
|
20
|
+
|
|
21
|
+
def __init__(self, request_data: InvocationRequest, **kwargs):
|
|
22
|
+
super().__init__(request_data)
|
|
23
|
+
self.num_qubits = kwargs.get('num_qubits')
|
|
24
|
+
|
|
25
|
+
def _export_circuit(self, circuit):
|
|
26
|
+
logger.info("[PennylaneInvocation] _export_circuit()")
|
|
27
|
+
|
|
28
|
+
circuit_export_task = PennylaneCircuitExportTask(
|
|
29
|
+
circuit_data_holder=CircuitDataHolder(circuit, self.circuit_export_url),
|
|
30
|
+
backend_data_holder=BackendDataHolder(
|
|
31
|
+
self.backend_information, self.authentication.user_token
|
|
32
|
+
),
|
|
33
|
+
)
|
|
34
|
+
circuit_exporting_pool.submit(circuit_export_task.do)
|
|
35
|
+
|
|
36
|
+
def _create_provider(self):
|
|
37
|
+
logger.info('[PennylaneInvocation] _create_provider()')
|
|
38
|
+
|
|
39
|
+
return PennyLaneProviderFactory.create_provider(
|
|
40
|
+
provider_type=self.backend_information.provider_tag, sdk=self.sdk,
|
|
41
|
+
authentication=self.backend_information.authentication)
|
|
42
|
+
|
|
43
|
+
def _create_device(self, provider: Provider):
|
|
44
|
+
logger.info('[PennylaneInvocation] Creating device')
|
|
45
|
+
return PennylaneDeviceFactory.create_device(provider=provider,
|
|
46
|
+
device_specification=self.backend_information.device_name,
|
|
47
|
+
authentication=self.backend_information.authentication,
|
|
48
|
+
sdk=self.sdk, num_qubits=self.num_qubits,
|
|
49
|
+
input=self.input)
|
|
50
|
+
|
|
51
|
+
def _get_qubit_amount(self, circuit):
|
|
52
|
+
with QuantumTape() as tape:
|
|
53
|
+
circuit()
|
|
54
|
+
return tape.num_wires
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QApp Platform Project
|
|
3
|
+
pennylane_device_factory.py
|
|
4
|
+
Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
"""
|
|
6
|
+
from qapp_common.config.logging_config import logger
|
|
7
|
+
from qapp_common.enum.provider_tag import ProviderTag
|
|
8
|
+
from qapp_common.enum.sdk import Sdk
|
|
9
|
+
from qapp_common.factory.device_factory import DeviceFactory
|
|
10
|
+
from qapp_common.model.provider.provider import Provider
|
|
11
|
+
|
|
12
|
+
from ..model.device.qapp_pennylane_device import QAppPennylaneDevice
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class PennylaneDeviceFactory(DeviceFactory):
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def create_device(provider: Provider, device_specification: str, authentication: dict, sdk: Sdk,
|
|
19
|
+
**kwargs):
|
|
20
|
+
logger.info("[PennylaneDeviceFactory] create_device()")
|
|
21
|
+
|
|
22
|
+
provider_type = ProviderTag.resolve(provider.get_provider_type().value)
|
|
23
|
+
|
|
24
|
+
match provider_type:
|
|
25
|
+
case ProviderTag.QUAO_QUANTUM_SIMULATOR:
|
|
26
|
+
if Sdk.PENNYLANE == sdk:
|
|
27
|
+
logger.debug('[PennylaneDeviceFactory] Creating QAppPennylaneDevice')
|
|
28
|
+
return QAppPennylaneDevice(provider, device_specification)
|
|
29
|
+
raise ValueError(f'Unsupported SDK for provider type: {provider_type}')
|
|
30
|
+
# case ProviderTag.AWS_BRAKET:
|
|
31
|
+
# logger.debug('[PennylaneDeviceFactory] Creating AwsBraketDevice')
|
|
32
|
+
# return AwsBraketDevice(provider, device_specification, kwargs['backend_name'],
|
|
33
|
+
# kwargs['num_qubits'], kwargs['s3_bucket_name'],
|
|
34
|
+
# kwargs['s3_prefix'], kwargs['inputs'])
|
|
35
|
+
# case ProviderTag.IBM_QUANTUM:
|
|
36
|
+
# return IbmQuantumDevice(provider, device_specification,
|
|
37
|
+
# api_token=authentication.get('api_token'),
|
|
38
|
+
# instance=authentication.get('instance'))
|
|
39
|
+
case _:
|
|
40
|
+
raise ValueError(f"Unsupported provider type: {provider_type}")
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QApp Platform Project pennylane_handler_factory.py Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from qapp_common.config.logging_config import logger
|
|
6
|
+
from qapp_common.factory.handler_factory import HandlerFactory
|
|
7
|
+
from qapp_common.handler.handler import Handler
|
|
8
|
+
|
|
9
|
+
from ..handler.invocation_handler import InvocationHandler
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class PennylaneHandlerFactory(HandlerFactory):
|
|
13
|
+
|
|
14
|
+
@staticmethod
|
|
15
|
+
def create_handler(event, circuit_preparation_fn, post_processing_fn) -> Handler:
|
|
16
|
+
logger.info("[PennylaneHandlerFactory] create_handler()")
|
|
17
|
+
|
|
18
|
+
request_data = event.json()
|
|
19
|
+
|
|
20
|
+
logger.debug("[PennylaneHandlerFactory] Create InvocationHandler")
|
|
21
|
+
return InvocationHandler(
|
|
22
|
+
request_data=request_data,
|
|
23
|
+
circuit_preparation_fn=circuit_preparation_fn,
|
|
24
|
+
post_processing_fn=post_processing_fn,
|
|
25
|
+
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QApp Platform Project
|
|
3
|
+
pennylane_provider_factory.py
|
|
4
|
+
Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
"""
|
|
6
|
+
from qapp_common.config.logging_config import logger
|
|
7
|
+
from qapp_common.enum.provider_tag import ProviderTag
|
|
8
|
+
from qapp_common.enum.sdk import Sdk
|
|
9
|
+
from qapp_common.factory.provider_factory import ProviderFactory
|
|
10
|
+
|
|
11
|
+
from ..model.provider.qapp_pennylane_provider import QAppPennyLaneProvider
|
|
12
|
+
|
|
13
|
+
class PennyLaneProviderFactory(ProviderFactory):
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def create_provider(provider_type: ProviderTag, sdk: Sdk, authentication: dict):
|
|
17
|
+
logger.info("[PennyLaneProviderFactory] create_provider()")
|
|
18
|
+
logger.debug(f"provider_type: {provider_type}, sdk: {sdk}, authentication: {authentication}")
|
|
19
|
+
|
|
20
|
+
match provider_type:
|
|
21
|
+
case ProviderTag.QUAO_QUANTUM_SIMULATOR:
|
|
22
|
+
if Sdk.PENNYLANE.__eq__(sdk):
|
|
23
|
+
return QAppPennyLaneProvider()
|
|
24
|
+
raise ValueError(f'Unsupported SDK for provider type: {provider_type}')
|
|
25
|
+
# case ProviderTag.IBM_CLOUD:
|
|
26
|
+
# return IbmCloudProvider(authentication.get('token'), authentication.get('crn'))
|
|
27
|
+
# case ProviderTag.IBM_QUANTUM:
|
|
28
|
+
# return IbmQuantumProvider(authentication.get('token'))
|
|
29
|
+
# case ProviderTag.AWS_BRAKET:
|
|
30
|
+
# return AwsBraketProvider(authentication.get('access_key_id'),
|
|
31
|
+
# authentication.get('secret_access_key'),
|
|
32
|
+
# authentication.get('region_name'))
|
|
33
|
+
case _:
|
|
34
|
+
raise ValueError(f'Unsupported provider type: {provider_type}')
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QApp platform Project invocation_handler.py Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
3
|
+
"""
|
|
4
|
+
from qapp_common.data.request.invocation_request import InvocationRequest
|
|
5
|
+
from qapp_common.handler.handler import Handler
|
|
6
|
+
from qapp_common.config.logging_config import logger
|
|
7
|
+
|
|
8
|
+
from ..component.backend.pennylane_invocation import PennylaneInvocation
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class InvocationHandler(Handler):
|
|
12
|
+
|
|
13
|
+
def __init__(self, request_data: dict,
|
|
14
|
+
circuit_preparation_fn,
|
|
15
|
+
post_processing_fn):
|
|
16
|
+
super().__init__(request_data, post_processing_fn)
|
|
17
|
+
self.circuit_preparation_fn = circuit_preparation_fn
|
|
18
|
+
|
|
19
|
+
def handle(self):
|
|
20
|
+
logger.info("[InvocationHandler] handle()")
|
|
21
|
+
|
|
22
|
+
invocation_request = InvocationRequest(self.request_data)
|
|
23
|
+
|
|
24
|
+
backend = PennylaneInvocation(invocation_request)
|
|
25
|
+
|
|
26
|
+
backend.submit_job(circuit_preparation_fn=self.circuit_preparation_fn,
|
|
27
|
+
post_processing_fn=self.post_processing_fn)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# """
|
|
2
|
+
# QApp Platform Project
|
|
3
|
+
# aws_braket_device.py
|
|
4
|
+
# Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
# """
|
|
6
|
+
# from dateutil.parser import parse
|
|
7
|
+
# import pennylane as qml
|
|
8
|
+
# from qapp_common.config.logging_config import logger
|
|
9
|
+
# from qapp_common.data.device.circuit_running_option import CircuitRunningOption
|
|
10
|
+
# from qapp_common.enum.status.job_status import JobStatus
|
|
11
|
+
# from qapp_common.model.device.device import Device
|
|
12
|
+
# from qapp_common.model.provider.provider import Provider
|
|
13
|
+
#
|
|
14
|
+
#
|
|
15
|
+
# class AwsBraketDevice(Device):
|
|
16
|
+
# def _create_job(self, circuit, options: CircuitRunningOption):
|
|
17
|
+
# logger.debug('[AwsBraketDevice] Creating job for circuit')
|
|
18
|
+
#
|
|
19
|
+
# device = qml.device(self.device, device_arn=self.backend.arn, aws_session=self.session,
|
|
20
|
+
# s3_destination_folder=self.s3_folder, wires=self.num_qubits,
|
|
21
|
+
# shots=options.shots)
|
|
22
|
+
# qnode = qml.QNode(circuit, device)
|
|
23
|
+
# qml.compile(qnode)(self.inputs)
|
|
24
|
+
# return device.task
|
|
25
|
+
#
|
|
26
|
+
# def _is_simulator(self) -> bool:
|
|
27
|
+
# logger.debug('[AwsBraketDevice] Checking if the device is a simulator')
|
|
28
|
+
#
|
|
29
|
+
# return 'SIMULATOR'.__eq__(self.device._device.type.value)
|
|
30
|
+
#
|
|
31
|
+
# def _produce_histogram_data(self, job_result) -> dict | None:
|
|
32
|
+
# logger.debug('[AwsBraketDevice] Producing histogram data')
|
|
33
|
+
# return dict(job_result.measurement_counts)
|
|
34
|
+
#
|
|
35
|
+
# def _get_provider_job_id(self, job) -> str:
|
|
36
|
+
# logger.debug('[AwsBraketDevice] Getting job id')
|
|
37
|
+
# return job.id
|
|
38
|
+
#
|
|
39
|
+
# def _get_job_status(self, job) -> str:
|
|
40
|
+
# logger.debug('[AwsBraketDevice] Getting job status')
|
|
41
|
+
#
|
|
42
|
+
# job_state = job.state()
|
|
43
|
+
# logger.debug('[AwsBraketDevice] Job status is: %s', job_state)
|
|
44
|
+
#
|
|
45
|
+
# if JobStatus.COMPLETED.value.__eq__(job_state):
|
|
46
|
+
# job_state = JobStatus.DONE.value
|
|
47
|
+
# return job_state
|
|
48
|
+
#
|
|
49
|
+
# def _calculate_execution_time(self, job_result) -> None:
|
|
50
|
+
# logger.debug("[AwsBraketDevice] _calculate_execution_time()")
|
|
51
|
+
#
|
|
52
|
+
# if "task_metadata" not in job_result:
|
|
53
|
+
# return
|
|
54
|
+
#
|
|
55
|
+
# task_metadata = job_result["task_metadata"]
|
|
56
|
+
#
|
|
57
|
+
# if task_metadata is None \
|
|
58
|
+
# or not bool(task_metadata) \
|
|
59
|
+
# or "createdAt" not in task_metadata \
|
|
60
|
+
# or "endedAt" not in task_metadata:
|
|
61
|
+
# return
|
|
62
|
+
#
|
|
63
|
+
# created_at = task_metadata["createdAt"]
|
|
64
|
+
# ended_at = task_metadata["endedAt"]
|
|
65
|
+
#
|
|
66
|
+
# if created_at is None or ended_at is None:
|
|
67
|
+
# return
|
|
68
|
+
#
|
|
69
|
+
# created_at = parse(created_at.replace("T", " ").replace("Z", ""))
|
|
70
|
+
# ended_at = parse(ended_at.replace("T", " ").replace("Z", ""))
|
|
71
|
+
#
|
|
72
|
+
# offset = ended_at - created_at
|
|
73
|
+
#
|
|
74
|
+
# self.execution_time = offset.total_seconds()
|
|
75
|
+
#
|
|
76
|
+
# logger.debug("[AwsBraketDevice] Execution time calculation was: {0} seconds"
|
|
77
|
+
# .format(self.execution_time))
|
|
78
|
+
#
|
|
79
|
+
#
|
|
80
|
+
# def _get_job_result(self, job):
|
|
81
|
+
# logger.debug('[AwsBraketDevice] Getting job result')
|
|
82
|
+
#
|
|
83
|
+
# return job.result()
|
|
84
|
+
#
|
|
85
|
+
# def __init__(self, provider: Provider, device_arn: str, backend_name: str, num_qubits: int,
|
|
86
|
+
# s3_bucket_name: str, s3_prefix: str, inputs):
|
|
87
|
+
#
|
|
88
|
+
# super().__init__(provider, device_arn, backend_name)
|
|
89
|
+
# self.s3_folder = (s3_bucket_name, s3_prefix)
|
|
90
|
+
# self.inputs = inputs
|
|
91
|
+
# self.num_qubits = num_qubits
|
|
92
|
+
# self.session = provider.collect_provider()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# """
|
|
2
|
+
# QApp Platform Project
|
|
3
|
+
# ibm_quantum_device.py
|
|
4
|
+
# Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
# """
|
|
6
|
+
# from qapp_common.config.logging_config import logger
|
|
7
|
+
# from qapp_common.data.device.circuit_running_option import CircuitRunningOption
|
|
8
|
+
# from qiskit import transpile
|
|
9
|
+
#
|
|
10
|
+
# from ..device.pennylane_device import PennylaneDevice
|
|
11
|
+
#
|
|
12
|
+
#
|
|
13
|
+
# class IbmQuantumDevice(PennylaneDevice):
|
|
14
|
+
# def __init__(self, provider, device_specification, api_token, instance):
|
|
15
|
+
# super().__init__(provider, device_specification, 'qiskit.remote')
|
|
16
|
+
# self.channel = 'ibm_quantum'
|
|
17
|
+
# self.instance = instance
|
|
18
|
+
# self.token = api_token
|
|
19
|
+
#
|
|
20
|
+
# def _create_job(self, circuit, options: CircuitRunningOption):
|
|
21
|
+
# logger.debug('[IbmQuantumDevice] Creating job with {0} shots'.format(options.shots))
|
|
22
|
+
# transpiled_circuit = transpile(circuit, self.device)
|
|
23
|
+
# return self.device.run(transpiled_circuit, shots=options.shots)
|
|
24
|
+
#
|
|
25
|
+
# def _is_simulator(self) -> bool:
|
|
26
|
+
# logger.debug('[IbmQuantumDevice] Is simulator')
|
|
27
|
+
# return self.device.configuration().simulator
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# """
|
|
2
|
+
# QApp Platform Project
|
|
3
|
+
# pennylane_device.py
|
|
4
|
+
# Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
# """
|
|
6
|
+
# from abc import ABC
|
|
7
|
+
#
|
|
8
|
+
# from qapp_common.config.logging_config import logger
|
|
9
|
+
# from qapp_common.model.device.device import Device
|
|
10
|
+
# from qapp_common.model.provider.provider import Provider
|
|
11
|
+
#
|
|
12
|
+
#
|
|
13
|
+
# class PennylaneDevice(Device, ABC):
|
|
14
|
+
# def _produce_histogram_data(self, job_result) -> dict | None:
|
|
15
|
+
# logger.info('[PennylaneDevice] Producing histogram data')
|
|
16
|
+
#
|
|
17
|
+
#
|
|
18
|
+
# try:
|
|
19
|
+
# histogram_data = job_result.get_counts()
|
|
20
|
+
# except Exception as pennylane_error:
|
|
21
|
+
# logger.debug("[PennylaneDevice] Can't produce histogram with error: {0}".format(
|
|
22
|
+
# str(pennylane_error)))
|
|
23
|
+
# histogram_data = None
|
|
24
|
+
#
|
|
25
|
+
# return histogram_data
|
|
26
|
+
#
|
|
27
|
+
# def _get_provider_job_id(self, job) -> str:
|
|
28
|
+
# logger.debug('[PennylaneDevice] Getting job id')
|
|
29
|
+
#
|
|
30
|
+
# return None
|
|
31
|
+
#
|
|
32
|
+
# def _get_job_status(self, job) -> str:
|
|
33
|
+
# logger.debug('[PennylaneDevice] Getting job status')
|
|
34
|
+
#
|
|
35
|
+
# return "DONE"
|
|
36
|
+
#
|
|
37
|
+
# def _get_job_result(self, job) -> dict:
|
|
38
|
+
# logger.debug('[PennylaneDevice] Getting job result')
|
|
39
|
+
# return job
|
|
40
|
+
#
|
|
41
|
+
# def _calculate_execution_time(self, job_result):
|
|
42
|
+
# logger.debug('[PennylaneDevice] Calculating execution time')
|
|
43
|
+
#
|
|
44
|
+
#
|
|
45
|
+
# # metadata = job_result.metadata
|
|
46
|
+
#
|
|
47
|
+
# # if metadata is None or not bool(metadata) or 'time_taken_execute' not in metadata:
|
|
48
|
+
# # return None
|
|
49
|
+
#
|
|
50
|
+
# # self.execution_time = metadata['time_taken_execute']
|
|
51
|
+
#
|
|
52
|
+
# # logger.debug('[PennylaneDevice] Execution time calculation was: {0} seconds'.format(
|
|
53
|
+
# # self.execution_time))
|
|
54
|
+
#
|
|
55
|
+
# return None
|
|
56
|
+
#
|
|
57
|
+
# def __init__(self, provider: Provider, device_specification: str, backend_name: str):
|
|
58
|
+
# super().__init__(provider, device_specification)
|
|
59
|
+
# self.backend = self.device
|
|
60
|
+
# self.device = backend_name
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QApp Platform Project
|
|
3
|
+
qapp_pennylane_device.py
|
|
4
|
+
Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
"""
|
|
6
|
+
import math
|
|
7
|
+
import time
|
|
8
|
+
|
|
9
|
+
import pennylane as qml
|
|
10
|
+
from pennylane.tape import QuantumTape
|
|
11
|
+
from qapp_common.config.logging_config import logger
|
|
12
|
+
from qapp_common.data.device.circuit_running_option import CircuitRunningOption
|
|
13
|
+
from qapp_common.data.response.authentication import Authentication
|
|
14
|
+
from qapp_common.data.response.project_header import ProjectHeader
|
|
15
|
+
from qapp_common.enum.invocation_step import InvocationStep
|
|
16
|
+
from qapp_common.model.device.custom_device import CustomDevice
|
|
17
|
+
from qapp_common.model.provider.provider import Provider
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class QAppPennylaneDevice(CustomDevice):
|
|
21
|
+
def __init__(self, provider: Provider, device_specification: str):
|
|
22
|
+
super().__init__(provider, device_specification)
|
|
23
|
+
logger.debug('[QAppPennylaneDevice] Initializing device specification')
|
|
24
|
+
self.device_specification = device_specification
|
|
25
|
+
|
|
26
|
+
def _create_job(self, circuit, options: CircuitRunningOption):
|
|
27
|
+
"""
|
|
28
|
+
@param circuit: circuit to run
|
|
29
|
+
@param options: options for running circuit
|
|
30
|
+
ex: options.shots: number of shots
|
|
31
|
+
|
|
32
|
+
run the circuit and return the result
|
|
33
|
+
"""
|
|
34
|
+
logger.debug(
|
|
35
|
+
'[QAppPennylaneDevice] Creating job with {0} shots'.format(
|
|
36
|
+
options.shots))
|
|
37
|
+
|
|
38
|
+
with QuantumTape() as tape:
|
|
39
|
+
circuit()
|
|
40
|
+
|
|
41
|
+
parts = self.device_specification.split('/')
|
|
42
|
+
device_name = parts[0]
|
|
43
|
+
|
|
44
|
+
"""
|
|
45
|
+
with rigetti device, device_specification includes
|
|
46
|
+
rigetti.qvm/9q-square-pyqvm, 9q-square-qvm: 9qubit
|
|
47
|
+
rigetti.qvm/Nq-pyqvm, Nq-qvm: Nqubit (32 with QApp platform)
|
|
48
|
+
"""
|
|
49
|
+
unsupported_default_qubit_autograd = qml.__version__ > '0.37.0' and device_name == 'default.qubit.autograd'
|
|
50
|
+
if not qml.plugin_devices.__contains__(device_name):
|
|
51
|
+
if unsupported_default_qubit_autograd:
|
|
52
|
+
logger.warning(
|
|
53
|
+
f'[QAppPennylaneDevice] Using default.qubit for device {device_name} in PennyLane version {qml.__version__}')
|
|
54
|
+
else:
|
|
55
|
+
logger.error(
|
|
56
|
+
f'[QAppPennylaneDevice] The device {device_name} is not supported in PennyLane version {qml.__version__}.')
|
|
57
|
+
raise ValueError(
|
|
58
|
+
f'The device {device_name} is not supported in PennyLane version {qml.__version__}. '
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
if device_name == "rigetti.qvm":
|
|
62
|
+
device_type = parts[1]
|
|
63
|
+
if parts[1] in ["9q-square-qvm", "9q-square-pyqvm"]:
|
|
64
|
+
self.device = qml.device(device_name, device=device_type,
|
|
65
|
+
shots=options.shots)
|
|
66
|
+
else:
|
|
67
|
+
self.device = qml.device(device_name, device=str(tape.num_wires) + device_type[1:],
|
|
68
|
+
shots=options.shots)
|
|
69
|
+
elif unsupported_default_qubit_autograd:
|
|
70
|
+
self.device = qml.device('default.qubit', wires=tape.wires, shots=options.shots)
|
|
71
|
+
else:
|
|
72
|
+
self.device = qml.device(device_name, wires=tape.wires, shots=options.shots)
|
|
73
|
+
|
|
74
|
+
start_time = time.time()
|
|
75
|
+
|
|
76
|
+
qnode_params = {'interface': "autograd",
|
|
77
|
+
'diff_method': "parameter-shift"} if unsupported_default_qubit_autograd else {}
|
|
78
|
+
qnode = qml.QNode(circuit, self.device, **qnode_params)
|
|
79
|
+
|
|
80
|
+
job_result = qnode()
|
|
81
|
+
end_time = time.time()
|
|
82
|
+
|
|
83
|
+
result_histogram = {}
|
|
84
|
+
|
|
85
|
+
# generate histogram
|
|
86
|
+
if qml.probs() in qnode.tape.observables:
|
|
87
|
+
histogram_index = qnode.tape.observables.index(qml.probs())
|
|
88
|
+
probs = job_result[histogram_index]
|
|
89
|
+
num_bits = math.ceil(math.log2(len(probs)))
|
|
90
|
+
for i, prob in enumerate(probs):
|
|
91
|
+
bitstring = format(i, f'0{num_bits}b')
|
|
92
|
+
result_histogram[bitstring] = int(prob * options.shots)
|
|
93
|
+
else:
|
|
94
|
+
result_histogram = None
|
|
95
|
+
|
|
96
|
+
shots = getattr(qnode.device, 'shots', options.shots)
|
|
97
|
+
|
|
98
|
+
data = {"result": job_result, "histogram": result_histogram,
|
|
99
|
+
"time_taken_execute": end_time - start_time, "shots": shots}
|
|
100
|
+
|
|
101
|
+
logger.info(data)
|
|
102
|
+
return data
|
|
103
|
+
|
|
104
|
+
def _is_simulator(self) -> bool:
|
|
105
|
+
logger.debug('[QAppPennylaneDevice] Is simulator')
|
|
106
|
+
return True
|
|
107
|
+
|
|
108
|
+
def _produce_histogram_data(self, job_result) -> dict | None:
|
|
109
|
+
logger.info('[PennylaneDevice] Producing histogram data')
|
|
110
|
+
|
|
111
|
+
histogram = job_result.get('histogram')
|
|
112
|
+
|
|
113
|
+
if histogram is None:
|
|
114
|
+
logger.debug("[PennylaneDevice] Can't produce histogram")
|
|
115
|
+
|
|
116
|
+
return job_result.get('histogram')
|
|
117
|
+
|
|
118
|
+
def _get_provider_job_id(self, job) -> str:
|
|
119
|
+
logger.debug('[PennylaneDevice] Getting job id')
|
|
120
|
+
|
|
121
|
+
# no job id in local simulator
|
|
122
|
+
return ""
|
|
123
|
+
|
|
124
|
+
def _get_job_status(self, job) -> str:
|
|
125
|
+
logger.debug('[PennylaneDevice] Getting job status')
|
|
126
|
+
|
|
127
|
+
return "DONE"
|
|
128
|
+
|
|
129
|
+
def _get_job_result(self, job) -> dict:
|
|
130
|
+
logger.debug('[PennylaneDevice] Getting job result')
|
|
131
|
+
|
|
132
|
+
return job
|
|
133
|
+
|
|
134
|
+
def _calculate_execution_time(self, job_result):
|
|
135
|
+
logger.debug('[PennylaneDevice] Calculating execution time')
|
|
136
|
+
|
|
137
|
+
self.execution_time = job_result.get('time_taken_execute')
|
|
138
|
+
|
|
139
|
+
logger.debug(
|
|
140
|
+
'[PennylaneDevice] Execution time calculation was: {0} seconds'.format(
|
|
141
|
+
self.execution_time))
|
|
142
|
+
|
|
143
|
+
def run_circuit(self,
|
|
144
|
+
circuit,
|
|
145
|
+
post_processing_fn,
|
|
146
|
+
options: CircuitRunningOption,
|
|
147
|
+
callback_dict: dict,
|
|
148
|
+
authentication: Authentication,
|
|
149
|
+
project_header: ProjectHeader):
|
|
150
|
+
"""
|
|
151
|
+
@param project_header: project header
|
|
152
|
+
@param callback_dict: callback url dictionary
|
|
153
|
+
@param options: Options for run circuit
|
|
154
|
+
@param authentication: Authentication for calling quao server
|
|
155
|
+
@param post_processing_fn: Post-processing function
|
|
156
|
+
@param circuit: Circuit was run
|
|
157
|
+
"""
|
|
158
|
+
original_job_result, job_response = self._on_execution(
|
|
159
|
+
authentication=authentication,
|
|
160
|
+
project_header=project_header,
|
|
161
|
+
execution_callback=callback_dict.get(InvocationStep.EXECUTION),
|
|
162
|
+
circuit=circuit,
|
|
163
|
+
options=options)
|
|
164
|
+
|
|
165
|
+
if original_job_result is None:
|
|
166
|
+
return
|
|
167
|
+
|
|
168
|
+
job_response = self._on_analysis(
|
|
169
|
+
job_response=job_response,
|
|
170
|
+
original_job_result=original_job_result,
|
|
171
|
+
analysis_callback=callback_dict.get(InvocationStep.ANALYSIS))
|
|
172
|
+
|
|
173
|
+
if job_response is None:
|
|
174
|
+
return
|
|
175
|
+
|
|
176
|
+
self._on_finalization(job_result=original_job_result.get('result'),
|
|
177
|
+
authentication=authentication,
|
|
178
|
+
post_processing_fn=post_processing_fn,
|
|
179
|
+
finalization_callback=callback_dict.get(
|
|
180
|
+
InvocationStep.FINALIZATION),
|
|
181
|
+
project_header=project_header)
|
|
182
|
+
|
|
183
|
+
def _get_shots(self, job_result) -> int | None:
|
|
184
|
+
"""
|
|
185
|
+
Retrieve the number of shots from the job result.
|
|
186
|
+
|
|
187
|
+
This method checks if the job result contains the 'shots' attribute
|
|
188
|
+
and returns its value. If the 'shots' attribute is not present,
|
|
189
|
+
the method returns None.
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
job_result: An object representing the result of a job, which
|
|
193
|
+
may contain the number of shots.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
int | None: The number of shots if available; otherwise, None.
|
|
197
|
+
"""
|
|
198
|
+
logger.debug('[PennylaneDevice] Calculating number of shots')
|
|
199
|
+
|
|
200
|
+
return getattr(job_result, 'shots', None)
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# """
|
|
2
|
+
# QApp Platform Project
|
|
3
|
+
# aws_braket_provider.py
|
|
4
|
+
# Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
# """
|
|
6
|
+
# import boto3
|
|
7
|
+
# from braket.aws import AwsDevice, AwsSession
|
|
8
|
+
# from qapp_common.config.logging_config import logger
|
|
9
|
+
# from qapp_common.enum.provider_tag import ProviderTag
|
|
10
|
+
# from qapp_common.model.provider.provider import Provider
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# class AwsBraketProvider(Provider):
|
|
14
|
+
# def __init__(self, access_key_id, secret_access_key, region_name):
|
|
15
|
+
# super().__init__(ProviderTag.AWS_BRAKET)
|
|
16
|
+
# self.access_key_id = access_key_id
|
|
17
|
+
# self.secret_access_key = secret_access_key
|
|
18
|
+
# self.region_name = region_name
|
|
19
|
+
|
|
20
|
+
# def get_backend(self, device_specification):
|
|
21
|
+
# logger.debug('[AwsBraketProvider] get_backend()')
|
|
22
|
+
|
|
23
|
+
# session = self.collect_provider()
|
|
24
|
+
|
|
25
|
+
# return AwsDevice(arn=device_specification, aws_session=session)
|
|
26
|
+
|
|
27
|
+
# def collect_provider(self):
|
|
28
|
+
# logger.debug('[AwsBraketProvider] collect_provider()')
|
|
29
|
+
|
|
30
|
+
# session = boto3.Session(aws_access_key_id=self.access_key_id,
|
|
31
|
+
# aws_secret_access_key=self.secret_access_key,
|
|
32
|
+
# region_name=self.region_name)
|
|
33
|
+
# return AwsSession(boto_session=session)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# """
|
|
2
|
+
# QApp Platform Project
|
|
3
|
+
# ibm_cloud_provider.py
|
|
4
|
+
# Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
# """
|
|
6
|
+
# from qapp_common.config.logging_config import logger
|
|
7
|
+
# from qapp_common.enum.provider_tag import ProviderTag
|
|
8
|
+
# from qapp_common.model.provider.provider import Provider
|
|
9
|
+
# from qiskit_ibm_runtime import QiskitRuntimeService
|
|
10
|
+
# from qiskit_ibm_runtime.accounts import ChannelType
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# class IbmCloudProvider(Provider):
|
|
14
|
+
|
|
15
|
+
# def __init__(self, api_key, crn):
|
|
16
|
+
# super().__init__(ProviderTag.IBM_CLOUD)
|
|
17
|
+
# self.api_key = api_key
|
|
18
|
+
# self.crn = crn
|
|
19
|
+
# self.channel: ChannelType = "ibm_cloud"
|
|
20
|
+
|
|
21
|
+
# def get_backend(self, device_specification: str):
|
|
22
|
+
# logger.debug('[IbmCloudProvider] Get backend')
|
|
23
|
+
|
|
24
|
+
# provider = self.collect_provider()
|
|
25
|
+
|
|
26
|
+
# return provider.get_backend(name=device_specification)
|
|
27
|
+
|
|
28
|
+
# def collect_provider(self):
|
|
29
|
+
# logger.debug('[IbmCloudProvider] Connect to provider')
|
|
30
|
+
# return QiskitRuntimeService(channel=self.channel, token=self.api_key, instance=self.crn)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# """
|
|
2
|
+
# QApp Platform Project
|
|
3
|
+
# ibm_quantum_provider.py
|
|
4
|
+
# Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
# """
|
|
6
|
+
# from qapp_common.enum.provider_tag import ProviderTag
|
|
7
|
+
# from qapp_common.model.provider.provider import Provider
|
|
8
|
+
# from qapp_common.config.logging_config import logger
|
|
9
|
+
# from qiskit_ibm_provider import IBMProvider
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# class IbmQuantumProvider(Provider):
|
|
13
|
+
# def __init__(self, api_token):
|
|
14
|
+
# super().__init__(ProviderTag.IBM_QUANTUM)
|
|
15
|
+
# self.api_token = api_token
|
|
16
|
+
|
|
17
|
+
# def get_backend(self, device_specification):
|
|
18
|
+
# logger.debug('[IbmQuantumProvider] get_backend()')
|
|
19
|
+
|
|
20
|
+
# provider = self.collect_provider()
|
|
21
|
+
|
|
22
|
+
# return provider.get_backend(device_specification)
|
|
23
|
+
|
|
24
|
+
# def collect_provider(self):
|
|
25
|
+
# logger.debug('[IbmQuantumProvider] collect_provider()')
|
|
26
|
+
|
|
27
|
+
# return IBMProvider(token=self.api_token)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QApp Platform Project
|
|
3
|
+
qapp_pennylane_provider.py
|
|
4
|
+
Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
5
|
+
"""
|
|
6
|
+
from qapp_common.config.logging_config import logger
|
|
7
|
+
from qapp_common.enum.provider_tag import ProviderTag
|
|
8
|
+
from qapp_common.model.provider.provider import Provider
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class QAppPennyLaneProvider(Provider):
|
|
12
|
+
def __init__(self, ):
|
|
13
|
+
logger.debug('[QAppPennyLaneProvider] get_backend()')
|
|
14
|
+
super().__init__(ProviderTag.QUAO_QUANTUM_SIMULATOR)
|
|
15
|
+
|
|
16
|
+
def get_backend(self, device_specification):
|
|
17
|
+
logger.debug('[QAppPennyLaneProvider] get_backend()')
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
# with pennylane, create backend later
|
|
21
|
+
return None
|
|
22
|
+
except Exception:
|
|
23
|
+
raise ValueError('[QAppPennyLaneProvider] Unsupported device')
|
|
24
|
+
|
|
25
|
+
def collect_provider(self):
|
|
26
|
+
logger.debug('[QAppPennyLaneProvider] collect_provider()')
|
|
27
|
+
return None
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quapp-pennylane
|
|
3
|
+
Version: 0.0.4.dev1
|
|
4
|
+
Summary: Quapp pennylane library supporting Quapp Platform for Quantum Computing
|
|
5
|
+
Author-email: "CITYNOW Co. Ltd. " <corp@citynow.vn>
|
|
6
|
+
License: The MIT License (MIT)
|
|
7
|
+
Copyright © CITYNOW Co. Ltd. All rights reserved.
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
14
|
+
Project-URL: Homepage, https://citynow.asia/
|
|
15
|
+
Keywords: quapp,quapp-pennylane,pennylane,quantum
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: quapp-common==0.0.11.dev1
|
|
23
|
+
Requires-Dist: pennylane==0.37.0
|
|
24
|
+
Requires-Dist: matplotlib
|
|
25
|
+
Requires-Dist: PennyLane-Rigetti==0.36.0
|
|
26
|
+
Requires-Dist: PennyLane_Lightning==0.37.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: black; extra == "dev"
|
|
29
|
+
Requires-Dist: bumpver; extra == "dev"
|
|
30
|
+
Requires-Dist: isort; extra == "dev"
|
|
31
|
+
Requires-Dist: pip-tools; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# qapp-pennylane 0.0.2
|
|
36
|
+
|
|
37
|
+
Add rigetti device
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
qapp_pennylane/__init__.py
|
|
5
|
+
qapp_pennylane/async_tasks/__init__.py
|
|
6
|
+
qapp_pennylane/async_tasks/pennylane_circuit_export_task.py
|
|
7
|
+
qapp_pennylane/component/__init__.py
|
|
8
|
+
qapp_pennylane/component/backend/__init__.py
|
|
9
|
+
qapp_pennylane/component/backend/pennylane_invocation.py
|
|
10
|
+
qapp_pennylane/factory/__init__.py
|
|
11
|
+
qapp_pennylane/factory/pennylane_device_factory.py
|
|
12
|
+
qapp_pennylane/factory/pennylane_handler_factory.py
|
|
13
|
+
qapp_pennylane/factory/pennylane_provider_factory.py
|
|
14
|
+
qapp_pennylane/handler/__init__.py
|
|
15
|
+
qapp_pennylane/handler/invocation_handler.py
|
|
16
|
+
qapp_pennylane/model/__init__.py
|
|
17
|
+
qapp_pennylane/model/device/__init__.py
|
|
18
|
+
qapp_pennylane/model/device/aws_braket_device.py
|
|
19
|
+
qapp_pennylane/model/device/ibm_quantum_device.py
|
|
20
|
+
qapp_pennylane/model/device/pennylane_device.py
|
|
21
|
+
qapp_pennylane/model/device/qapp_pennylane_device.py
|
|
22
|
+
qapp_pennylane/model/provider/__init__.py
|
|
23
|
+
qapp_pennylane/model/provider/aws_braket_provider.py
|
|
24
|
+
qapp_pennylane/model/provider/ibm_cloud_provider.py
|
|
25
|
+
qapp_pennylane/model/provider/ibm_quantum_provider.py
|
|
26
|
+
qapp_pennylane/model/provider/qapp_pennylane_provider.py
|
|
27
|
+
quapp_pennylane.egg-info/PKG-INFO
|
|
28
|
+
quapp_pennylane.egg-info/SOURCES.txt
|
|
29
|
+
quapp_pennylane.egg-info/dependency_links.txt
|
|
30
|
+
quapp_pennylane.egg-info/requires.txt
|
|
31
|
+
quapp_pennylane.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
qapp_pennylane
|