From 8374a08c78c2bc6c80ce2599793fe9197cb9b4a4 Mon Sep 17 00:00:00 2001 From: Ryan Hill Date: Tue, 25 Jun 2024 09:35:39 -0500 Subject: [PATCH] add bloqade to runtime demos (#34) --- .../qbraid_runtime_bloqade_aquila.ipynb | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 qbraid_sdk/qbraid_runtime_bloqade_aquila.ipynb diff --git a/qbraid_sdk/qbraid_runtime_bloqade_aquila.ipynb b/qbraid_sdk/qbraid_runtime_bloqade_aquila.ipynb new file mode 100644 index 0000000..987f038 --- /dev/null +++ b/qbraid_sdk/qbraid_runtime_bloqade_aquila.ipynb @@ -0,0 +1,140 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "9ebb8300-b55f-4a42-8ed9-017ea22616e3", + "metadata": {}, + "source": [ + "## qBraid Runtime: Bloqade task submission via BraketProvider" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f7670408-b707-451c-af4f-11db74703e69", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import numpy as np\n", + "from bloqade import var\n", + "from bloqade.atom_arrangement import Square\n", + "\n", + "from qbraid.runtime.braket import BraketProvider" + ] + }, + { + "cell_type": "markdown", + "id": "7eb00c25-c035-4132-af97-598cf06f98f4", + "metadata": {}, + "source": [ + "Create adiabatic program batch using Bloqade" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ae66e887-94dc-4544-86ab-3362d62eecea", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "adiabatic_durations = [0.4, 3.2, 0.4]\n", + "\n", + "max_detuning = var(\"max_detuning\")\n", + "adiabatic_program = (\n", + " Square(3, lattice_spacing=\"lattice_spacing\")\n", + " .rydberg.rabi.amplitude.uniform.piecewise_linear(\n", + " durations=adiabatic_durations, values=[0.0, \"max_rabi\", \"max_rabi\", 0.0]\n", + " )\n", + " .detuning.uniform.piecewise_linear(\n", + " durations=adiabatic_durations,\n", + " values=[\n", + " -max_detuning, # scalar variables support direct arithmetic operations\n", + " -max_detuning,\n", + " max_detuning,\n", + " max_detuning,\n", + " ],\n", + " )\n", + " .assign(max_rabi=15.8, max_detuning=16.33)\n", + " .batch_assign(lattice_spacing=np.arange(4.0, 7.0, 1.0))\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "3c2e92e6-0987-472b-a0ae-822a8878936b", + "metadata": {}, + "source": [ + "Target QuEra Aquila device using BraketProvider" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "605fc035-124f-461c-9a33-dc92ebeda7ce", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "provider = BraketProvider()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "62423d51-73e8-46ab-a412-7fd04fa94777", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "device = provider.get_device(\"arn:aws:braket:us-east-1::device/qpu/quera/Aquila\")" + ] + }, + { + "cell_type": "markdown", + "id": "b1194bdb-4b70-4da3-bd96-44dee8d623e3", + "metadata": {}, + "source": [ + "Submit quantum task(s)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0e8a9021-4965-41b0-8eea-83779b21d995", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "job_batch = device.run(adiabatic_program, shots=50)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 [qBraid]", + "language": "python", + "name": "python3_qbraid_sdk_9j9sjy" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.14" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}