-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge in new shell script changes (#104)
* Move and expand test for logical equivalence Test moved to test_compile.py * Delete test_circuit_equivalence.py Test moved to test_compile.py * Remove unnecessary qubit parameterizations Remove unnecessary qubit parameterizations in `test_compiled_circuits_equivalent` and `test_compilation_retains_gateset` * add basic expectation value benchmark (#96) * add basic expectation value benchmark * move compile function to `common.py` * write data out to json * make data pipeline more functional * simplify real check * Add bug label to new bug report issues * Add feature tag to feature template issues * 97 reorg files (#98) * add basic expectation value benchmark * move compile function to `common.py` * write data out to json * make data pipeline more functional * simplify real check * Update naming convention for different benchmarks * Dry up save results into common function * Fix init import issue * Move gate_counters into scripts/common.py for simplicity * Fix notebook errors, remove old data * Remove duplicate funciton definitions * Remove duplicate lines * Add folder to docstring, call out alterntive benchmark name --------- Co-authored-by: nate stemen <nate@unitary.fund> --------- Co-authored-by: Misty-W <82074193+Misty-W@users.noreply.github.com> Co-authored-by: nate stemen <nate@unitary.fund>
- Loading branch information
1 parent
b88e071
commit 67f7b89
Showing
22 changed files
with
304 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .write_qasm import write_qasm | ||
from .scripts import qasm_files, log_performance, save_results |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
compiler,expval,absoluate_error,relative_error,ideal | ||
uncompiled,4.553649124439119e-18,1.0605990171102696e-16,0.9588328094519584,1.1061355083546608e-16 | ||
ucc,-8.890457814381136e-18,1.1950400864984722e-16,1.0803740386890337,1.1061355083546608e-16 | ||
cirq,2.0143392162608187e-15,1.9037256654253525e-15,17.21060079028726,1.1061355083546608e-16 | ||
qiskit,-2.3852447794681098e-18,1.129987956149342e-16,1.0215637664775457,1.1061355083546608e-16 | ||
pytket,-3.469446951953614e-18,1.140829977874197e-16,1.0313654785127937,1.1061355083546608e-16 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .gate_counters import count_multi_qubit_gates_cirq, count_multi_qubit_gates_pytket, count_multi_qubit_gates_qiskit | ||
from .common import count_multi_qubit_gates_cirq, count_multi_qubit_gates_pytket, count_multi_qubit_gates_qiskit | ||
from .common import log_performance, qasm_files, save_results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,16 @@ | ||
# cirq_compile.py | ||
|
||
from common import qasm_files, log_performance | ||
from cirq.transformers import optimize_for_target_gateset, CZTargetGateset | ||
from common import qasm_files, log_performance, cirq_compile, save_results | ||
from qbraid.transpiler import transpile as translate | ||
|
||
def cirq_compile(cirq_circuit): | ||
return optimize_for_target_gateset(cirq_circuit, gateset=CZTargetGateset()) | ||
|
||
results_log = [] | ||
|
||
for filename in qasm_files: | ||
with open(filename, "r") as file: | ||
print(f"Compiling {filename} with Cirq") | ||
qasm_string = file.read() | ||
native_circuit = translate(qasm_string, 'cirq') | ||
native_circuit = translate(qasm_string, "cirq") | ||
log_entry = log_performance(cirq_compile, native_circuit, "cirq") | ||
log_entry['circuit_name'] = filename.split('/')[-1].split('_N')[0] | ||
log_entry["circuit_name"] = filename.split("/")[-1].split("_N")[0] | ||
results_log.append(log_entry) | ||
|
||
# Save results | ||
import pandas as pd | ||
from datetime import datetime | ||
df = pd.DataFrame(results_log) | ||
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") | ||
df.to_csv(f"../results/cirq-results_{timestamp}.csv", index=False) | ||
save_results(results_log, "gates") |
Oops, something went wrong.