Skip to content

Commit

Permalink
resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
plquera committed Jul 5, 2023
2 parents 1f04859 + 7f99b53 commit 859abdf
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"id": "f352f823-91e2-4b8d-ac6f-af040be34d10",
"metadata": {},
"source": [
"# Session I - Bloqade activities\n",
"# Section I - Bloqade activities\n",
"\n",
"This notebook accompanies the Session I of QuEra's condensed tutorial on neutral-atom quantum computing and intends to provide participants with the basic information needed to control neutral-atom quantum Hamiltonians.\n",
"This notebook accompanies Section I of QuEra's condensed tutorial on neutral-atom quantum computing and intends to provide participants with the basic information needed to control neutral-atom quantum Hamiltonians.\n",
"\n",
"## Installation requirements and guidelines\n",
"For general details on Bloqade's functionality, we refer the reader to the [Bloqade documentation page](https://queracomputing.github.io/Bloqade.jl/dev/). \n",
Expand All @@ -31,7 +31,7 @@
"4. Perform time evolution (the analogue of composing gates)\n",
"5. Measure for results\n",
"\n",
"Not too bad! In what follows, we will focus on point 1 and 2, while Session II of our tutorial will cover packing it all together into some applications that will cover all steps together.\n",
"Not too bad! In what follows, we will focus on point 1 and 2, while Section II of our tutorial will cover packing it all together into some applications that will cover all steps together.\n",
"\n",
"## The Hamiltonian\n",
"\n",
Expand Down Expand Up @@ -300,7 +300,7 @@
"source": [
"### Exercise:\n",
"\n",
"Check the hand-out for the MIS activity in this folder. We will look at it more carefully on later sessions of this tutorial. Fow now, let's just practice creating a register with qubits in the positions corresponding to the 9 vertices of the graph of the handout"
"Check the hand-out for the MIS activity in this folder. We will look at it more carefully on later sections of this tutorial. Fow now, let's just practice creating a register with qubits in the positions corresponding to the 9 vertices of the graph of the handout"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"id": "4ecd74f2",
"metadata": {},
"source": [
"# Session III: Interacting With Hardware\n",
"# Section III: Interacting With Hardware\n",
"\n",
"by John Long, *Scientific Software Developer* @ QuEra Computing Inc."
]
Expand Down Expand Up @@ -43,10 +43,10 @@
"id": "b8bc370b",
"metadata": {},
"source": [
"From the `2_Rabi_and_phases` section of this repo you'll recall being exposed to the idea of ordered phases with neutral atom lattices, which each possible ordered phase achievable through properly fixing the lattice constant and choosing the right Rabi Frequency/final Detuning value when performing an Adiabatic Sweep (revisit the phase diagram in the document to get a refresher on this).\n",
"From the `2_Rabi_and_ordered_phases` section of this repository you'll recall being exposed to the idea of ordered phases with neutral atom lattices, with each possible ordered phase achievable through properly fixing the lattice constant and choosing the right Rabi Frequency/final Detuning value when performing an Adiabatic Sweep (revisit the phase diagram in the document to get a refresher on this).\n",
"\n",
"\n",
"For this session we'll recreate the $Z_2$ phase in a $3 \\times 3$ square lattice. In this configuration each atom will blockade its neighbour leading to a distinct alternating pattern of Rydberg densities (hence the \"checkerboard\")\n",
"For this session we'll recreate the $Z_2$ phase in a $3 \\times 3$ square lattice. In this configuration each atom will blockade its neighbour leading to a distinct alternating pattern of Rydberg densities (hence the alternative \"checkerboard\" name used to refer to this phase as well!)\n",
"\n",
"Let's start by importing Bloqade:"
]
Expand Down Expand Up @@ -1644,7 +1644,7 @@
"id": "b0042a96",
"metadata": {},
"source": [
"As a sanity check, it's always a good idea (when possible) to emulate the evolution of the Hamiltonian and see if the end result agrees with expectation. Of course, emulation may not be possible if your system size is too large but you can take advantage of Bloqade's HPC facilities (Check out `5_HP_Bloqade`) or you can still design your problem with Bloqade but submit straight to hardware.\n",
"As a sanity check, it's always a good idea (when possible) to emulate the evolution of the Hamiltonian and see if the end result agrees with expectation. Of course, emulation may not be possible if your system size is too large but you can take advantage of Bloqade's HPC facilities (Check out section `5_HP_Bloqade` of the repo) or you can still design your problem with Bloqade but submit straight to hardware.\n",
"\n",
"We'll start the emulation by defining an empty register (you can think of this as our state vector)"
]
Expand Down Expand Up @@ -1683,7 +1683,7 @@
"* `total_time`, how long the time evolution should run for\n",
"* `h`, our Hamiltonian\n",
"\n",
"Note that at this stage you can also take advantage of the different Differential Equation solvers provided by the `DifferentialEquations.jl` and override Bloqade's default should you have your own implementation that adheres to the `DifferentialEquations.jl` interface or if you'd like to try a different auto-switching/Runge-Kutta solver."
"Note that at this stage you can also take advantage of the different Differential Equation solvers provided by the `DifferentialEquations.jl` package and override Bloqade's default should you either have your own implementation that adheres to the `DifferentialEquations.jl` interface OR if you'd like to try a different auto-switching/Runge-Kutta solver."
]
},
{
Expand Down Expand Up @@ -2925,7 +2925,7 @@
"\n",
"The issue at hand can be summed up in two words: Hardware Limitations!\n",
"\n",
"The lasers and other components of QuEra's neutral atom hardware are limited in what they can pull of in terms of things like the distance between atoms, certain waveform values, as well as time resolution.\n",
"The lasers and other components of QuEra's neutral atom hardware are limited in what they can pull off in terms of things such as the distance between atoms, certain waveform values, as well as time resolution.\n",
"\n",
"Fortunately the functions in `BloqadeSchema` that you'll be introduced to attempt to minimize and outright remove the need to keep this at the forefront of your mind when designing problems of interest. As you'll see below, the `hardware_transform` function will take your defined Hamiltonian and, with the hardware constraints in mind, produce a new Hamiltonian that is as minimally different from your original Hamiltonian while staying within hardware constraints."
]
Expand All @@ -2946,13 +2946,13 @@
"id": "85bed24c",
"metadata": {},
"source": [
"Note that `hardware_transform` returns two values: the actual transformed Hamiltonian and a `HardwareTransformInfo` object. This object is supposed to give you an idea of how much your originally Hamiltonian had to be modified to generate a hardware compatible one.\n",
"Note that `hardware_transform` returns two values: the actual transformed Hamiltonian and a `HardwareTransformInfo` object. This object is supposed to give you an idea of how much your original Hamiltonian had to be modified to generate a hardware compatible one.\n",
"\n",
"For:\n",
"* atom positions, the _Mean Squared Error_ (`mse_atoms`) between the original and new atom positions are given\n",
"* the Phase, Rabi Frequency, and Detuning are calculated as $||A - B||_1$ (ϕ_error, Ω_error, and, Δ_error), the one-norm difference \n",
"\n",
"(see the result of `dump` on `transform_info` below)\n",
"(see the result of the `dump` function on `transform_info` below)\n",
"\n",
"Ideally you'd like these values to be as small as possible, indicating there was not a major difference between your proposed and original Waveforms but this may not always be the case."
]
Expand Down Expand Up @@ -6651,7 +6651,7 @@
"id": "0bbeb9c4",
"metadata": {},
"source": [
"What if we try the same waveform but with the Detuning?"
"How are waveforms for the detuning transformed?"
]
},
{
Expand Down Expand Up @@ -8654,7 +8654,7 @@
"id": "d71a6465",
"metadata": {},
"source": [
"But, for the pedagogical purposes let us see what happens if we feed something that fails validation and how to correct it. In this case we generate something that violates the atom spacing constraint:"
"But, for pedagogical purposes let us see what happens if we feed something that fails validation and how to correct it. In this case we generate something that violates the atom spacing constraint:"
]
},
{
Expand Down Expand Up @@ -8859,7 +8859,7 @@
"id": "57d630ce",
"metadata": {},
"source": [
"Now we see the validation error is gone"
"Now we see the validation error is gone."
]
},
{
Expand All @@ -8886,6 +8886,8 @@
"* AWS Secret Access Key\n",
"* AWS Session Token\n",
"\n",
"If you have an AWS account that is *not configured for SSO (Single Sign-On)* you should only need to provide your Access Key Id and Secret Access Key (there is no session token).\n",
"\n",
"These will be used to create an AWS Credentials object that will allow you to connect to the machine's queue."
]
},
Expand Down Expand Up @@ -8939,23 +8941,10 @@
},
{
"cell_type": "code",
"execution_count": 111,
"execution_count": null,
"id": "6e06e91c",
"metadata": {},
"outputs": [
{
"ename": "LoadError",
"evalue": "UndefVarError: credentials not defined",
"output_type": "error",
"traceback": [
"UndefVarError: credentials not defined",
"",
"Stacktrace:",
" [1] top-level scope",
" @ In[111]:1"
]
}
],
"outputs": [],
"source": [
"task = submit_to_braket(transformed_h, 1000; credentials=credentials)"
]
Expand Down Expand Up @@ -9262,6 +9251,62 @@
"We see that the hardware results agree quite well with simulation! Granted this may not have been the case if we had reduced the number of shots owing to noise. "
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "ec09f6dd",
"metadata": {},
"source": [
"# Storing Your Hamiltonian/Task"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "51cb7eb4",
"metadata": {},
"source": [
"It may be useful in certain scenarios to have the ability to store the Hamiltonian in a format suitable for submission later.\n",
"\n",
"This can be done with `BloqadeSchema` and the `JSON3` package, which is separate from Bloqade:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5490625a",
"metadata": {},
"outputs": [],
"source": [
"using JSON3\n",
"# provide device capabilities and number of shots as parameters\n",
"device_capabilities = BloqadeSchema.get_device_capabilities()\n",
"nshots = 100\n",
"translation_params = BloqadeSchema.SchemaTranslationParams(nshots, device_capabilities)\n",
"\n",
"# Convert to QuEraTaskSpecification format\n",
"bloqade_ir = BloqadeSchema.to_dict(transformed_h, translation_params)\n",
"# Save to file\n",
"open(\"my_task.json\", \"w\") do io\n",
" JSON3.pretty(io, bloqade_ir)\n",
"end"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b5597182",
"metadata": {},
"source": [
"If you ever receive results as a JSON file they can be opened in Julia for further analysis like so:\n",
"\n",
"```julia\n",
"results_string = read(\"result.json\", String)\n",
"\n",
"results_dict = JSON3.read(results_string, Dict)\n",
"```"
]
},
{
"attachments": {},
"cell_type": "markdown",
Expand Down
Binary file not shown.
Loading

0 comments on commit 859abdf

Please sign in to comment.