a library for providers to access the quantum computer cloud platform 'gaqqie-sky' in gaqqie suite.
Project description
gaqqie-rainbow: a library for providers to access the quantum computer cloud platform gaqqie-sky in gaqqie suite
This is a beta version.
What is gaqqie-rainbow?
gaqqie-rainbow is a library for providers to access the quantum computer cloud platform gaqqie-sky in gaqqie suite.
For more information on gaqqie, see this.
Installation
pip install gaqqie-rainbow
How to use gaqqie-rainbow
The currently supported quantum programming language is Qiskit.
import json
from qiskit import Aer, execute
from qiskit.assembler import disassemble
from qiskit.qobj import QasmQobj
from gaqqie_rainbow import Gaqqie
from gaqqie_rainbow.rest import Result
url = "https://<api-id>.execute-api.<region>.amazonaws.com/<stage>" # rewrite to the endpoint URL of the provier API
app = Gaqqie(url)
@app.receive_job(device_name="qiskit_simulator", interval=10)
def receive_job(job):
job_id = job.id
print(f"receive_job job_id={job_id}")
# parse circuit
qobj_json = json.loads(job.instructions)
qobj = QasmQobj.from_dict(qobj_json)
circuit = disassemble(qobj)
# execute circuit
backend = Aer.get_backend("qasm_simulator")
aer_job = execute(circuit[0][0], backend)
# parse result
result = aer_job.result()
print(f"result job_id={job_id}, counts={result.get_counts()}")
result_dict = result.to_dict()
result_dict["backend_name"] = job.device_name
result_json = json.dumps(result_dict, indent=2)
# register result
job_result = Result(job_id=job_id, status="SUCCEEDED", results=result_json)
response = app.register_result(job_result)
app.join()
Sample output:
receive_job job_id=6abff77e-4fda-4880-b3a5-ea8f49ff7cf0
result job_id=6abff77e-4fda-4880-b3a5-ea8f49ff7cf0, counts={'00': 482, '11': 542}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gaqqie-rainbow-0.2.0.tar.gz
(23.5 kB
view details)
Built Distribution
File details
Details for the file gaqqie-rainbow-0.2.0.tar.gz
.
File metadata
- Download URL: gaqqie-rainbow-0.2.0.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b48cc80816a90f814a3bd17c89b256f71192ac7fa91911e09b53a4de6a856ce7 |
|
MD5 | 526af93680b1616c018b0b387dfe81a2 |
|
BLAKE2b-256 | 7a389276acbd954b8f85ef5eb87a9098991ed1f1f38cdb4486d0526b5cb30bca |
File details
Details for the file gaqqie_rainbow-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: gaqqie_rainbow-0.2.0-py3-none-any.whl
- Upload date:
- Size: 33.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29243abc8439cc4a863e938258b4f71dd462622370748b0b3a3260eb2023cc4e |
|
MD5 | 80612bd4965b25a40e654f61b5d3c7f1 |
|
BLAKE2b-256 | 5a5a3274f0b378656ac07a369020133f8a9c85318d876bb8e305a1f45415ca21 |