How-to: access AWS Braket devices¶
In order to get access to AWS Braket devices through Qiskit you need to import
AWSBraketProvider
provider.Provider gives you access to Braket backends.
[1]:
from pprint import pprint
from qiskit_braket_provider import AWSBraketProvider
[2]:
provider = AWSBraketProvider()
Exploring all backends by Braket provider¶
[3]:
backends = provider.backends()
backends
[3]:
[BraketBackend[Aria 1],
BraketBackend[Aspen-10],
BraketBackend[Aspen-11],
BraketBackend[Aspen-8],
BraketBackend[Aspen-9],
BraketBackend[Aspen-M-1],
BraketBackend[Aspen-M-2],
BraketBackend[Aspen-M-3],
BraketBackend[Harmony],
BraketBackend[Lucy],
BraketBackend[SV1],
BraketBackend[TN1],
BraketBackend[dm1]]
[4]:
for backend in backends:
pprint(
{
"name": backend.name,
"description": backend.description,
"online date": backend.online_date,
"number of qubits": backend.num_qubits,
"operations": backend.operations[:5],
"backend version": backend.version,
}
)
{'backend version': 2,
'description': 'AWS Device: IonQ Aria 1.',
'name': 'Aria 1',
'number of qubits': 25,
'online date': datetime.datetime(2023, 6, 7, 11, 12, 40, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='x', num_qubits=1, num_clbits=0, params=[]),
Instruction(name='y', num_qubits=1, num_clbits=0, params=[]),
Instruction(name='z', num_qubits=1, num_clbits=0, params=[]),
Instruction(name='rx', num_qubits=1, num_clbits=0, params=[Parameter(theta)])]}
{'backend version': 2,
'description': 'AWS Device: Rigetti Aspen-10.',
'name': 'Aspen-10',
'number of qubits': 38,
'online date': datetime.datetime(2021, 12, 15, 19, 48, 30, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='h', num_qubits=1, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Rigetti Aspen-11.',
'name': 'Aspen-11',
'number of qubits': 48,
'online date': datetime.datetime(2022, 8, 17, 21, 25, 7, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='h', num_qubits=1, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Rigetti Aspen-8.',
'name': 'Aspen-8',
'number of qubits': 38,
'online date': None,
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='h', num_qubits=1, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Rigetti Aspen-9.',
'name': 'Aspen-9',
'number of qubits': 38,
'online date': datetime.datetime(2021, 11, 18, 16, 13, 30, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='h', num_qubits=1, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Rigetti Aspen-M-1.',
'name': 'Aspen-M-1',
'number of qubits': 148,
'online date': datetime.datetime(2022, 6, 17, 20, 13, 38, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='h', num_qubits=1, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Rigetti Aspen-M-2.',
'name': 'Aspen-M-2',
'number of qubits': 148,
'online date': datetime.datetime(2023, 1, 20, 19, 31, 9, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='h', num_qubits=1, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Rigetti Aspen-M-3.',
'name': 'Aspen-M-3',
'number of qubits': 148,
'online date': datetime.datetime(2023, 6, 13, 21, 35, 32, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='h', num_qubits=1, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: IonQ Harmony.',
'name': 'Harmony',
'number of qubits': 11,
'online date': datetime.datetime(2023, 6, 8, 11, 0, 4, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='x', num_qubits=1, num_clbits=0, params=[]),
Instruction(name='y', num_qubits=1, num_clbits=0, params=[]),
Instruction(name='z', num_qubits=1, num_clbits=0, params=[]),
Instruction(name='rx', num_qubits=1, num_clbits=0, params=[Parameter(theta)])]}
{'backend version': 2,
'description': 'AWS Device: Oxford Lucy.',
'name': 'Lucy',
'number of qubits': 8,
'online date': datetime.datetime(2023, 6, 13, 21, 0, 8, tzinfo=datetime.timezone.utc),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='cy', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Amazon Braket SV1.',
'name': 'SV1',
'number of qubits': 34,
'online date': datetime.datetime(2022, 6, 22, 10, 18),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='cy', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Amazon Braket TN1.',
'name': 'TN1',
'number of qubits': 50,
'online date': datetime.datetime(2022, 6, 22, 10, 18),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='cy', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[])]}
{'backend version': 2,
'description': 'AWS Device: Amazon Braket dm1.',
'name': 'dm1',
'number of qubits': 17,
'online date': datetime.datetime(2022, 6, 22, 10, 18),
'operations': [Instruction(name='measure', num_qubits=1, num_clbits=1, params=[]),
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cp', num_qubits=2, num_clbits=0, params=[Parameter(theta)]),
Instruction(name='cy', num_qubits=2, num_clbits=0, params=[]),
Instruction(name='cz', num_qubits=2, num_clbits=0, params=[])]}
Quering for specific backend¶
[5]:
# state vector simulator
state_vector_simulator_backend = provider.get_backend("SV1")
state_vector_simulator_backend
[5]:
BraketBackend[SV1]
[6]:
# IonQ device
ionq_backend = provider.get_backend("Harmony")
ionq_backend
[6]:
BraketBackend[Harmony]
[7]:
# Rigetti device
rigetti_aspen_backend = provider.get_backend("Aspen-11")
rigetti_aspen_backend
[7]:
BraketBackend[Aspen-11]
[8]:
# OQC Lucy device
lucy_backend = provider.get_backend("Lucy")
lucy_backend
[8]:
BraketBackend[Lucy]
Query options¶
To get a full list of possible query options refer to Braket SDK get_device documentation
[9]:
online_simulators_backends = provider.backends(statuses=["ONLINE"], types=["SIMULATOR"])
online_simulators_backends
[9]:
[BraketBackend[SV1], BraketBackend[TN1], BraketBackend[dm1]]