Skip to main content

A module for optimally combining and distributing quantum circuits

Reason this release was yanked:

Missing dependency.

Project description

Quantum Circuit Parallelizer

A Python module for optimally combining and distributing quantum circuits. See the included notebooks for examples and documentation.

Why?

Motivation for this module comes from underutilization of increasingly large quantum processors in quantum computing tasks that only require relatively few qubits at a time. The module merges several independent circuits into a smaller set of wider circuits, which it then runs on available backends in parallel. All of this happens behind the scenes, so ideally, the user can treat the module's functionality as a parallelized drop-in replacement for Qiskit's backend.run().

As an example, consider a task that involves running a four-qubit circuit several times with different parameters. If each version of the circuit was naively submitted one by one to the 54-qubit VTT Q50, 50 qubits would remain unused in each job. This is very wasteful in terms of execution time, which then translates to unnecessary operational costs.

Instead, depending on the connectivity of the four-qubit circuit, at least nine such circuits can be packed into a single host circuit that covers as many of Q50's qubits as it can. Optionally, the parallelizer can also be instructed to leave "padding qubits" between packed circuits. This reduces crosstalk between circuits at the cost of lower packing density.

For an operational overview, see this diagram.

Installation

The package is on PyPI and can be installed with pip:

pip install qc_parallelizer

Usage example

Here is a brief and basic example:

# Define or load a number of circuits.
from qiskit import QuantumCircuit
circuits = [QuantumCircuit(...), QuantumCircuit(...), ...]

# Define backends for circuit execution. These can be any Qiskit-compatible backend objects, but
# here we define two simulators that mimic IQM's 5-qubit Adonis architecture.
import iqm.qiskit_iqm as iqm
backends = [iqm.IQMFakeAdonis(), iqm.IQMFakeAdonis()]

# Parallelize and execute. This call will
#  1. determine how to combine the circuits and for which backends, and
#  2. submit jobs to the backends.
import qc_parallelizer as parallelizer
job = parallelizer.execute(circuits, backends=backends)

# Fetch and handle results. This plots the first circuit's result histogram, for example.
results = job.results()
qiskit.visualization.plot_histogram(result[0].get_counts())
# Information on the parallelization and underlying jobs is also available.
print(f"On average, {job.info.avg_circuits_per_backend} circuits were placed per backend.")
# The job object behaves just like a regular Qiskit Job object, but values are arrays.
print("Job IDs:")
for job_id in job.job_id():
    print(f" - {job_id}")

Development setup

For the following commands, a virtual environment or equivalent isolation is recommended. This can be done with Conda, for example, with

conda create --name parallelizer python=3.10 pip
conda activate parallelizer

The package can then be installed from a local copy of the directory by running

pip install -e .

from the repository root. If you additionally wish to run tests or the provided notebook(s), you can install dependencies for those with

pip install .[tests]
# and/or
pip install .[notebooks]

Testing

Running all tests is as simple as installing the required dependencies (see above) and running

pytest

from the repository root. Additionally, there is a benchmarking script in the tests/ directory.

Authors

  • Henri Ahola <firstname.lastname@vtt.fi>

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

qc_parallelizer-1.1.1.tar.gz (912.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qc_parallelizer-1.1.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file qc_parallelizer-1.1.1.tar.gz.

File metadata

  • Download URL: qc_parallelizer-1.1.1.tar.gz
  • Upload date:
  • Size: 912.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qc_parallelizer-1.1.1.tar.gz
Algorithm Hash digest
SHA256 7f9cd4fec85a4e0a7e4fe4e0307fc071d6948086b3a6c48c4423bbc1d996358e
MD5 d3f39f2f79e33aa6987cfc57cb4c6561
BLAKE2b-256 355a8e9630bc626b476618cc59651a4fd41c78c31ef9fe0d9a435c59a8222ba6

See more details on using hashes here.

Provenance

The following attestation bundles were made for qc_parallelizer-1.1.1.tar.gz:

Publisher: publish.yml on vttresearch/qc-parallelizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qc_parallelizer-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for qc_parallelizer-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cd1eb857029f3df15da7ba2e4ed77b0fc92ddb1d0719470e18840b7281adf958
MD5 3ac8c313b271c478e5d510dbe5d431a0
BLAKE2b-256 6f90129f2c80f156ae0699521d0121c62a2b3608a42979d8c24151a91d60ac0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for qc_parallelizer-1.1.1-py3-none-any.whl:

Publisher: publish.yml on vttresearch/qc-parallelizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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