Meta tags:
description= Set up Amazon Braket, run circuits on the local simulator, and learn how to submit jobs to real quantum hardware on AWS.;
author= QuantumComputingCourses.com;
Headings (most frequently used words):
the, simulator, step, with, on, local, to, noise, amazon, braket, circuit, in, managed, dm1, qpu, hybrid, aws, account, building, state, circuits, hardware, cost, jobs, for, vs, create, an, region, s3, bucket, configure, iam, permissions, style, statevector, shots, adding, using, pricing, example, getting, started, why, installation, setup, fundamentals, your, first, bell, running, result, object, depth, larger, ghz, parameterized, freeparameter, switching, simulators, modeling, submitting, checking, device, status, and, properties, available, devices, as, of, mid, 2026, estimation, variational, algorithms, common, mistakes, what, try, next, related, tutorials, get, one, quantum, email, week, or, use, existing, enable, console, choose, supported, results, credentials, chained, multi, line, qubit, indexing, gate, names, reading, diagram, mode, measurement_counts, measurements, measurement_probabilities, plotting, histogram, sv1, tn1, tensor, network, density, matrix, depolarizing, bit, flip, calculation, minimal, job, wrong, missing, not, understanding, asynchronous, model, unsupported, gates, target, ready, go, deeper, learn, reference, careers, about,
Text of the page (most frequently used words):
the (146), circuit (118), #braket (100), and (65), device (62), #result (59), for (45), qubit (43), aws (43), task (41), hardware (36), your (35), print (34), from (33), with (33), simulator (32), you (32), quantum (31), circuits (31), results (31), import (31), amazon (29), shots (26), run (26), gate (25), qubits (25), state (24), bucket (24), qpu (23), this (21), gates (21), local (20), ionq (18), noise (18), per (18), cnot (18), managed (17), devices (16), dm1 (16), arn (16), region (16), use (15), awsdevice (15), sv1 (15), jobs (14), quera (14), that (14), can (14), courses (13), rigetti (13), hybrid (13), are (13), each (13), measurement_counts (13), 1000 (13), simulators (12), bell (12), east (12), tn1 (12), theta (12), step (12), localsimulator (12), read (11), time (11), freeparameter (11), forte (11), statevector (11), but (11), same (11), angle (11), guide (10), tutorials (10), all (10), iqm (10), cost (10), ghz (10), different (10), shot (10), 2026 (9), job (9), qiskit (9), real (9), access (9), object (8), first (8), native (8), 100 (8), create (8), rotation (8), trapped (8), ion (8), policy (7), one (7), error (7), minutes (7), aquila (7), algorithms (7), available (7), properties (7), building (7), using (7), when (7), check (7), has (7), uses (7), target (7), not (7), s3_destination_folder (7), only (7), permissions (7), need (7), superconducting (7), key (7), many (7), where (7), phi (7), counts (7), values (7), hadamard (6), algorithm (6), learning (6), free (6), get (6), min (6), simulation (6), variational (6), status (6), larger (6), depth (6), running (6), account (6), installation (6), two (6), tasks (6), specific (6), iam (6), west (6), service (6), classical (6), theta_val (6), pricing (6), every (6), across (6), plt (6), sdk (6), com (5), computing (5), what (5), analog (5), hamiltonian (5), python (5), next (5), common (5), submitting (5), modeling (5), parameterized (5), control (5), these (5), set (5), vqe (5), build (5), then (5), props (5), fix (5), queue (5), parameter (5), works (5), measurement (5), both (5), submit (5), must (5), billing (5), optimizer (5), best_cost (5), network (5), like (5), parameters (5), fee (5), probability (5), flip (5), counter (5), depolarizing (5), entangled (5), world (5), single (5), see (4), programming (4), framework (4), cirq (4), comparing (4), try (4), mistakes (4), estimation (4), mid (4), setup (4), page (4), more (4), yes (4), api (4), before (4), recovered_task (4), hours (4), always (4), produces (4), outcomes (4), means (4), separate (4), best_theta (4), measurement_probabilities (4), bound_circuit (4), loop (4), numpy (4), 000425 (4), cepheus (4), 108q (4), aqt (4), north (4), name (4), online (4), currently (4), whether (4), its (4), bit (4), density (4), pauli (4), handles (4), wide_circuit (4), range (4), tensor (4), structure (4), multiple (4), style (4), secret (4), configure (4), cloud (4), started (4), hello (4), terms (3), editorial (3), careers (3), glossary (3), reference (3), case (3), studies (3), frameworks (3), learn (3), pennylane (3), plan (3), checking (3), switching (3), fundamentals (3), why (3), browse (3), type (3), model (3), based (3), simple (3), minimize (3), verify (3), used (3), paradigm (3), automatically (3), into (3), task_id (3), submitted (3), until (3), completes (3), take (3), positive (3), integer (3), require (3), mode (3), role (3), work (3), noisy (3), development (3), priority (3), seconds (3), compute (3), search (3), main (3), prob_1 (3), costs (3), without (3), over (3), runs (3), current (3), ibex (3), emerald (3), garnet (3), minute (3), than (3), availability (3), during (3), console (3), connectivity (3), apply (3), errors (3), matrix (3), useful (3), wide (3), shallow (3), layers (3), entanglement (3), grows (3), there (3), amplitudes (3), any (3), outcome (3), sqrt (3), measurements (3), row (3), steps (3), diagram (3), comes (3), phase (3), ising (3), coupling (3), axis (3), radians (3), method (3), line (3), export (3), default (3), choose (3), supported (3), providers (3), getting (3), accept (2), cookies (2), affiliate (2), performance (2), llc (2), quantumcomputingcourses (2), books (2), podcasts (2), events (2), faq (2), company (2), about (2), post (2), interview (2), certifications (2), salary (2), bloch (2), sphere (2), timeline (2), types (2), news (2), compare (2), paths (2), references (2), tools (2), quantumcomputing (2), email (2), week (2), mitigation (2), related (2), language (2), beginner (2), level (2), intermediate (2), guides (2), coursera (2), edx (2), udemy (2), brilliant (2), was (2), tutorial (2), full (2), explore (2), how (2), scipy (2), optimize (2), match (2), include (2), nativegateset (2), dict (2), support (2), introducing (2), awsquantumtask (2), later (2), retrieve (2), long (2), blocks (2), understanding (2), another (2), setting (2), amazonbraketfullaccess (2), usually (2), user (2), missing (2), write (2), simulations (2), loops (2), large (2), needed (2), max (2), workloads (2), replace (2), problem (2), algorithm_script (2), awsquantumjob (2), save_job_result (2), linspace (2), followed (2), minimal (2), example (2), spot (2), between (2), iterations (2), evaluates (2), energy (2), rates (2), total (2), plus (2), billed (2), rather (2), list (2), get_devices (2), special (2), purpose (2), instead (2), neutral (2), atom (2), 108 (2), ankaa (2), enterprise (2), provider (2), execute (2), typical (2), count (2), is_available (2), pattern (2), longer (2), times (2), gives (2), realistic (2), braket_dm (2), apply_gate_noise (2), bitflip (2), noises (2), some (2), adding (2), appear (2), after (2), lets (2), simulate (2), simulates (2), which (2), memory (2), well (2), few (2), heavily (2), high (2), deeply (2), other (2), writes (2), them (2), fully (2), value (2), prob_00 (2), bound (2), theta_values (2), substitute (2), entangle (2), define (2), symbolic (2), once (2), ones (2), bitstring (2), bar (2), matplotlib (2), mapping (2), observed (2), shape (2), number (2), 70710678 (2), sv_result (2), result_types (2), 500 (2), split (2), they (2), represents (2), nothing (2), format (2), superposition (2), index (2), second (2), swap (2), controlled (2), multi (2), chained (2), variables (2), credentials (2), resource (2), getobject (2), putobject (2), action (2), allow (2), effect (2), regardless (2), home (2), sign (2), install (2), pip (2), also (2), through (2), vendor (2), want (2), technologies (2), ibm (2), google (2), pyquil (2), prerequisites (2), wave (2), decline, improve, experience, track, our, cookie, privacy, disclosure, associate, earns, qualifying, purchases, contact, talent, pool, team, training, questions, cheatsheets, history, docs, independent, catalog, published, curated, anyone, 241, 220, 112, subscribe, address, new, worth, taking, changed, spam, unsubscribe, anytime, digital, badge, skill, builder, jul, updated, glance, pulse, previous, advanced, continue, structured, ready, deeper, share, helpful, affects, implement, hydrogen, molecule, theory, teleportation, design, those, possible, entangling, generation, older, aria, class, systems, molmer, sorensen, typically, iswap, gpi2, gpi, designing, does, natively, decomposes, decomposition, adds, extra, increasing, unsupported, completed, save, poll, call, asynchronously, calling, process, depending, asynchronous, pass, targeting, sampled, attach, add, either, accessdeniedexception, consolidate, such, wrong, start, logic, move, workflow, final, validation, testing, best, none, feature, production, grid, toy, ansatz, wait, completion, 123456789012, amazonbraketjobsexecutionrole, role_arn, source_module, launch, __main__, __name__, function, inf, float, optimization, simplified, def, script, defines, queuing, portion, instances, reduce, progress, saved, failed, resume, starting, checkpointing, ec2, instance, near, reducing, latency, locating, efficiently, proposes, propose, better, hundreds, thousands, evaluations, difference, reflects, underlying, economics, slower, accurate, while, faster, noisier, calculation, 0235, 0016, 00145, varies, 075, millisecond, increments, minimum, charge, rate, helps, avoid, surprises, changes, ahs, programs, objects, 256, technology, offline, will, window, schedule, depths, 10s, provider_name, 20s, statuses, qubitcount, accepting, operates, scheduled, windows, review, block, follows, differences, requirement, consuming, estimate, tolerates, spending, money, target_gates, flips, selectively, notice, even, though, perfect, 485, 480, chance, randomly, applies, models, operators, introduces, test, under, conditions, formalism, naturally, supports, matrices, limit, lower, deep, rule, thumb, maximal, may, intractable, bond, dimension, struggles, studying, resemble, tend, nisq, limited, relatively, contraction, depends, provide, retains, days, tracking, usage, exponentially, complex, including, beyond, laptop, handle, switch, infrastructure, critical, repeatedly, avoids, rebuilding, iteration, expectation, sweep, compile, concrete, runtime, qaoa, zeros, would, indicate, 00000, 11111, 2000, greenberger, horne, zeilinger, extends, three, 000, 111, show, title, ylabel, xlabel, keys, pyplot, visualize, plotting, histogram, dictionary, relative, frequency, custom, processing, data, array, n_qubits, 510, 490, bitstrings, returned, contains, several, attributes, four, corresponding, have, nonzero, confirming, expected, state_vector, request, tells, return, exact, sampling, roughly, confirms, correlated, individual, random, 502, 498, approximate, flows, left, right, column, operate, parallel, idle, wire, doing, vertical, connects, below, occupying, top, bottom, shows, text, reading, prints, put, note, argument, opposite, swaps, creates, description, lowercase, methods, unlike, uppercase, here, most, commonly, names, plain, integers, indices, register, allocates, highest, quantumregister, indexing, produce, easier, convenient, short, chaining, returns, itself, chain, calls, together, lines, styles, aws_default_region, aws_secret_access_key, aws_access_key_id, alternatively, environment, output, json, enter, statement, 2012, version, looks, needs, sets, globally, unique, taken, routes, mainly, london, stockholm, oregon, california, virginia, regions, management, open, explicitly, enabled, click, button, enable, credit, card, file, existing, beginners, hit, roadblocks, configuration, follow, carefully, __version__, awscli, cli, immediately, required, provides, unified, relationships, research, groups, benchmark, significant, operational, simplification, connected, system, located, austria, european, offering, fast, speeds, nearest, neighbor, known, fidelity, solves, providing, point, backend, changing, string, ran, vendors, traditionally, ships, own, construction, syntax, formats, authentication, mechanisms, maintaining, codebases, covers, options, submission, develop, locally, rewriting, code, sections, physics, background, basic, functions, jan, series, troubleshooting, prep, universities, career, cheat, sheets, migration, comparison, pinball, ocean, tket, shor, grover, azure, quantinuum, course, platforms, skip, content,
Text of the page (random words):
cuit bell state on the local simulator from braket circuits import circuit from braket devices import localsimulator create a bell state circuit 00 11 sqrt 2 circuit circuit circuit h 0 put qubit 0 into superposition circuit cnot 0 1 entangle qubit 1 with qubit 0 print circuit this prints the circuit diagram t 0 1 q0 h c q1 x t 0 1 reading the circuit diagram braket s text diagram format works like this the t row at the top and bottom shows time steps gate layers 0 1 means there are two time steps step 0 and step 1 each q row represents one qubit q0 is qubit 0 q1 is qubit 1 h is a hadamard gate occupying one time step c is the control qubit of a cnot gate the vertical bar connects it to x on the target qubit below represents an idle wire the qubit is doing nothing during that time step time flows left to right gates in the same column execute in the same time step they operate on different qubits so they can run in parallel running on the local simulator device localsimulator task device run circuit shots 1000 result task result counts result measurement_counts print counts counter 11 502 00 498 approximate 50 50 split with 1000 shots you see roughly 500 outcomes of 00 and 500 of 11 this confirms the bell state the two qubits are always correlated both 0 or both 1 but each individual measurement is random statevector mode with shots 0 setting shots 0 tells the simulator to return the exact statevector instead of sampling from braket circuits import circuit result_types from braket devices import localsimulator circuit circuit circuit h 0 circuit cnot 0 1 request the statevector result type circuit state_vector device localsimulator task device run circuit shots 0 sv_result task result statevector sv_result result_types 0 value print statevector 0 70710678 0j 0 0j 0 0j 0 70710678 0j the statevector has four amplitudes corresponding to 00 01 10 11 for the bell state only 00 and 11 have nonzero amplitudes of 1 sqrt 2 confirming the expected entangled state the result object in depth the result object returned by task result contains several useful attributes measurement_counts a python counter mapping bitstrings to the number of times each outcome was observed result device run circuit shots 1000 result print result measurement_counts counter 00 510 11 490 measurements a numpy array of shape shots n_qubits each row is one measurement outcome import numpy as np print result measurements shape 1000 2 print result measurements 5 0 0 1 1 0 0 1 1 0 0 this is useful for custom post processing where you need per shot data measurement_probabilities a dictionary mapping each observed bitstring to its relative frequency print result measurement_probabilities 00 0 51 11 0 49 plotting a histogram you can visualize the results with matplotlib import matplotlib pyplot as plt counts result measurement_counts plt bar counts keys counts values plt xlabel bitstring plt ylabel counts plt title bell state measurement results plt show building larger circuits ghz state a ghz greenberger horne zeilinger state extends the bell state to three or more qubits it produces the state 000 0 111 1 sqrt 2 from braket circuits import circuit from braket devices import localsimulator build a 5 qubit ghz state ghz circuit ghz h 0 for i in range 4 ghz cnot i i 1 print ghz device localsimulator result device run ghz shots 2000 result print result measurement_counts counter 00000 1000 11111 1000 only two outcomes appear all zeros and all ones any other outcome would indicate an error in the circuit or noise in the hardware parameterized circuits with freeparameter for variational algorithms like vqe and qaoa you need to run the same circuit structure at many different parameter values braket s freeparameter lets you define a circuit with symbolic parameters compile it once and then substitute concrete values at runtime from braket circuits import circuit freeparameter from braket devices import localsimulator define symbolic parameters theta freeparameter theta phi freeparameter phi build a parameterized circuit circuit circuit circuit ry theta 0 ry rotation by theta on qubit 0 circuit cnot 0 1 entangle qubits 0 and 1 circuit rz phi 1 rz rotation by phi on qubit 1 print circuit to run the circuit substitute values for the parameters device localsimulator run with specific parameter values bound_circuit circuit theta 0 5 phi 1 2 result device run bound_circuit shots 1000 result print result measurement_counts you can sweep across multiple parameter values in a loop import numpy as np device localsimulator theta_values np linspace 0 np pi 10 for theta_val in theta_values bound circuit theta theta_val phi 0 0 result device run bound shots 1000 result prob_00 result measurement_probabilities get 00 0 print f theta theta_val 2f p 00 prob_00 3f this pattern is critical for vqe where a classical optimizer repeatedly evaluates the circuit at different parameter values to minimize an energy expectation value freeparameter avoids rebuilding the circuit object on each iteration switching to managed simulators when your circuit grows beyond what your laptop can handle switch to one of braket s managed simulators these run on aws infrastructure and support larger qubit counts sv1 statevector simulator sv1 simulates quantum circuits by tracking the full statevector it handles up to 34 qubits but memory usage grows exponentially 2 n complex amplitudes sv1 works well for any circuit structure including deeply entangled circuits from braket aws import awsdevice sv1 fully managed statevector simulator device awsdevice arn aws braket device quantum simulator amazon sv1 task device run circuit theta 0 5 phi 1 2 shots 1000 s3_destination_folder my braket results bucket sv1 results print f task id task id blocks until the task completes usually seconds to minutes result task result print result measurement_counts you must provide an s3 bucket in the same region as your braket service braket writes task results there and retains them for 90 days tn1 tensor network simulator tn1 uses tensor network contraction to simulate circuits it handles up to 50 qubits but performance depends heavily on the circuit structure when to use tn1 over sv1 your circuit has many qubits 35 50 but relatively few layers of gates your circuit has limited entanglement not every qubit is entangled with every other you are studying circuits that resemble real world nisq algorithms which tend to be wide and shallow when tn1 struggles deeply entangled circuits where the bond dimension grows large a depth 50 circuit on 50 qubits with maximal entanglement may be intractable circuits with many long range cnot gates that create high entanglement across the tensor network rule of thumb if your circuit is wide many qubits but shallow few gate layers try tn1 first if the circuit is deep and heavily entangled use sv1 up to 34 qubits tn1 tensor network simulator up to 50 qubits device awsdevice arn aws braket device quantum simulator amazon tn1 a wide shallow circuit that tn1 handles well wide_circuit circuit for i in range 50 wide_circuit h i for i in range 0 49 2 wide_circuit cnot i i 1 task device run wide_circuit shots 1000 s3_destination_folder my braket results bucket tn1 results result task result print result measurement_counts dm1 density matrix simulator with noise dm1 simulates circuits using the density matrix formalism which naturally supports noise modeling it handles up to 17 qubits density matrices require 2 2n memory so the qubit limit is lower than sv1 noise modeling with dm1 real quantum hardware introduces errors dm1 lets you simulate these errors so you can test whether your circuit produces useful results under realistic noise conditions adding depolarizing noise depolarizing noise randomly applies one of the pauli operators x y z with some probability after each gate this models a common type of hardware error from braket circuits import circuit from braket circuits noises import depolarizing from braket devices import localsimulator build a bell state circuit circuit circuit circuit h 0 circuit cnot 0 1 apply depolarizing noise to every gate in the circuit probability 0 01 means a 1 chance of error per gate circuit apply_gate_noise depolarizing probability 0 01 use the local density matrix simulator device localsimulator braket_dm result device run circuit shots 1000 result print result measurement_counts counter 00 485 11 480 01 18 10 17 notice that 01 and 10 outcomes appear even though a perfect bell state only produces 00 and 11 this is the noise introducing errors adding bit flip noise bit flip noise flips a qubit s state with some probability you can apply it selectively to specific gates from braket circuits import circuit from braket circuits noises import bitflip circuit circuit circuit h 0 circuit cnot 0 1 apply bit flip noise only to cnot gates circuit apply_gate_noise bitflip probability 0 02 target_gates circuit cnot device localsimulator braket_dm result device run circuit shots 1000 result print result measurement_counts using the managed dm1 simulator for larger noisy simulations up to 17 qubits use the managed dm1 service from braket aws import awsdevice device awsdevice arn aws braket device quantum simulator amazon dm1 task device run circuit shots 1000 s3_destination_folder my braket results bucket dm1 results result task result print result measurement_counts dm1 gives you realistic noisy results without consuming hardware time use it to estimate whether your algorithm tolerates typical error rates before spending money on qpu access hardware submitting to a qpu submitting to real hardware follows the same pattern as simulators the key differences are longer queue times minutes to hours per shot billing and the requirement that shots be a positive integer no statevector mode on real hardware from braket aws import awsdevice from braket circuits import circuit build a bell state circuit circuit h 0 cnot 0 1 ionq forte 1 36 qubit trapped ion qpu device awsdevice arn aws braket us east 1 device qpu ionq forte 1 check if the device is currently online print f available device is_available submit the task task device run circuit shots 100 s3_destination_folder my braket results bucket ionq results print f task arn task id print f status task state block until the task completes this can take minutes to hours result task result print result measurement_counts checking device status and properties real quantum hardware operates on scheduled availability windows before submitting a task check whether the device is online and review its properties from braket aws import awsdevice device awsdevice arn aws braket us east 1 device qpu ionq forte 1 is the device currently accepting tasks print f available device is_available device properties native gates qubit count connectivity props device properties dict print f qubit count props paradigm qubitcount print f native gates props paradigm nativegateset to list all currently online devices from braket aws import awsdevice devices awsdevice get_devices statuses online for d in devices print f d name 20s d provider_name 10s d arn devices that are offline will queue your task and execute it during the next availability window check the braket console for the device s schedule and typical queue depths available devices as of mid 2026 provider device technology max qubits region ionq forte 1 trapped ion 36 us east 1 ionq forte enterprise 1 trapped ion 36 us east 1 rigetti ankaa 3 superconducting 84 us west 1 rigetti cepheus 1 108q superconducting 108 us west 1 iqm garnet superconducting 20 eu north 1 iqm emerald superconducting 54 eu north 1 aqt ibex q1 trapped ion 12 eu north 1 quera aquila neutral atom 256 us east 1 quera s aquila device is special purpose it runs analog hamiltonian simulation rather than gate based circuits it uses a different programming model ahs programs instead of circuit objects use awsdevice get_devices to check the current list as hardware availability changes over time cost estimation understanding braket pricing helps you avoid surprises simulator pricing the local simulator is free the managed simulators sv1 dm1 tn1 are billed per minute of simulation time rather than per shot sv1 and dm1 run at 0 075 per minute billed in millisecond increments with a minimum charge of 3 seconds per task check the aws braket pricing page for tn1 s current per minute rate qpu pricing every qpu task costs 0 30 plus a per shot fee that varies by device device per task fee per shot fee ionq forte 0 30 0 08 rigetti cepheus 1 108q 0 30 0 000425 iqm garnet 0 30 0 00145 iqm emerald 0 30 0 0016 aqt ibex q1 0 30 0 0235 quera aquila 0 30 0 01 example cost calculation running a 100 shot bell state on ionq forte per task fee 0 30 per shot cost 100 shots x 0 08 0 08 0 08 8 00 total 8 30 running the same circuit on rigetti cepheus 1 108q per task fee 0 30 per shot cost 100 shots x 0 000425 0 000425 0 000425 0 04 total 0 34 the per shot cost difference reflects the underlying hardware economics trapped ion gates are slower but more accurate while superconducting gates are faster but noisier always check the aws braket pricing page for current rates hybrid jobs for variational algorithms variational algorithms like vqe run a classical quantum loop a classical optimizer proposes parameters the quantum circuit evaluates an energy and the optimizer uses that result to propose better parameters this loop can require hundreds or thousands of circuit evaluations braket hybrid jobs runs these workloads efficiently by co locating compute the classical optimizer runs on an ec2 instance near the qpu reducing network latency between iterations checkpointing progress is saved between iterations so a failed step can resume without starting over spot pricing the classical compute portion can use spot instances to reduce costs priority queuing tasks submitted from a hybrid job get priority access to the qpu minimal hybrid job example first create a python script that defines your algorithm algorithm_script py import numpy as np from braket aws import awsdevice from braket circuits import circuit freeparameter from braket jobs import save_job_result def main device awsdevice arn aws braket device quantum simulator amazon sv1 theta freeparameter theta simple circuit ry rotation followed by measurement circuit circuit ry theta 0 optimization loop simplified best_theta 0 0 best_cost float inf for theta_val in np linspace 0 np pi 20 bound_circuit circuit theta theta_val result device run bound_circuit shots 100 s3_destination_folder my braket results bucket hybrid result use p 1 as the cost function prob_1 result measurement_probabilities get 1 0 if prob_1 best_cost best_cost prob_1 best_theta theta_val save_job_result best_theta best_theta best_cost best_cost if __name__ __main__ main then launch the hybrid job from braket aws import awsquantumjob job awsquantumjob create device arn aws braket device quantum simulator amazon sv1 source_module algorithm_script ...
|