Braket.jl

Experimental Julia implementation of the Amazon Braket SDK
Popularity
79 Stars
Updated Last
1 Year Ago
Started In
October 2022

Braket.jl

Braket.jl is not an officially supported AWS product.

This package is a Julia implementation of the Amazon Braket SDK allowing customers to access Quantum Hardware and Simulators.

This is experimental software, and support may be discontinued in the future. For a fully supported SDK, please use the Python SDK. We may change, remove, or deprecate parts of the API when making new releases. Please review the CHANGELOG for information about changes in each release.

Stable docs Latest docs CI codecov

Installation & Prerequisites

You do not need a Python installation or the Python Amazon Braket SDK installed to use this package. However, to use the Amazon Braket Local Simulators you'll need to install the sub-package PyBraket.jl, included in this repository. See its README for more information.

All necessary Julia packages will be installed for you when you run Pkg.add("Braket") or ] instantiate (if you're doing a dev install).

If you want to run tasks on Amazon Braket's managed simulators or QPUs or run managed jobs, you will need an AWS account and to have onboarded with the Amazon Braket service. Braket.jl can load your AWS credentials from your environment variables or your ~/.aws/config file thanks to the AWS.jl package.

Usage Notes

Keep in mind that the first qubit has index 0, not index 1. Some Amazon Braket Hybrid Jobs return results as pickled objects, which are currently not decompressible using Braket.jl. In such cases you may need to download and extract the results using PyBraket.jl and the Amazon Braket SDK.

Examples

Constructing a simple circuit:

using Braket

c = Circuit()
c = H(c, 0) # qubits are 0-indexed
c = CNot(c, 0, 1)
c = Probability(c)

Measuring expectation values on a QPU:

using Braket, Braket.Observables

c = Circuit()
c = H(c, 0)
c = CNot(c, 0, 1)
c = Expectation(c, Observables.X()) # measure X on all qubits

dev = AwsDevice("arn:aws:braket:::device/qpu/ionq/ionQdevice")
res = result(dev(c, shots=10))

TODO and development roadmap

As Amazon Braket expands its featureset, we welcome contributions and development from the Julia community.

What's currently implemented in pure Julia:

  • All of the Amazon Braket schemas.
  • Submitting Amazon Braket Hybrid Jobs
  • Local jobs
  • Building and submitting circuits to managed simulators and QPUs
  • Reading results from managed simulators and QPUs
  • Cancelling tasks and jobs
  • Fetching quantum task and device information from AWS
  • Searching device information and looking up availability windows
  • Noise models
  • Convenience Circuit features
  • Pretty printing of Circuits
  • Cost tracking
  • All gates and noise operations
  • Analog Hamiltonian Simulation

Features to add:

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.