Skip to content

Instantly share code, notes, and snippets.

@hariby
Last active October 5, 2023 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hariby/dbc986b8f48e9ade06c5c1413fc5938a to your computer and use it in GitHub Desktop.
Save hariby/dbc986b8f48e9ade06c5c1413fc5938a to your computer and use it in GitHub Desktop.
Tested with: `!pip install amazon-braket-sdk==1.6.4 botocore==1.20.96 awscli==1.19.96`
import boto3
region_name="us-east-1"
device_arn="arn:aws:braket:us-east-1::device/qpu/ionq/Aria-1"
braket = boto3.client('braket', region_name=region_name)
response = braket.search_quantum_tasks(filters=[{
'name': 'deviceArn',
'operator': 'EQUAL',
'values': [device_arn]
}], maxResults=25)
for task in response['quantumTasks']:
if 'state' in task['tags'] and task['tags']['state'] == 'washington':
print(task['quantumTaskArn'])
from braket.circuits import Circuit
from braket.aws import AwsDevice
bell = Circuit().h(0).cnot(0, 1)
device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1")
# device = AwsDevice("arn:aws:braket:us-east-1::device/qpu/ionq/Aria-1")
result = device.run(
bell,
shots=100,
tags={"state": "washington"}
).result()
counts = result.measurement_counts
print(counts)
@hariby
Copy link
Author

hariby commented Jul 6, 2021

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment