Skip to main content

An open source quantum circuit simulator to be run locally with the Amazon Braket SDK

Project description

Amazon Braket (SDK) Qrack Simulator

This is an Amazon Braket SDK back end for the open-source unitaryfund/qrack simulator. (PyQrack provides pure Python language bindings from C++ Qrack.) This simulator can be run locally, via either a (vendor-agnostic) OpenCL implementation or a (NVIDIA-specific) CUDA implementation. (CPU-only local simulation is also supported, when compiling and installing Qrack from source.) You can use the simulator to test quantum tasks that you construct for the Amazon Braket SDK before you submit them to the Amazon Braket service for execution.

Setting up Amazon Braket Qrack Simulator Python

Installing this package will install the Amazon Braket SDK, necessary to use the local simulator. For manual installation of the SDK, follow the instructions in the README for setup.

Checking the version of the Qrack simulator

You can check your currently installed version of amazon-braket-qrack-simulator with pip show:

pip show amazon-braket-qrack-simulator

or alternatively from within Python:

>>> from braket import qrack_simulator
>>> qrack_simulator.__version__

Usage

The quantum simulator implementation BraketQrackSimulator plugs into the LocalSimulator interface in Amazon Braket SDK, with the backend parameter as "qrack".

Executing a circuit using the default simulator

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

device = LocalSimulator(backend="qrack")

bell = Circuit().h(0).cnot(0, 1)
print(device.run(bell, shots=100).result().measurement_counts)

Documentation

BraketQrackSimulator follows a subset of the Amazon Braket SDK default simulator input and output interfaces. Detailed documentation for the default simulator, including the API reference, can be found on Read the Docs.

To generate the API Reference HTML in your local environment

First, install tox:

pip install tox

To generate the HTML, first change directories (cd) to position the cursor in the amazon-braket-qrack-simulator-python directory. Then, run the following command to generate the HTML documentation files:

tox -e docs

To view the generated documentation, open the following file in a browser: ../amazon-braket-qrack-simulator-python/build/documentation/html/index.html

Testing

If you want to contribute to the project, be sure to run unit tests and get a successful result before you submit a pull request. To run the unit tests, first install pytest, if necessary:

pip install pytest

With pytest installed, use this command in the amazon-braket-qrack-simulator-python directory:

pytest .

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amazon_braket_qrack_cpu_simulator-0.4.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file amazon_braket_qrack_cpu_simulator-0.4.0.tar.gz.

File metadata

File hashes

Hashes for amazon_braket_qrack_cpu_simulator-0.4.0.tar.gz
Algorithm Hash digest
SHA256 429e04f95158558d99a65a21167ef22997de2be8add53026758ab7d93bcbddf3
MD5 681e6211fa8b79dd5fdc6fd669800a38
BLAKE2b-256 20c06ac9ac71e836f57b54e5d0f4d03f7ac9068685715eb1031d336410b6ece5

See more details on using hashes here.

File details

Details for the file amazon_braket_qrack_cpu_simulator-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for amazon_braket_qrack_cpu_simulator-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c68960926fbc9c6e7962c36396c131a957b202c3e635f46d65796ca3d16ab5b3
MD5 49e8f8adb2ec66e86d52f3e0ddbb3bd7
BLAKE2b-256 466d19fdbf15054b8b8ddf7df8eaab745e88a2dc81adaaddc761b05eb6dc9e61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page