Skip to content

Instantly share code, notes, and snippets.

@SaraM92
Last active February 27, 2023 08:09
Show Gist options
  • Save SaraM92/c224f004d44d4a236caeb8a973805b1c to your computer and use it in GitHub Desktop.
Save SaraM92/c224f004d44d4a236caeb8a973805b1c to your computer and use it in GitHub Desktop.
# set up device
rigetti = AwsDevice("arn:aws:braket:us-west-1::device/qpu/rigetti/Aspen-M-2")
# create a clean circuit with no result type attached.(This is because some result types are only supported when shots=0)
bell = Circuit().h(0).cnot(0, 1)
# add the Z \otimes Z expectation value
bell.expectation(Observable.Z() @ Observable.Z(), target=[0,1])
# run circuit
rigetti_task = rigetti.run(bell, s3_folder,shots=10)
# get id and status of submitted task
rigetti_task_id = rigetti_task.id
rigetti_status = rigetti_task.state()
# print('ID of task:', rigetti_task_id)
print('Status of task:', rigetti_status)
# set up device
ionq = AwsDevice("arn:aws:braket:::device/qpu/ionq/ionQdevice")
# run circuit
ionq_task = ionq.run(bell, s3_folder, shots=10)
# get id and status of submitted task
ionq_task_id = ionq_task.id
ionq_status = ionq_task.state()
# print('ID of task:', ionq_task_id)
print('Status of task:', ionq_status)
# print status
status = ionq_task.state()
print('Status of (reconstructed) task:', status)
set up device
oqc = AwsDevice("arn:aws:braket:eu-west-2::device/qpu/oqc/Lucy")
# run circuit
oqc_task = oqc.run(bell,s3_folder, shots=10)
# get id and status of submitted task
oqc_task_id = oqc_task.id
oqc_status = oqc_task.state()
print('Status of task:', oqc_status)
#set up device
qera = AwsDevice('arn:aws:braket:us-east-1::device/qpu/quera/Aquila')
# run circuit
qera_task = qera.run(bell,s3_folder, shots=10)
# get id and status of submitted task
qera_task_id = qera_task.id
qera_status = qera_task.state()
print('Status of task:', qera_status)
# print status
status = rigetti_task.state()
print('Status of (reconstructed) task:', status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment