Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Versions #5

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/model/response_cut_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import jsonpickle
import marshmallow as ma
from qiskit import qasm3
from qiskit import qasm3, qasm2


class CutCircuitsResponse:
Expand All @@ -41,9 +41,9 @@ def __init__(
super().__init__()
self.max_subcircuit_width = max_subcircuit_width
if format == "openqasm2":
self.subcircuits = [circ.qasm() for circ in subcircuits]
self.subcircuits = [qasm2.dumps(circ) for circ in subcircuits]
self.individual_subcircuits = [
circ.qasm() for circ in individual_subcircuits
qasm2.dumps(circ) for circ in individual_subcircuits
]
elif format == "openqasm3":
self.subcircuits = [qasm3.dumps(circ) for circ in subcircuits]
Expand Down
4 changes: 2 additions & 2 deletions app/model/response_gate_cut_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import pickle

import marshmallow as ma
from qiskit import qasm3
from qiskit import qasm3, qasm2


class GateCutCircuitsResponse:
Expand All @@ -36,7 +36,7 @@ def __init__(
super().__init__()
if format == "openqasm2":
self.individual_subcircuits = [
circ.qasm() for circ in individual_subcircuits
qasm2.dumps(circ) for circ in individual_subcircuits
]
elif format == "openqasm3":
self.individual_subcircuits = [
Expand Down
2 changes: 1 addition & 1 deletion app/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def dag_to_hypergraph(dag: DAGDependency, k=2):
e += 1
index_vector.append(len(edge_vector))
for qarg in node.qargs:
edge_vector.append(qarg.index)
edge_vector.append(qarg._index)

return kahypar.Hypergraph(n, e, index_vector, edge_vector, k)

Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Flask==2.1.2
Flask-RESTful==0.3.9
qiskit==0.43.0
qiskit==1.0.2
requests==2.28.0
urllib3==1.26.9
Werkzeug==2.1.2
Expand All @@ -9,13 +9,13 @@ black==21.8b0
click==8.0.1
marshmallow==3.13.0
coverage==5.5
circuit-knitting-toolbox==0.5.0
circuit-knitting-toolbox==0.7.1
numpy~=1.23.5
argschema~=3.0.4
jsonpickle~=3.0.0
pytest~=7.2
symengine==0.9.2
docplex>=2.23.222
cplex>=22.1.0.0
kahypar~=1.1.7
qiskit_qasm3_import~=0.3.0
qiskit_qasm3_import~=0.4.2
dill>=0.3.8
16 changes: 12 additions & 4 deletions test/test_circuit_cutting.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import codecs
import json
import os
import pickle
import sys
import unittest

from qiskit import qasm3

parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_dir)
from app import create_app
Expand Down Expand Up @@ -55,19 +59,23 @@ def test_automatic_cutting_qasm3(self):
print(response.get_json())

def test_automatic_cutting_qiskit(self):
circuit = qasm3.loads(
'OPENQASM 3;\ninclude "stdgates.inc";\nbit[4] meas;\nqubit[4] _all_qubits;\nlet q = _all_qubits[0:3];\nh q[0];\ncx q[0], q[1];\ncx q[1], q[2];\ncx q[2], q[3];\nmeas[0] = measure q[0];\nmeas[1] = measure q[1];\nmeas[2] = measure q[2];\nmeas[3] = measure q[3];\n'
)
pickle_bytes = codecs.encode(pickle.dumps(circuit), "base64").decode()
response = self.client.post(
"/cutCircuits",
data=json.dumps(
{
"max_subcircuit_width": 4,
"circuit": "gASV+CAAAAAAAACMHXFpc2tpdC5jaXJjdWl0LnF1YW50dW1jaXJjdWl0lIwOUXVhbnR1bUNpcmN1\naXSUk5QpgZR9lCiMCl9iYXNlX25hbWWUjAdjaXJjdWl0lIw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RqZwIAAEsEhpRhhpSBlHWMCV9hbmNpbGxhc5RdlIwNX2NhbGli\ncmF0aW9uc5SMC2NvbGxlY3Rpb25zlIwLZGVmYXVsdGRpY3SUk5SMCGJ1aWx0aW5zlIwEZGljdJST\nlIWUUpSMEF9wYXJhbWV0ZXJfdGFibGWUjB1xaXNraXQuY2lyY3VpdC5wYXJhbWV0ZXJ0YWJsZZSM\nDlBhcmFtZXRlclRhYmxllJOUKYGUTn2UKIwGX3RhYmxllH2UKGi5atgCAACME1BhcmFtZXRlclJl\nZmVyZW5jZXOUk5QpgZRdlChoo0sAhpRo4ksAhpRqBgEAAEsAhpRqKgEAAEsAhpRqTgEAAEsAhpRq\ncgEAAEsAhpRlYmqnAQAAauACAAApgZRdlChqnQEAAEsAhpRqygEAAEsAhpRq7gEAAEsAhpRqEgIA\nAEsAhpRqNgIAAEsAhpRlYnWMBV9rZXlzlI+UKGi5aqcBAACQjAZfbmFtZXOUj5QoaLFqowEAAJB1\nhpRiaMFOjAdfbGF5b3V0lE6MDV9nbG9iYWxfcGhhc2WUSwCMCGR1cmF0aW9ulE6MBHVuaXSUaC+M\nCV9tZXRhZGF0YZROdWIu\n",
"max_subcircuit_width": 3,
"circuit": pickle_bytes,
"method": "automatic",
"max_num_subcircuits": 2,
"max_cuts": 3,
"max_cuts": 2,
"circuit_format": "qiskit",
}
),
content_type="application/json",
)
self.assertEqual(response.status_code, 200)
self.assertEqual(200, response.status_code)
print(response.get_json())
6 changes: 3 additions & 3 deletions test/test_gate_cutting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy as np
from circuit_knitting.cutting import partition_problem, generate_cutting_experiments
from qiskit import qasm3
from qiskit import qasm3, qasm2
from qiskit.circuit.library import EfficientSU2
from qiskit.quantum_info import PauliList
from qiskit_aer.primitives import Sampler
Expand Down Expand Up @@ -36,7 +36,7 @@ def _generate_reconstruction_test(num_qubits=4, partition_labels=None, reps=2):
circuit = circuit.decompose()

params = [np.random.random() * 2 * np.pi for _ in circuit.parameters]
circuit = circuit.bind_parameters(params)
circuit = circuit.assign_parameters(params)

partitioned_problem = partition_problem(
circuit=circuit,
Expand Down Expand Up @@ -134,7 +134,7 @@ def test_reconstruction(self):
"/gate-cutting/combineResultsQuokka",
data=json.dumps(
{
"circuit": circuit.qasm(),
"circuit": qasm2.dumps(circuit),
"subcircuit_results": results,
"cuts": {
"subcircuit_labels": subcircuit_labels,
Expand Down
2 changes: 1 addition & 1 deletion test/test_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_get_partitions(self):
circuit = circuit.decompose()

params = [(np.pi * i) / 16 for i in range(len(circuit.parameters))]
circuit = circuit.bind_parameters(params)
circuit = circuit.assign_parameters(params)
partitions, partition_sizes = get_partitions(
circuit,
num_partitions=num_partitions,
Expand Down
12 changes: 6 additions & 6 deletions test/test_reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from circuit_knitting.cutting.cutqc.wire_cutting_evaluation import (
run_subcircuits,
)
from qiskit import QuantumCircuit, transpile
from qiskit import QuantumCircuit, transpile, qasm2
from qiskit.circuit.library import EfficientSU2
from qiskit.providers import JobError, JobTimeoutError
from qiskit.providers.jobstatus import JOB_FINAL_STATES
Expand Down Expand Up @@ -46,7 +46,7 @@ def generate_su2_test(num_qubits):
circuit = circuit.decompose()

params = [(np.pi * i) / 16 for i in range(len(circuit.parameters))]
circuit = circuit.bind_parameters(params)
circuit = circuit.assign_parameters(params)
cuts = cut_circuit_wires(
circuit=circuit,
method="automatic",
Expand All @@ -64,9 +64,9 @@ def generate_su2_test(num_qubits):

subcircuit_instance_probabilities = run_subcircuits(individual_subcircuits)

cuts["subcircuits"] = [sc.qasm() for sc in cuts["subcircuits"]]
cuts["subcircuits"] = [qasm2.dumps(sc) for sc in cuts["subcircuits"]]
cuts["complete_path_map"] = jsonpickle.encode(cuts["complete_path_map"], keys=True)
cuts["individual_subcircuits"] = [sc.qasm() for sc in individual_subcircuits]
cuts["individual_subcircuits"] = [qasm2.dumps(sc) for sc in individual_subcircuits]
cuts["init_meas_subcircuit_map"] = jsonpickle.encode(
init_meas_subcircuit_map, keys=True
)
Expand Down Expand Up @@ -106,7 +106,7 @@ def test_reconstruction(self):
"/combineResults",
data=json.dumps(
{
"circuit": circuit.qasm(),
"circuit": qasm2.dumps(circuit),
"subcircuit_results": subcircuit_instance_probabilities,
"cuts": cuts,
},
Expand All @@ -130,7 +130,7 @@ def test_reconstruction_quokka(self):
"/combineResultsQuokka",
data=json.dumps(
{
"circuit": circuit.qasm(),
"circuit": qasm2.dumps(circuit),
"subcircuit_results": subcircuit_instance_probabilities,
"cuts": cuts,
},
Expand Down
7 changes: 3 additions & 4 deletions test/test_reconstruction_gate_cutting.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _generate_reconstruction_test(num_qubits=4, partition_labels=None, reps=2):
circuit = circuit.decompose()

params = [np.random.random() * 2 * np.pi for _ in circuit.parameters]
circuit = circuit.bind_parameters(params)
circuit = circuit.assign_parameters(params)

observables = PauliList(["Z" * num_qubits])

Expand Down Expand Up @@ -78,10 +78,9 @@ def _generate_reconstruction_test(num_qubits=4, partition_labels=None, reps=2):
qc_meas = circuit.measure_all(inplace=False)
result_exact = sampler_exact.run(qc_meas).result()

exact_experiment = result_exact.experiments[0]
exact_distribution = counts_to_array(
exact_experiment["quasi_dists"],
exact_experiment["metadata"]["simulator_metadata"]["num_qubits"],
result_exact.quasi_dists[0],
result_exact.metadata[0]["simulator_metadata"]["num_qubits"],
)

reconstructed_counts = reconstruct_distribution(
Expand Down
Loading