Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions benchmarks/simulation_benchmarks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ description = "Benchmarks to measure impact of compiling on circuit-specific obs
[[compilers]]
id = "ucc"
[[compilers]]
id = "ucc-ddd"
[[compilers]]
id = "pytket-peep"
[[compilers]]
id = "qiskit-default"
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"qbraid>=0.9.10",
"qiskit-aer>=0.17.0",
"qiskit>=1.4.2",
"mitiq>=0.44.0",
"ucc>=0.4.3",
"pandas>=2.2.3",
"tabulate>=0.9.0",
Expand Down
1 change: 1 addition & 0 deletions src/ucc_bench/compilers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .cirq_compiler import CirqCompiler as CirqCompiler
from .pytket_compiler import PytketPeepCompiler as PytketPeepCompiler
from .ucc_compiler import UCCCompiler as UCCCompiler
from .ucc_ddd_compiler import UCCDDDCompiler as UCCDDDCompiler
from .pyqpanda3_compiler import (
PyQPanda3Compiler as PyQPanda3Compiler,
PYQPANDA3_AVAILABLE as PYQPANDA3_AVAILABLE,
Expand Down
50 changes: 50 additions & 0 deletions src/ucc_bench/compilers/ucc_ddd_compiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from .base_compiler import BaseCompiler
from qiskit import QuantumCircuit
from qiskit.providers import Backend
from typing import Optional
from qbraid import transpile as qb_transpile

from ucc import __version__ as ucc_version
from ucc import compile as ucc_compile

from ..registry import register

from mitiq import __version__ as mitiq_version
from mitiq.ddd import construct_circuits as ddd_construct_circuits
from mitiq.ddd import rules as ddd_rules


@register.compiler("ucc-ddd")
class UCCDDDCompiler(BaseCompiler[QuantumCircuit]):
"""
UCC compiler followed by Digital Dynamical Decoupling using Mitiq.
"""

@classmethod
def version(cls) -> str:
return f"UCC:{ucc_version}+mitiq:{mitiq_version}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting question this raises, as all other compilers return the single version string of that compiler. This change is reasonable, but would complicate the labels in the performance by time plots.

I believe seeing how performance changes with new software versions is the main use of this version string. For composite compilers like this, that becomes tricky to define a version order.

That being said, I'm ok to leave that an open question, but I wanted to flag.


def qasm_to_native(self, qasm: str) -> QuantumCircuit:
return qb_transpile(qasm, "qiskit")

def compile(
self, circuit: QuantumCircuit, target_device: Optional[Backend] = None
) -> QuantumCircuit:
if target_device is not None:
compiled = ucc_compile(circuit, target_backend=target_device)
else:
compiled = ucc_compile(
circuit,
target_gateset={"rx", "ry", "rz", "h", "cx"},
)

ddd_circuits = ddd_construct_circuits(
compiled,
rule=ddd_rules.xx,
num_trials=1,
)
return ddd_circuits[0]

def count_multi_qubit_gates(self, circuit: QuantumCircuit) -> int:
return circuit.num_nonlocal_gates()

Loading
Loading