Skip to main content

Quantum Software of Compilation for supporting Real Quantum device

Project description

QSteed

License Current Release Python versions Downloads

QSteed is a Quantum Software of Compilation for supporting Real Quantum device, including a quantum compiler, a quantum resource virtualization manager, and a task scheduler.

Installation

Need to install pyquafu

pip install 'pyquafu>=0.4.1'

Install from PyPI

You can install QSteed via pip:

pip install qsteed

Install from source

You can directly download the source code from GitHub or clone the repository using the following command.

git clone https://github.com/BAQIS-Quantum/QSteed.git

Change to the qsteed directory install using the following command.

pip install -r requirements.txt
python setup.py install

Example

import matplotlib.pyplot as plt
from qsteed import Transpiler
from qsteed.backends.backend import Backend
from qsteed.passes.mapping.layout.sabre_layout import SabreLayout
from qsteed.passes.model import Model
from qsteed.passes.optimization.optimization_combine import GateCombineOptimization
from qsteed.passes.optimization.one_qubit_optimization import OneQubitGateOptimization
from qsteed.passes.unroll.unroll_to_2qubit import UnrollTo2Qubit
from qsteed.passes.unroll.unroll_to_basis import UnrollToBasis
from qsteed.utils.random_circuit import RandomCircuit
from qsteed.passflow.passflow import PassFlow

# Generating random quantum circuits (needs to be a pyquafu QuantumCircuit class)
rqc = RandomCircuit(num_qubit=5, gates_number=100, gates_list=['cx', 'rx', 'rz', 'ry', 'h'])
qc = rqc.random_circuit()

# Set chip information (the number of chip qubits needs to be consistent
# with the number of quantum circuit qubits)
basis_gates = ['cx', 'rx', 'ry', 'rz', 'id', 'h']
c_list = [(2, 3, 0.982), (3, 2, 0.982), (3, 4, 0.973), (4, 3, 0.973), 
          (0, 1, 0.98), (1, 0, 0.98), (1, 2, 0.97), (2, 1, 0.97)]
backend_properties = {
    'name': 'ExampleBackend',
    'backend_type': 'superconducting',
    'qubits_num': 5,
    'coupling_list': c_list,
    'basis_gates': basis_gates,
}

# Predefined compilation passflow
passes = [
    UnrollTo2Qubit(),
    SabreLayout(heuristic='fidelity', max_iterations=3),  # heuristic='distance' or 'fidelity', 'mixture'
    UnrollToBasis(basis_gates=basis_gates),
    GateCombineOptimization(),
    OneQubitGateOptimization()
]
passflow = PassFlow(passes=passes)

backend_instance = Backend(**backend_properties)
initial_model = Model(backend=backend_instance)

compiler = Transpiler(passflow, initial_model)
compiled_circuit = compiler.transpile(qc)
compiled_circuit.plot_circuit()
plt.show()

You can also use preset compilation passflow with optimization_level 0-3: Using preset compilation passflow, see preset_passflow.py

compiler = Transpiler(initial_model=initial_model)
compiled_circuit = compiler.transpile(qc, optimization_level=3)

More Tests

See tests for more examples.

Real machine deployment

QSteed has been successfully deployed to the Quafu Quantum Cloud Computing Cluster, supporting the compilation and optimization of user tasks into quantum circuits executable by quantum processors. You can submit tasks through the Quafu Composer web interface, Pyquafu client, or QuarkStudio client.

The public version of QSteed does not yet provide features such as quantum resource management and unified software-hardware interface calls. We will gradually make these features available according to our plan. If you would like to learn more about real machine deployment, please contact us.

How to contribute

For information on how to contribute, please send an e-mail to members of developer of this project.

QSteed was developed by the quantum operating system team of the Beijing Academy of Quantum Information Sciences.

License

QSteed is released under the Apache 2.0 license. See LICENSE for more details.

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

qsteed-0.1.2.tar.gz (72.0 kB view hashes)

Uploaded Source

Built Distribution

qsteed-0.1.2-py3-none-any.whl (158.6 kB view hashes)

Uploaded Python 3

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