← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe

Amazon Web Services

Amazon Braket SDK starter package

SoftwareQuantum SDKLicence: Apache-2.0Version: 1.127.3.post07.9 KB

Official source: amazon-braket/amazon-braket-sdk-python

Download ZIP (free)

The Python SDK of Amazon Braket, AWS's quantum cloud service: a Bell circuit tested on the local simulator, which needs no account, and a guide to moving on to cloud hardware.

What is Amazon Braket?

Amazon Braket is a cloud service that gives you access to quantum computers from different manufacturers (trapped ion, superconducting, neutral atom) through a single API on AWS. The Braket SDK lets you write circuits in Python and send them to these devices or to AWS's managed simulators.

When to use it

Cost warning

LocalSimulator is free and needs no account. Real hardware and managed simulators need an AWS account and are charged per task and per shot. See AWS's Braket pricing page for current prices.

The example in this package

bell_yerel.py runs the Bell circuit on the local simulator with 1000 shots. Only 00 and 11 appear in the result.

Next steps

  1. Set up your AWS credentials (aws configure).
  2. Pick a device with from braket.aws import AwsDevice and send the same circuit with a small number of shots.

Installation and running

pip install amazon-braket-sdk
python bell_yerel.py

Tested with: amazon-braket-sdk 1.127.3, Python 3.12.

Official source

Links

Package contents

Licence

The example code and the guide in this package were written by the Quantum Store editors and are MIT licensed. The project it uses is subject to its own licence (Apache-2.0).


Quantum Store — https://hakanerdogan.com/en

Example code

The example shipped in the package, run and checked. Comments and printed messages are in Turkish; the code is the same in any language. Everything is in the ZIP.

bell_yerel.py

"""Amazon Braket SDK: Bell devresini yerel simülatörde çalıştır.

LocalSimulator AWS hesabı gerektirmez. Gerçek donanımda çalıştırmak için
AwsDevice ve bir AWS hesabı gerekir (ücretlidir).

Çalıştırma:
    pip install amazon-braket-sdk
    python bell_yerel.py
"""

from braket.circuits import Circuit
from braket.devices import LocalSimulator

circuit = Circuit().h(0).cnot(0, 1)
print(circuit)

result = LocalSimulator().run(circuit, shots=1000).result()
counts = dict(sorted(result.measurement_counts.items()))
print("Ölçüm sayıları:", counts)

assert set(counts) <= {"00", "11"}, counts
print("Tamam: yalnızca 00 ve 11 ölçüldü.")

← All packages

Share: X · LinkedIn