AWS Quantum Technologies Blog
Introducing the Amazon Braket Algorithm Library
Research scientists and quantum algorithm developers are often new to cloud computing. Their main focus during quantum algorithm development should center on writing algorithm code; however, they often spend time setting up and maintaining interactive development environments, estimating costs to run their code on classical or quantum hardware, and stitching together common subroutines. Today, we excited to launch the Braket Algorithm Library, an open-source, GitHub repository providing researchers ready-to-use Python implementations for a set of quantum algorithms on Amazon Braket. With the Braket Algorithm Library, customers can quickly get started with developing their own code on Amazon Braket by referencing our ready-to-use examples, and run these algorithms on a variety of on-demand, managed simulators and quantum processors available on Braket.
In this blog post, we show you how to access the Braket Algorithm Library, walk through an example algorithm, and share how you can contribute to the open-source algorithm repository.
Ready to run algorithms
When experimenting with quantum computers and testing algorithms, researchers often have to spend precious time on tasks unrelated to running code and adjusting logic. Source code is often scattered throughout examples or papers and once aggregated, researchers need to ensure that the development environment contains all the necessary dependencies.
Repeating these pain points across multiple algorithms and managing them across notebooks and GitHub repositories is tedious and can slow down research. With this launch, customers now have access to Python implementations for the 11 popular quantum algorithms listed in Table 1 below. The most up-to-date list of algorithms can be viewed via the GitHub repo.
|Bernstein-Vazirani Algorithm||Deutsch-Jozsa Algorithm|
|Grover’s Search||Quantum Approximate Optimization Algorithm|
|Quantum Circuit Born Machine||Quantum Fourier Transformation|
|Quantum Phase Estimation||Quantum Walk|
|Shor’s Algorithm||Simon’s Algorithm|
|Violation of Bell’s Inequality|
Table 1: Quantum algorithm implementations based on arXiv:1804.03719.
Researchers can access these algorithms directly via GitHub or through the Amazon Braket console. Customers new to Amazon Braket should refer to our Getting Started documentation for one-time setup instructions. Customers accessing an algorithm through the console will have the ability to search though the catalog, read a high-level description of the algorithm, and directly access it via the Braket console. Each algorithm is available as ready-to-run code in a managed Jupyter notebook that can be run on its own or integrated into more complex algorithms by importing the algorithm as a pre-built method. Each example notebook walks you through the algorithm on a simulator or quantum processing unit (QPU) and tracks your costs along the way.
Getting Started: Simon’s algorithm
To see this in action, let’s look at Simon’s algorithm. Simon’s algorithm provided one of the first examples of an exponential speedup over the best-known classical algorithm by using a quantum computer to solve Simon’s problem. The following 4 steps demonstrate a researcher’s journey to leverage Simon’s algorithm.
Step 1: Log in to the Amazon Braket console
The Braket Algorithm Library is available through GitHub or through the AWS console experience. For this demonstration we ask you to log in to the Amazon Web Services (AWS) console and then navigate to the Amazon Braket console. Figure 2 shows the Braket console dashboard page.
Step 2: Explore the Algorithm Library
On the left side navigation menu, you will find the Algorithm library. Clicking on this will take you to the catalog page, seen in Figure 3, where you will see a list of quantum algorithms. Each algorithm contains a high-level description as well as a set of tags that make the algorithm easy to discover. You can scroll through the catalog or search keywords for algorithms. To view the source-code in GitHub, click the GitHub icon in the top-right of each description.
Step 3: Open a Notebook
On the top right of the algorithm library page, you will see the option to Open notebook. Clicking on this button will directly create a notebook that contains the Algorithm Library pre-installed, as seen previously in Figure 4. If you do not have any managed notebooks or they do not contain the Algorithm Library you will be taken to the create notebook setup page.
Step 4: Run Simon’s Algorithm
Upon creating your Jupyter notebook from the console, you can navigate to the Simon’s algorithm notebook and read a brief description of the algorithm. For each algorithm, its corresponding Jupyter notebook will import the algorithm, its necessary functions, and the Amazon Braket cost tracker. You will then have the option to run Simon’s algorithm on the local simulator for free or on a managed device (QPU or on-demand simulator) at a cost. The cost tracker will help you track your costs in near real-time.
The Braket Algorithm Library increases researchers and algorithm developers’ ability to focus on experimentation of code by reducing time spent aggregating code snippets from content-rich tutorials or setting up infrastructure. It is accessible today through the Braket console or GitHub repo at no additional cost. Contribute to our open-source efforts by viewing our open-source contribution guidelines or by starting on a first issue to have your implementation of an algorithm showcased in the library.
Researchers at accredited institutions wishing to run experiments on the algorithm library can apply for cloud credits through the AWS Cloud Credits program.