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

Add ionq.qpu.forte-1 target #514

Merged
merged 11 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 1 addition & 0 deletions azure-quantum/azure/quantum/qiskit/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
IonQSimulatorBackend,
tncc marked this conversation as resolved.
Show resolved Hide resolved
IonQQPUQirBackend,
IonQAriaQirBackend,
IonQForteBackend,
IonQSimulatorQirBackend,
)

Expand Down
84 changes: 84 additions & 0 deletions azure-quantum/azure/quantum/qiskit/backends/ionq.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@
"IonQQPUBackend",
"IonQSimulatorBackend",
"IonQAriaBackend",
"IonQForteBackend",
"IonQQirBackend",
"IonQSimulatorQirBackend",
"IonQSimulatorNativeBackend",
"IonQQPUQirBackend",
"IonQQPUNativeBackend",
"IonQAriaQirBackend",
"IonQForteQirBackend",
"IonQAriaNativeBackend",
"IonQForteNativeBackend",
]


Expand Down Expand Up @@ -159,6 +162,38 @@
super().__init__(configuration=configuration, provider=provider, **kwargs)


class IonQForteQirBackend(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"}],
tncc marked this conversation as resolved.
Show resolved Hide resolved
tncc marked this conversation as resolved.
Show resolved Hide resolved
"azure": self._azure_config(),
}
)
logger.info("Initializing IonQForteQirBackend")
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"""

Expand Down Expand Up @@ -348,6 +383,39 @@
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",
tncc marked this conversation as resolved.
Show resolved Hide resolved
"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"}],
tncc marked this conversation as resolved.
Show resolved Hide resolved
tncc marked this conversation as resolved.
Dismissed
Show resolved Hide resolved
"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:
Expand All @@ -362,3 +430,19 @@
}
)
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
12 changes: 8 additions & 4 deletions azure-quantum/azure/quantum/target/ionq.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@
"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 = {
"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
}

def int_to_bitstring(k: int, num_qubits: int, measured_qubit_ids: List[int]):
Expand All @@ -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__(
Expand Down
4 changes: 4 additions & 0 deletions azure-quantum/azure/quantum/target/rigetti/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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:
Expand All @@ -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}")

Expand Down
20 changes: 20 additions & 0 deletions azure-quantum/tests/unit/test_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading