Skip to main content

A library for quantum circuit composition

Project description

QCRAFT AutoSchedulQ

PyPI Version Python Versions License

Description

QCRAFT AutoSchedulQ: a library that allows users to automatically schedule the execution of their own quantum circuits, improving efficiency and reducing execution times in quantum computing environments. With this library, your Qiskit or Braket quantum circuit will be modified to increase its length but also decreasing the number of shots needed to execute it, getting a new circuit that needs more qubits but less shots to get the same result as the original circuit.

Installation

You can install QCRAFT AutoSchedulQ and all its dependencies using pip:

pip install autoscheduler

You can also install from source by cloning the repository and installing from source:

git clone https://github.com/Qcraft-UEx/QCRAFT-AutoSchedulQ.git
cd autoscheduler
pip install .

Usage

Here is a basic example on how to use Autoscheduler with a Quirk URL, when using a Quirk URL, it is mandatory to include the provider ('ibm' or 'aws') as an input.

from autoscheduler import Autoscheduler

circuit = "https://algassert.com/quirk#circuit={'cols':[['H'],['•','X'],['Measure','Measure']]}"
max_qubits = 4
shots = 100
provider = 'ibm'
autoscheduler = Autoscheduler()
scheduled_circuit, shots, times = autoscheduler.schedule(circuit, max_qubits, shots, provider)
results = autoscheduler.execute(scheduled_circuit,shots,'local',times)

Here is a basic example on how to use Autoscheduler with a GitHub URL.

from autoscheduler import Autoscheduler

circuit = "https://raw.githubusercontent.com/user/repo/branch/file.py"
max_qubits = 15
shots = 1000
autoscheduler = Autoscheduler()
scheduled_circuit, shots, times = autoscheduler.schedule(circuit, max_qubits, shots)
results = autoscheduler.execute(scheduled_circuit,shots,'local',times)

Here is a basic example on how to use Autoscheduler with a Braket circuit.

from autoscheduler import Autoscheduler
from braket.circuits import Circuit

circuit = Circuit()
circuit.x(0)
circuit.cnot(0,1)

max_qubits = 8
shots = 300
autoscheduler = Autoscheduler()
scheduled_circuit, shots, times = autoscheduler.schedule(circuit, max_qubits, shots)
results = autoscheduler.execute(scheduled_circuit,shots,'local',times)

Here is a basic example on how to use Autoscheduler with a Qiskit circuit.

from autoscheduler import Autoscheduler
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit

qreg_q = QuantumRegister(2, 'q')
creg_c = ClassicalRegister(2, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)
circuit.h(qreg_q[0])
circuit.cx(qreg_q[0], qreg_q[1])
circuit.measure(qreg_q[0], creg_c[0])
circuit.measure(qreg_q[1], creg_c[1])

max_qubits = 16
shots = 500
autoscheduler = Autoscheduler()
scheduled_circuit, shots, times = autoscheduler.schedule(circuit, max_qubits, shots)
results = autoscheduler.execute(scheduled_circuit,shots,'local',times)

It it possible to use the method schedule_and_execute instead of schedule and then execute, this method needs to have the machine in which you want to execute the circuit as a mandatory input. If the execution is on a aws machine, it is needed to specify the s3 bucket too. Also, provider is only needed when using Quirk URLs.

from autoscheduler import Autoscheduler

circuit = "https://algassert.com/quirk#circuit={'cols':[['H'],['•','X'],['Measure','Measure']]}"
max_qubits = 4
shots = 100
provider = 'aws'
autoscheduler = Autoscheduler()
results = autoscheduler.schedule_and_execute(circuit, max_qubits, shots, 'ionq', provider, 'amazon-braket-s3')
from autoscheduler import Autoscheduler

circuit = "https://raw.githubusercontent.com/user/repo/branch/file.py"
max_qubits = 15
shots = 1000
autoscheduler = Autoscheduler()
results = autoscheduler.schedule_and_execute(circuit, max_qubits, shots, 'ibm_brisbane')
from autoscheduler import Autoscheduler
from braket.circuits import Circuit

circuit = Circuit()
circuit.x(0)
circuit.cnot(0,1)

max_qubits = 8
shots = 300
autoscheduler = Autoscheduler()
results = autoscheduler.schedule_and_execute(circuit, max_qubits, shots, 'ionq', s3_bucket='amazon-braket-s3')
from autoscheduler import Autoscheduler
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit

qreg_q = QuantumRegister(2, 'q')
creg_c = ClassicalRegister(2, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)
circuit.h(qreg_q[0])
circuit.cx(qreg_q[0], qreg_q[1])
circuit.measure(qreg_q[0], creg_c[0])
circuit.measure(qreg_q[1], creg_c[1])

max_qubits = 16
shots = 500
autoscheduler = Autoscheduler()
results = autoscheduler.schedule_and_execute(circuit, max_qubits, shots, 'ibm_brisbane')

Changelog

The changelog is available here

License

Autoscheduler is licensed under the MIT License

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

autoscheduler-0.1.5.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

autoscheduler-0.1.5-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file autoscheduler-0.1.5.tar.gz.

File metadata

  • Download URL: autoscheduler-0.1.5.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.5

File hashes

Hashes for autoscheduler-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f2d300bdeffd99d8e7a431a0d03818d59228d01064abfcd5c07c0f92ddf2f9a4
MD5 dcd5541aaf99ae6a09a8bc323ca76d33
BLAKE2b-256 a717075102b45341b3234301244f446a982a10f504eaff8d6dcac43a722eb54f

See more details on using hashes here.

File details

Details for the file autoscheduler-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for autoscheduler-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e3660cffd1c82b79b897eeb10556e74444911ef37beb0a30e5e1a295da5fd362
MD5 a8b8d51f65ec7f858a1ef5eec532a8f7
BLAKE2b-256 08cfa673bef4a3de6efb5c486061c413811bfea17b76908c60f88ce64f415a7a

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