Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
feat: add support for AWS verbatim circuits
Browse files Browse the repository at this point in the history
  • Loading branch information
miwurster committed Feb 27, 2024
1 parent e67964e commit 16b74f4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
3 changes: 3 additions & 0 deletions planqk/qiskit/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def get_backend(self, name=None, provider: PROVIDER = None, **kwargs):
# add additional parameters to the backend init params
backend_init_params.update(**kwargs)

if backend_dto.provider == PROVIDER.AWS:
from planqk.qiskit.providers.aws.aws_backend import PlanqkAwsBackend
return PlanqkAwsBackend(**backend_init_params)
if backend_dto.provider == PROVIDER.AZURE:
from planqk.qiskit.providers.azure.ionq_backend import PlanqkAzureIonqBackend
return PlanqkAzureIonqBackend(**backend_init_params)
Expand Down
Empty file.
14 changes: 14 additions & 0 deletions planqk/qiskit/providers/aws/aws_backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from planqk.qiskit import PlanqkBackend
from planqk.qiskit.options import OptionsV2


class PlanqkAwsBackend(PlanqkBackend):

def __init__(self, **kwargs):
super().__init__(**kwargs)

@classmethod
def _default_options(cls):
return OptionsV2(
verbatim=False
)
15 changes: 7 additions & 8 deletions planqk/qiskit/providers/job_input_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from braket.circuits.circuit_helpers import validate_circuit_and_shots
from qiskit import QuantumCircuit
from qiskit.providers import Options
from qiskit_braket_provider.providers.adapter import convert_qiskit_to_braket_circuit, wrap_circuits_in_verbatim_box
from qiskit_braket_provider.providers.adapter import to_braket
from qiskit_ibm_runtime import RuntimeEncoder
from qiskit_ionq.helpers import qiskit_circ_to_ionq_circ

Expand All @@ -15,14 +15,13 @@
from planqk.qiskit.providers.qryd.qryd_converters import convert_to_wire_format, create_qoqu_input_params


def _convert_to_open_qasm_3(circuit: QuantumCircuit, **kwargs):
braket_circuit = convert_qiskit_to_braket_circuit(circuit)
shots = kwargs.get("shots", 1)
validate_circuit_and_shots(braket_circuit, shots)
def _convert_to_open_qasm_3(circuit: QuantumCircuit, options: Options):
shots = options.get("shots", 1)
inputs = options.get("inputs", {})
verbatim = options.get("verbatim", False)

if kwargs.pop("verbatim", False):
braket_circuit = wrap_circuits_in_verbatim_box([braket_circuit])
inputs = kwargs.get("inputs", {})
braket_circuit = to_braket(circuit, verbatim=verbatim)
validate_circuit_and_shots(braket_circuit, shots)

return transform_to_qasm_3_program(braket_circuit, False, inputs)

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
requests>=2.19
pydantic==1.9.2
qiskit-ibm-runtime==0.17.0
qiskit-ionq==0.4.4
qiskit-ionq==0.4.7
qiskit-ibm-provider==0.7.2
dwave-ocean-sdk==6.4.1
qiskit-braket-provider==0.0.5
qiskit-braket-provider==0.1.1
boto3==1.33.13
botocore==1.33.13
qiskit==0.44.1

0 comments on commit 16b74f4

Please sign in to comment.