Skip to main content

No project description provided

Project description

Stability Client verify process License Code style: Black Python Qiskit

Quantum Serverless client

Client part of quantum serverless project. Installable python library to communicate with provisioned infrastructure.

Table of Contents

  1. Installation
  2. Usage

Installation

pip install quantum_serverless

or local installation from source

pip install -e .

Usage

from qiskit import QuantumCircuit
from qiskit.circuit.random import random_circuit
from qiskit.quantum_info import SparsePauliOp
from qiskit_ibm_runtime import Estimator

from quantum_serverless import QuantumServerless, run_qiskit_remote, get, put

# 1. let's annotate out function to convert it
# to function that can be executed remotely
# using `run_qiskit_remote` decorator
@run_qiskit_remote()
def my_function(circuit: QuantumCircuit, obs: SparsePauliOp):
	return Estimator().run([circuit], [obs]).result().values


# 2. Next let's create out serverless object to control
# where our remote function will be executed
serverless = QuantumServerless()

circuits = [random_circuit(2, 2) for _ in range(3)]

# 3. create serverless context
with serverless:
	# 4. let's put some shared objects into remote storage that will be shared among all executions
	obs_ref = put(SparsePauliOp(["ZZ"]))

    # 4. run our function and get back reference to it
    # as now our function it remote one
	function_reference = my_function(circuits[0], obs_ref)

    # 4.1 or we can run N of them in parallel (for all circuits)
	function_references = [my_function(circ, obs_ref) for circ in circuits]

	# 5. to get results back from reference
    # we need to call `get` on function reference
	print("Single execution:", get(function_reference))
	print("N parallel executions:", get(function_references))

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

quantum_serverless-0.0.7.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

quantum_serverless-0.0.7-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

Details for the file quantum_serverless-0.0.7.tar.gz.

File metadata

  • Download URL: quantum_serverless-0.0.7.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for quantum_serverless-0.0.7.tar.gz
Algorithm Hash digest
SHA256 870bb9dc4b735639794cc86a9d4e4e0db255ba42f12d3d461e7d533a8a699513
MD5 f35a540d26cefa581c1f73aeaefb2b15
BLAKE2b-256 546798ebce42c16380c7cf9b6989a985f1e6861cf988f9d72f0a5d902b588aa5

See more details on using hashes here.

File details

Details for the file quantum_serverless-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for quantum_serverless-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8bba365a400268bf8e5ddaab0c9eaf6c8cf2dc78306f1d06bc97f444e8ffcb20
MD5 cc98e9650b85fbd775dd933886315d4b
BLAKE2b-256 637295fa8a3a6fefd47dcdd2c9709a0618c8ea8a6d52ed927877a226b96093ca

See more details on using hashes here.

Supported by

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