Last active
October 5, 2023 17:16
-
-
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`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference