Skip to content

Commit

Permalink
Update README and tox.ini to allow running experiment step only
Browse files Browse the repository at this point in the history
  • Loading branch information
karlaspuldaro committed Sep 25, 2023
1 parent aa233e2 commit f4ced8e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Qiskit compilation benchmark for Quantum circuits
# Welcome to Qiskit Metriq

Execute quantum circuit compilation [benchmark task 25](https://metriq.info/Task/25) and submit performance results for each version of Qiskit to [metriq.info](https://metriq.info/), a community-driven platform for hosting quantum benchmarks.
This repository contains a collection of scripts designed to execute `Qiskit` compilation experiments on quantum circuits and upload benchmark results to [metriq.info](https://metriq.info/), a community-driven platform for hosting quantum benchmarks.

## Archictecture
At its core, `Qiskit Metriq` tracks essential metrics such as circuit depth and gate count for these experiments, automatically running jobs for every version of `Qiskit`, streamlining the process of evaluating the performance of quantum circuits compiled with `Qiskit`.

This project creates a tox environment for each qiskit-terra version, starting from v0.13.0 to [latest](https://github.com/Qiskit/qiskit/releases).
## Archictecture

The benchmark circuit compilation is batch processed, and the results are submitted to [metriq.info](https://metriq.info/).
This project creates a [tox](https://pypi.org/project/tox/) environment for each `Qiskit` version, starting from `qiskit-terra v0.13.0` to [latest](https://github.com/Qiskit/qiskit/releases). The `Qiskit` circuit compilation is batch processed, and the results are automatically submitted to [metriq.info](https://metriq.info/).

Benchmark tasks for quantum computer compilers:
- ex1_226.qasm benchmark circuit
- [Task 25](https://metriq.info/Task/25)
- [Task 26](https://metriq.info/Task/26) - Aspen architecture
- [Task 27](https://metriq.info/Task/27) - IBMQ Rochester architecture
- [ex1_226.qasm](https://github.com/CQCL/pytket/blob/2afee82a46cee18d618b7adf4b2b810a8a9da4e8/examples/benchmarking/ibmq/ex1_226.qasm) quantum circuit:
- [Metriq Task 25](https://metriq.info/Task/25) - Parent task
- [Metriq Task 26](https://metriq.info/Task/26) - Child task: specific to Aspen architecture
- [Metriq Task 27](https://metriq.info/Task/27) - Child task: specific to IBMQ Rochester architecture

## Results
## Qiskit compilation results
**Circuit depth distribution**

Compiled for the Rigetti 16Q Aspen architecture
Expand All @@ -36,13 +36,13 @@ Compiled for the IBMQ Rochester architecture
* Python 3.8+

## Run locally
### To run benchmark task using the current stable version of `qiskit-terra`:
### To run a benchmark experiment using the current stable version of `Qiskit`:
```bash
tox -e py38
tox -e qiskit-compilation
```
**Note:**
To run a specific version of `qiskit-terra`, you can manually update it in the `tox.ini` file.
Versions >=0.13,<=0.15 require numpy<1.20. You can run the tox environments `terra13`, `terra14` or `terra15` as:
```bash
tox -e py8-terra13
tox -e qiskit-compilation-terra13
```
4 changes: 2 additions & 2 deletions src/circuit_depth_and_gate_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
DATE = get_version_date("qiskit", VERSION)
METHOD = f"Qiskit {VERSION} compilation"

def run_task(qasm_id: str):
def run_experiment(qasm_id: str):
print(f"\nRunning {METHOD} for circuit {qasm_id}\n")

qasm_file_path = os.path.abspath(os.path.join( os.path.dirname( __file__ ),"..", "benchmarking",f"{qasm_id}.qasm"))
Expand Down Expand Up @@ -51,4 +51,4 @@ def run_task(qasm_id: str):
f"- Circuit depth - ave: {round(df['Circuit depth'].mean())} | stdev: {round(df['Circuit depth'].std(),3)}\n",
f"- Gate count - ave: {round(df['Gate count'].mean())} | stdev: {round(df['Gate count'].std(),3)}")

run_task("ex1_226")
run_experiment("ex1_226")
23 changes: 15 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@

[tox]
minversion = 3.8
envlist = py38,{py38}-terra{13,14,15,25}
envlist = py38, qiskit-compilation, {qiskit-compilation}-terra{13,14,15,25}

[testenv]
description = run circuit benchmark steps and submit results to metriq
deps =
terra13: qiskit-terra==0.13.0
terra14: qiskit-terra==0.14.2
terra15: qiskit-terra==0.15.2
terra25: qiskit-terra==0.25.0
terra13,terra14,terra15: numpy<1.20
terra25: qiskit==0.44.0
qiskit
requests
pyzx
Expand All @@ -22,4 +17,16 @@ passenv = METRIQ_TOKEN
commands =
pip install --upgrade https://github.com/unitaryfund/metriq-client/tarball/development
python {toxinidir}/src/run_experiment_steps.py


[testenv:qiskit-compilation]
basepython = python3.8
deps=
terra13: qiskit-terra==0.13.0
terra14: qiskit-terra==0.14.2
terra15: qiskit-terra==0.15.2
terra25: qiskit-terra==0.25.0
terra13,terra14,terra15: numpy<1.20
terra25: qiskit==0.44.0
{[testenv]deps}
commands =
python {toxinidir}/src/circuit_depth_and_gate_count.py

0 comments on commit f4ced8e

Please sign in to comment.