From 1b7ac25b6fa2d5ba8f9909623a860788a33611c6 Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Thu, 26 Oct 2023 11:15:55 -0700 Subject: [PATCH 01/10] Add forte-1 --- azure-quantum/azure/quantum/target/ionq.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/azure-quantum/azure/quantum/target/ionq.py b/azure-quantum/azure/quantum/target/ionq.py index 276e1030b..e9c150fb7 100644 --- a/azure-quantum/azure/quantum/target/ionq.py +++ b/azure-quantum/azure/quantum/target/ionq.py @@ -13,14 +13,16 @@ "ionq.simulator" : 0.0, "ionq.qpu" : 0.00003, "ionq.qpu.aria-1" : 0.0002205, - "ionq.qpu.aria-2" : 0.0002205 + "ionq.qpu.aria-2" : 0.0002205, + "ionq.qpu.forte-1" : 0.0002205 } COST_2QUBIT_GATE_MAP = { "ionq.simulator" : 0.0, "ionq.qpu" : 0.0003, "ionq.qpu.aria-1" : 0.00098, - "ionq.qpu.aria-2" : 0.00098 + "ionq.qpu.aria-2" : 0.00098, + "ionq.qpu.forte-1" : 0.00098 } MIN_PRICE_MAP = { @@ -28,6 +30,7 @@ "ionq.qpu" : 1.0, "ionq.qpu.aria-1" : 97.5, "ionq.qpu.aria-2" : 97.5 + "ionq.qpu.forte-1" : 97.5 } def int_to_bitstring(k: int, num_qubits: int, measured_qubit_ids: List[int]): @@ -43,7 +46,8 @@ class IonQ(Target): "ionq.qpu", "ionq.simulator", "ionq.qpu.aria-1", - "ionq.qpu.aria-2" + "ionq.qpu.aria-2", + "ionq.qpu.forte-1" ) def __init__( From aa3031717310165043310a494c37bd0b3dcdad63 Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Thu, 26 Oct 2023 11:23:01 -0700 Subject: [PATCH 02/10] add backend and tests for forte-1 --- .../azure/quantum/qiskit/backends/ionq.py | 4 ++-- azure-quantum/tests/unit/test_qiskit.py | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/azure-quantum/azure/quantum/qiskit/backends/ionq.py b/azure-quantum/azure/quantum/qiskit/backends/ionq.py index 6c74a539a..d7cf92bcd 100644 --- a/azure-quantum/azure/quantum/qiskit/backends/ionq.py +++ b/azure-quantum/azure/quantum/qiskit/backends/ionq.py @@ -128,7 +128,7 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): class IonQAriaQirBackend(IonQQirBackendBase): - backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2") + backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2", "ionq.qpu.forte-1") def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): """Base class for interfacing with an IonQ Aria QPU backend""" @@ -316,7 +316,7 @@ def _azure_config(self) -> Dict[str, str]: class IonQAriaBackend(IonQBackend): - backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2") + backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2", "ionq.qpu.forte-1") def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): """Base class for interfacing with an IonQ Aria QPU backend""" diff --git a/azure-quantum/tests/unit/test_qiskit.py b/azure-quantum/tests/unit/test_qiskit.py index 9b3b3e514..27527e197 100644 --- a/azure-quantum/tests/unit/test_qiskit.py +++ b/azure-quantum/tests/unit/test_qiskit.py @@ -590,6 +590,26 @@ def test_ionq_aria2_has_qis_gateset_target(self): provider = DummyProvider() provider.get_backend("ionq.qpu.aria-2", gateset="qis") + @pytest.mark.ionq + def test_ionq_forte1_has_default(self): + provider = DummyProvider() + provider.get_backend("ionq.qpu.forte-1") + + @pytest.mark.ionq + def test_ionq_forte1_has_qir_target(self): + provider = DummyProvider() + provider.get_backend("ionq.qpu.forte-1", input_data_format="qir.v1") + + @pytest.mark.ionq + def test_ionq_forte1_has_native_gateset_target(self): + provider = DummyProvider() + provider.get_backend("ionq.qpu.forte-1", gateset="native") + + @pytest.mark.ionq + def test_ionq_forte1_has_qis_gateset_target(self): + provider = DummyProvider() + provider.get_backend("ionq.qpu.forte-1", gateset="qis") + # The following test is skipped until we can use a workspace # with this target available as part of the E2E tests. # @pytest.mark.ionq From ca7affe6725330a715dd41e9586ad448932c1721 Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Thu, 26 Oct 2023 13:08:52 -0700 Subject: [PATCH 03/10] Fix missing comma --- azure-quantum/azure/quantum/target/ionq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-quantum/azure/quantum/target/ionq.py b/azure-quantum/azure/quantum/target/ionq.py index e9c150fb7..bba2324eb 100644 --- a/azure-quantum/azure/quantum/target/ionq.py +++ b/azure-quantum/azure/quantum/target/ionq.py @@ -29,7 +29,7 @@ "ionq.simulator" : 0.0, "ionq.qpu" : 1.0, "ionq.qpu.aria-1" : 97.5, - "ionq.qpu.aria-2" : 97.5 + "ionq.qpu.aria-2" : 97.5, "ionq.qpu.forte-1" : 97.5 } From ef6819888f8b171cd99280ee9b008b23946f9ab8 Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Thu, 26 Oct 2023 14:24:42 -0700 Subject: [PATCH 04/10] Update qubits --- .../azure/quantum/qiskit/backends/__init__.py | 1 + .../azure/quantum/qiskit/backends/ionq.py | 35 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/azure-quantum/azure/quantum/qiskit/backends/__init__.py b/azure-quantum/azure/quantum/qiskit/backends/__init__.py index 4b6cfd6e0..bec7a61bc 100644 --- a/azure-quantum/azure/quantum/qiskit/backends/__init__.py +++ b/azure-quantum/azure/quantum/qiskit/backends/__init__.py @@ -10,6 +10,7 @@ IonQSimulatorBackend, IonQQPUQirBackend, IonQAriaQirBackend, + IonQForteBackend, IonQSimulatorQirBackend, ) diff --git a/azure-quantum/azure/quantum/qiskit/backends/ionq.py b/azure-quantum/azure/quantum/qiskit/backends/ionq.py index d7cf92bcd..954763a37 100644 --- a/azure-quantum/azure/quantum/qiskit/backends/ionq.py +++ b/azure-quantum/azure/quantum/qiskit/backends/ionq.py @@ -36,6 +36,7 @@ "IonQQPUQirBackend", "IonQQPUNativeBackend", "IonQAriaQirBackend", + "IonQForteBackend", "IonQAriaNativeBackend", ] @@ -128,7 +129,7 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): class IonQAriaQirBackend(IonQQirBackendBase): - backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2", "ionq.qpu.forte-1") + backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2") def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): """Base class for interfacing with an IonQ Aria QPU backend""" @@ -159,6 +160,38 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): super().__init__(configuration=configuration, provider=provider, **kwargs) +class IonQForteBackend(IonQQirBackendBase): + backend_names = ("ionq.qpu.forte-1") + + def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): + """Base class for interfacing with an IonQ Forte QPU backend""" + + default_config = BackendConfiguration.from_dict( + { + "backend_name": name, + "backend_version": __version__, + "simulator": False, + "local": False, + "coupling_map": None, + "description": "IonQ Forte QPU on Azure Quantum", + "basis_gates": ionq_basis_gates, + "memory": False, + "n_qubits": 35, + "conditional": False, + "max_shots": 10000, + "max_experiments": 1, + "open_pulse": False, + "gates": [{"name": "TODO", "parameters": [], "qasm_def": "TODO"}], + "azure": self._azure_config(), + } + ) + logger.info("Initializing IonQForteBackend") + configuration: BackendConfiguration = kwargs.pop( + "configuration", default_config + ) + super().__init__(configuration=configuration, provider=provider, **kwargs) + + class IonQBackend(AzureBackend): """Base class for interfacing with an IonQ backend in Azure Quantum""" From d53f7503091d97b3ebd209dc242e67369e3ea041 Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Mon, 30 Oct 2023 13:40:15 -0700 Subject: [PATCH 05/10] Update Forte code --- azure-quantum/azure/quantum/target/rigetti/target.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-quantum/azure/quantum/target/rigetti/target.py b/azure-quantum/azure/quantum/target/rigetti/target.py index 36a243987..ad6090b1c 100644 --- a/azure-quantum/azure/quantum/target/rigetti/target.py +++ b/azure-quantum/azure/quantum/target/rigetti/target.py @@ -30,6 +30,7 @@ class RigettiTarget(str, Enum): """A simulator target for Quil. See https://github.com/quil-lang/qvm for more info.""" ASPEN_M_3 = "rigetti.qpu.aspen-m-3" + ANKAA_2 = "rigetti.qpu.ankaa-2" def simulators() -> List[str]: """Returns a list of simulator targets""" @@ -41,6 +42,7 @@ def qpus() -> List[str]: """Returns a list of QPU targets""" return [ RigettiTarget.ASPEN_M_3.value, + RigettiTarget.ANKAA_2.value, ] def num_qubits(target_name) -> int: @@ -49,6 +51,8 @@ def num_qubits(target_name) -> int: return 20 elif target_name == RigettiTarget.ASPEN_M_3.value: return 80 + elif target_name == RigettiTarget.ANKAA_2.value: + return 84 else: raise ValueError(f"Unknown target {target_name}") From 405b88696f3e6c7e81ab9c3963be6a3a92d49d13 Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Mon, 30 Oct 2023 13:42:47 -0700 Subject: [PATCH 06/10] Update Forte --- .../azure/quantum/qiskit/backends/ionq.py | 59 +++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/azure-quantum/azure/quantum/qiskit/backends/ionq.py b/azure-quantum/azure/quantum/qiskit/backends/ionq.py index 954763a37..1224f5684 100644 --- a/azure-quantum/azure/quantum/qiskit/backends/ionq.py +++ b/azure-quantum/azure/quantum/qiskit/backends/ionq.py @@ -30,14 +30,16 @@ "IonQQPUBackend", "IonQSimulatorBackend", "IonQAriaBackend", + "IonQForteBackend", "IonQQirBackend", "IonQSimulatorQirBackend", "IonQSimulatorNativeBackend", "IonQQPUQirBackend", "IonQQPUNativeBackend", "IonQAriaQirBackend", - "IonQForteBackend", + "IonQForteQirBackend", "IonQAriaNativeBackend", + "IonQForteNativeBackend", ] @@ -160,7 +162,7 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): super().__init__(configuration=configuration, provider=provider, **kwargs) -class IonQForteBackend(IonQQirBackendBase): +class IonQForteQirBackend(IonQQirBackendBase): backend_names = ("ionq.qpu.forte-1") def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): @@ -185,7 +187,7 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): "azure": self._azure_config(), } ) - logger.info("Initializing IonQForteBackend") + logger.info("Initializing IonQForteQirBackend") configuration: BackendConfiguration = kwargs.pop( "configuration", default_config ) @@ -349,7 +351,7 @@ def _azure_config(self) -> Dict[str, str]: class IonQAriaBackend(IonQBackend): - backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2", "ionq.qpu.forte-1") + backend_names = ("ionq.qpu.aria-1", "ionq.qpu.aria-2") def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): """Base class for interfacing with an IonQ Aria QPU backend""" @@ -381,6 +383,39 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): super().__init__(configuration=configuration, provider=provider, **kwargs) +class IonQForteBackend(IonQBackend): + backend_names = ("ionq.qpu.forte-1") + + def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): + """Base class for interfacing with an IonQ Forte QPU backend""" + gateset = kwargs.pop("gateset", "qis") + default_config = BackendConfiguration.from_dict( + { + "backend_name": name, + "backend_version": __version__, + "simulator": False, + "local": False, + "coupling_map": None, + "description": "IonQ Aria QPU on Azure Quantum", + "basis_gates": GATESET_MAP[gateset], + "memory": False, + "n_qubits": 35, + "conditional": False, + "max_shots": 10000, + "max_experiments": 1, + "open_pulse": False, + "gates": [{"name": "TODO", "parameters": [], "qasm_def": "TODO"}], + "azure": self._azure_config(), + "gateset": gateset, + } + ) + logger.info("Initializing IonQForteBackend") + configuration: BackendConfiguration = kwargs.pop( + "configuration", default_config + ) + super().__init__(configuration=configuration, provider=provider, **kwargs) + + class IonQAriaNativeBackend(IonQAriaBackend): def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): if "gateset" not in kwargs: @@ -395,3 +430,19 @@ def _azure_config(self) -> Dict[str, str]: } ) return config + + +class IonQForteNativeBackend(IonQForteBackend): + def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): + if "gateset" not in kwargs: + kwargs["gateset"] = "native" + super().__init__(name, provider, **kwargs) + + def _azure_config(self) -> Dict[str, str]: + config = super()._azure_config() + config.update( + { + "is_default": False, + } + ) + return config From 8fe99d0430fbdfea44ec420d7288779a2658903b Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Mon, 30 Oct 2023 13:52:04 -0700 Subject: [PATCH 07/10] Fix inadvertent checkin --- azure-quantum/azure/quantum/target/rigetti/target.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/azure-quantum/azure/quantum/target/rigetti/target.py b/azure-quantum/azure/quantum/target/rigetti/target.py index ad6090b1c..36a243987 100644 --- a/azure-quantum/azure/quantum/target/rigetti/target.py +++ b/azure-quantum/azure/quantum/target/rigetti/target.py @@ -30,7 +30,6 @@ class RigettiTarget(str, Enum): """A simulator target for Quil. See https://github.com/quil-lang/qvm for more info.""" ASPEN_M_3 = "rigetti.qpu.aspen-m-3" - ANKAA_2 = "rigetti.qpu.ankaa-2" def simulators() -> List[str]: """Returns a list of simulator targets""" @@ -42,7 +41,6 @@ def qpus() -> List[str]: """Returns a list of QPU targets""" return [ RigettiTarget.ASPEN_M_3.value, - RigettiTarget.ANKAA_2.value, ] def num_qubits(target_name) -> int: @@ -51,8 +49,6 @@ def num_qubits(target_name) -> int: return 20 elif target_name == RigettiTarget.ASPEN_M_3.value: return 80 - elif target_name == RigettiTarget.ANKAA_2.value: - return 84 else: raise ValueError(f"Unknown target {target_name}") From 71ede84302ae46b188b2b5faf01b8e711cebbea2 Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Mon, 30 Oct 2023 15:31:04 -0700 Subject: [PATCH 08/10] Add to init --- azure-quantum/azure/quantum/qiskit/backends/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-quantum/azure/quantum/qiskit/backends/__init__.py b/azure-quantum/azure/quantum/qiskit/backends/__init__.py index bec7a61bc..83395c31b 100644 --- a/azure-quantum/azure/quantum/qiskit/backends/__init__.py +++ b/azure-quantum/azure/quantum/qiskit/backends/__init__.py @@ -11,6 +11,7 @@ IonQQPUQirBackend, IonQAriaQirBackend, IonQForteBackend, + IonQForteQirBackend, IonQSimulatorQirBackend, ) From eefa56bb269745b6e2e8a8c4e49edea06df46c2b Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Wed, 1 Nov 2023 03:08:23 -0700 Subject: [PATCH 09/10] Fix missing comma --- azure-quantum/azure/quantum/qiskit/backends/ionq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-quantum/azure/quantum/qiskit/backends/ionq.py b/azure-quantum/azure/quantum/qiskit/backends/ionq.py index 1224f5684..b0bd5a931 100644 --- a/azure-quantum/azure/quantum/qiskit/backends/ionq.py +++ b/azure-quantum/azure/quantum/qiskit/backends/ionq.py @@ -163,7 +163,7 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): class IonQForteQirBackend(IonQQirBackendBase): - backend_names = ("ionq.qpu.forte-1") + backend_names = ("ionq.qpu.forte-1",) def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): """Base class for interfacing with an IonQ Forte QPU backend""" @@ -384,7 +384,7 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): class IonQForteBackend(IonQBackend): - backend_names = ("ionq.qpu.forte-1") + backend_names = ("ionq.qpu.forte-1",) def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): """Base class for interfacing with an IonQ Forte QPU backend""" From 0e8269e0731246bb04000929b4eeec487fffb5da Mon Sep 17 00:00:00 2001 From: Timothy Cook Date: Wed, 1 Nov 2023 10:48:26 -0700 Subject: [PATCH 10/10] Update comment --- azure-quantum/azure/quantum/qiskit/backends/ionq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-quantum/azure/quantum/qiskit/backends/ionq.py b/azure-quantum/azure/quantum/qiskit/backends/ionq.py index b0bd5a931..80b2876b1 100644 --- a/azure-quantum/azure/quantum/qiskit/backends/ionq.py +++ b/azure-quantum/azure/quantum/qiskit/backends/ionq.py @@ -396,7 +396,7 @@ def __init__(self, name: str, provider: "AzureQuantumProvider", **kwargs): "simulator": False, "local": False, "coupling_map": None, - "description": "IonQ Aria QPU on Azure Quantum", + "description": "IonQ Forte QPU on Azure Quantum", "basis_gates": GATESET_MAP[gateset], "memory": False, "n_qubits": 35,