Skip to content

Commit ae51aca

Browse files
jplewaGuen Prawiroatmodjo
andauthored
Update IonQBackend to handle circuit lists of size one (#201)
* Update IonQBackend to handle circuit lists of size one * Add comments to IonQBackend Co-authored-by: Guen Prawiroatmodjo <[email protected]> * Update HoneywellBackend to handle circuit lists of size one Co-authored-by: Guen Prawiroatmodjo <[email protected]>
1 parent dd8854a commit ae51aca

7 files changed

+2777
-13
lines changed

azure-quantum/azure/quantum/qiskit/backends/honeywell.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) Microsoft Corporation.
33
# Licensed under the MIT License.
44
##
5-
from typing import TYPE_CHECKING
5+
from typing import TYPE_CHECKING, Union, List
66
from azure.quantum.version import __version__
77
from azure.quantum.qiskit.job import AzureQuantumJob
88

@@ -56,14 +56,21 @@
5656

5757

5858
class HoneywellBackend(Backend):
59-
"""Base class for interfacing with an Honeywell backend in Azure Quantum"""
59+
"""Base class for interfacing with a Honeywell backend in Azure Quantum"""
6060

6161
@classmethod
6262
def _default_options(cls):
6363
return Options(count=500)
6464

65-
def run(self, circuit: QuantumCircuit, **kwargs):
66-
"""Submits the given circuit for execution on an Honeywell target."""
65+
def run(self, circuit: Union[QuantumCircuit, List[QuantumCircuit]], **kwargs):
66+
"""Submits the given circuit for execution on a Honeywell target."""
67+
# Some Qiskit features require passing lists of circuits, so unpack those here.
68+
# We currently only support single-experiment jobs.
69+
if isinstance(circuit, (list, tuple)):
70+
if len(circuit) > 1:
71+
raise NotImplementedError("Multi-experiment jobs are not supported!")
72+
circuit = circuit[0]
73+
6774
# If the circuit was created using qiskit.assemble,
6875
# disassemble into QASM here
6976
if isinstance(circuit, QasmQobj) or isinstance(circuit, Qobj):

azure-quantum/azure/quantum/qiskit/backends/ionq.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def _job_metadata(self, circuit, meas_map):
4747

4848
def run(self, circuit, **kwargs):
4949
"""Submits the given circuit to run on an IonQ target."""
50+
# Some Qiskit features require passing lists of circuits, so unpack those here.
51+
# We currently only support single-experiment jobs.
52+
if isinstance(circuit, (list, tuple)):
53+
if len(circuit) > 1:
54+
raise NotImplementedError("Multi-experiment jobs are not supported!")
55+
circuit = circuit[0]
56+
5057
# If the circuit was created using qiskit.assemble,
5158
# disassemble into QASM here
5259
if isinstance(circuit, QasmQobj) or isinstance(circuit, Qobj):

0 commit comments

Comments
 (0)