Podczas gdy IBM, Microsoft i Google poczyniły duże zobowiązania i inwestycje w informatykę kwantową, Amazon do niedawna milczał w tej dziedzinie. Zmieniło się to wraz z wprowadzeniem Amazon Braket.
Amazon nadal nie próbuje budować własnych komputerów kwantowych, ale dzięki Braket udostępnia komputery kwantowe innych firm użytkownikom chmury za pośrednictwem AWS. Braket obsługuje obecnie trzy kwantowe usługi obliczeniowe, od D-Wave, IonQ i Rigetti.
[Również na: praktyczne spojrzenie na zestaw Microsoft Quantum Development Kit oraz zestawy SDK do obliczeń kwantowych IBM Q i Qiskit]
D-Wave wytwarza nadprzewodzące wyżarzacze kwantowe, które są zwykle programowane za pomocą oprogramowania D-Wave Ocean, chociaż w Braket SDK znajduje się również moduł wyżarzania. IonQ tworzy kwantowe procesory uwięzionych jonów, a Rigetti tworzy nadprzewodzące procesory kwantowe. W Braket można programować zarówno procesory IonQ, jak i Rigetti za pomocą modułu obwodów Braket Python SDK. Ten sam kod działa również na lokalnych i hostowanych symulatorach kwantowych.
Nazwa Braket to rodzaj żartu dla fizyków. Notacja Bra-keta to sformułowanie Diraca z mechaniki kwantowej, które jest łatwiejszym sposobem wyrażenia równania Schrödingera niż cząstkowe równania różniczkowe. W notacji Diraca stanik
|f> is a column vector. Writing a bra next to a ket implies matrix multiplication.
Amazon Braket and the Braket Python SDK compete with IBM Q and Qiskit, Azure Quantum and Microsoft Q#, and Google Cirq. IBM already has its own quantum computers and simulators available to the public online. Microsoft’s simulator is generally available, but its quantum offerings are currently in limited preview for early adopters, including access to quantum computers from Honeywell, IonQ, and Quantum Circuits, and optimization solutions from 1QBit. Microsoft hasn’t announced when its own topological superconducting quantum computers will become available, nor has Google announced when it will make its quantum computers or Sycamore chips available to the public.
Amazon Braket overview
Amazon Braket is a fully managed service that helps you get started with quantum computing. It has three modules, Build, Test, and Run. The Build module centers around managed Jupyter notebooks pre-configured with sample algorithms, resources, and developer tools, including the Amazon Braket SDK. The Test module provides access to managed, high-performance, quantum circuit simulators. The Run module provides secure, on-demand access to different types of quantum computers (QPUs): gate-based quantum computers from IonQ and Rigetti, and a quantum annealer from D-Wave.
Tasks may not run immediately on the QPU. The QPUs only execute tasks during execution windows.
Amazon Braket SDK API
The Braket Python SDK defines all of the operations you need to build, test, and run quantum circuits and annealers. It is organized into five packages: braket.annealing, braket.aws, braket.circuits, braket.devices, and braket.tasks.
The braket.annealing package allows you to define two kinds of binary quadratic models (BQMs): Ising (a mathematical model of ferromagnetism in statistical mechanics, using magnetic dipole moments of atomic “spins”) and QUBO (Quadratic Unconstrained Binary Optimization) problems, to solve on a quantum annealer, such as a D-Wave unit. The braket.circuits package lets you define quantum circuits based on a set of gates, to solve on gate-based quantum computers, such as ones from IonQ and Rigetti.
The other three packages control the running of your problem. The braket.aws package allows you to select quantum devices, load problems into tasks, and connect tasks to AWS sessions. The braket.devices package lets you run tasks on quantum devices and simulators. The braket.tasks package lets you manage, track, cancel, and get results from quantum tasks.
Amazon Braket circuits and gates
Circuits in a quantum computer such as the ones from IonQ or Rigetti (or IBM or Honeywell, for that matter) are built from a standard set of gates (see figure below), although not every QPU may have an implementation of every kind of gate. In the Braket SDK you define a circuit using the
Circuit() method from the braket.circuits package, qualified by the gates in the circuit and their parameters.
For example, this Braket code (from Amazon’s Deep_dive_into_the_anatomy_of_quantum_circuits example) defines a circuit that initializes four qubits to a Hadamard (equal probability of 1 and 0) state, then entangles qubit 2 with qubit 0 and qubit 3 with qubit 1 using Controlled Not operations.
# define circuit with 4 qubits
my_circuit = Circuit().h(range(4)).cnot(control=0, target=2).cnot(control=1, target=3)
The Braket SDK seems to have a nearly full set of quantum logic gates, as shown in this enumeration of the
Gate class. I don’t see a Deutsch gate listed, but as far as I know it hasn’t yet been implemented on a real QPU.
# print all available gates currently available within SDK
gate_set = [attr for attr in dir(Gate) if attr in string.ascii_uppercase]
['CCNot', 'CNot', 'CPhaseShift', 'CPhaseShift00', 'CPhaseShift01', 'CPhaseShift10', 'CSwap', 'CY', 'CZ', 'H', 'I', 'ISwap', 'PSwap', 'PhaseShift', 'Rx', 'Ry', 'Rz', 'S', 'Si', 'Swap', 'T', 'Ti', 'Unitary', 'V', 'Vi', 'X', 'XX', 'XY', 'Y', 'YY', 'Z', 'ZZ']
Rxtreme (CC BY-SA 4.0)
Ocean is the native Python-based software stack for D-Wave quantum annealers. For use via Braket, you can combine the Ocean software with the Amazon Braket Ocean plug-in, which translates between Ocean and Braket formats.
Quantum annealers function quite differently than gate-based QPUs. Essentially, you formulate your problem as a binary quadratic model (BQM) that has a global minimum at the solution you want to find. Then you use the annealer to sample the function many times (since the annealer isn’t perfect) to find the minimum. You can create the BQM for a given problem mathematically or generate the BQM using Ocean software. The code that follows, from Amazon’s D-Wave_Anatomy example, uses the Braket Ocean plug-in to solve a BQM on a D-Wave device.# set parametersD-Wave Systems
num_reads = 1000
# define BQM
bqm = dimod.BinaryQuadraticModel(linear, quadratic, offset, vartype)
# run BQM: solve with D-Wave device
sampler = BraketDWaveSampler(s3_folder,'arn:aws:braket:::device/qpu/d-wave/DW_2000Q_6')
sampler = EmbeddingComposite(sampler)
sampleset = sampler.sample(bqm, num_reads=num_reads)
# aggregate solution:
sampleset = sampleset.aggregate()
Enabling Amazon Braket and using notebooks
Before you can use Braket, you need to enable it in your AWS account.
Then you need to create a notebook instance. Notebooks use Amazon SageMaker (read my review).
When you open a notebook, you can enter new code or use one of Amazon’s examples.
You need to check the status of the QPU devices, as they aren’t always available.
While you can run them yourself, the Braket example notebooks have been saved with results from a previous run.
There are examples for both gate-based QPUs, as above, and quantum annealers, as below.
Learn today, useful tomorrow
Amazon Braket is a reasonable way to get your feet wet with quantum computers and simulators. Since we’re still in the NISQ (Noisy Intermediate Scale Quantum) phase of quantum computing, you can’t really expect useful results from Braket. We’ll need more qubits, less noise, and longer coherence times, all of which are being actively researched.
Braket’s current QPU offerings are modest. The 2048-qubit D-Wave annealer is mostly useful for optimization problems; it’s about half the size of D-Wave’s latest-generation annealer. The 11-qubit IonQ QPU, which has relatively long coherence times, is way too small to implement the algorithms for quantum computers that should exhibit useful quantum supremacy, such as Grover’s algorithm for finding the inverse of a function and Shor’s algorithm for finding the prime factors of an integer. The 30-qubit Rigetti Aspen-8 is also too small.
Braket is not free, although it is relatively cheap to use. By comparison, IBM Q is completely free, although the publicly available IBM QPUs are very small: they range from a 1 qubit QPU in Armonk to a 15-qubit QPU in Melbourne. IBM also offers a paid premium QPU service.
[ Also on : Review: Amazon SageMaker plays catch-up ]
IBM also rates its QPUs by their quantum volume (QV), a measure that combines the number of qubits with their error rate and coherence time. There are five-qubit IBM QPUs ranging from QV8 to QV64: higher is better. Honeywell has also announced achieving QV64.
What Braket is currently good for is learning about quantum computing and developing NISQ-regime quantum algorithms. Stay tuned, though. As QPUs improve and are plugged into AWS, Braket will become more and more useful.
Cost: Managed notebooks: $0.04 to $34.27 per instance-hour; quantum simulator: $4.50 per hour; quantum computers: $0.30 per task plus $0.00019 to $0.01 per shot (repetition of a circuit).
Platform: AWS; installing the Braket SDK locally requires Python 3.7.2 or greater, and Git.