From 8f08da693c6dbc3e721d1e7c2d96672c0d3e9390 Mon Sep 17 00:00:00 2001 From: Caleb Johnson Date: Fri, 29 Sep 2023 15:54:21 -0500 Subject: [PATCH] Upstream/docs/update/notebook cleanup (#985) * Update one notebook and remove OpenBLAS messages * Clean up rest of notebooks and BLAS warnings --- .../notebooks/01_arguments_and_results.ipynb | 31 +++------ docs/running/notebooks/02_dependencies.ipynb | 35 +++++------ .../notebooks/03_distributed_workloads.ipynb | 63 +++++++++---------- .../04_retrieving_past_results.ipynb | 51 +++++++-------- 4 files changed, 77 insertions(+), 103 deletions(-) diff --git a/docs/running/notebooks/01_arguments_and_results.ipynb b/docs/running/notebooks/01_arguments_and_results.ipynb index faea0e867..2dca98170 100644 --- a/docs/running/notebooks/01_arguments_and_results.ipynb +++ b/docs/running/notebooks/01_arguments_and_results.ipynb @@ -103,7 +103,8 @@ "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + ], "source": [ "from quantum_serverless import Program\n", "\n", @@ -117,21 +118,6 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false, - "jupyter": { - "outputs_hidden": false - } - }, - "outputs": [], - "source": [ - "from quantum_serverless import QuantumServerless, Provider\n", - "import os" - ] - }, - { - "cell_type": "code", - "execution_count": 4, "metadata": {}, "outputs": [ { @@ -140,12 +126,15 @@ "" ] }, - "execution_count": 4, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ + "from quantum_serverless import QuantumServerless, Provider\n", + "import os\n", + "\n", "provider = Provider(\n", " username=os.environ.get(\"GATEWAY_USER\", \"user\"),\n", " password=os.environ.get(\"GATEWAY_PASSWORD\", \"password123\"),\n", @@ -166,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -182,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -191,7 +180,7 @@ "'{\"quasi_dists\": {\"0\": 0.4999999999999999, \"3\": 0.4999999999999999}}'" ] }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -217,7 +206,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/docs/running/notebooks/02_dependencies.ipynb b/docs/running/notebooks/02_dependencies.ipynb index 7755156d6..4205e45a8 100644 --- a/docs/running/notebooks/02_dependencies.ipynb +++ b/docs/running/notebooks/02_dependencies.ipynb @@ -68,7 +68,8 @@ "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + ], "source": [ "from quantum_serverless import Program\n", "\n", @@ -84,16 +85,6 @@ "cell_type": "code", "execution_count": 2, "metadata": {}, - "outputs": [], - "source": [ - "from quantum_serverless import QuantumServerless, Provider\n", - "import os" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, "outputs": [ { "data": { @@ -101,12 +92,15 @@ "" ] }, - "execution_count": 3, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ + "from quantum_serverless import QuantumServerless, Provider\n", + "import os\n", + "\n", "provider = Provider(\n", " username=os.environ.get(\"GATEWAY_USER\", \"user\"),\n", " password=os.environ.get(\"GATEWAY_PASSWORD\", \"password123\"),\n", @@ -120,17 +114,18 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from qiskit.circuit.random import random_circuit\n", + "\n", "circuit = random_circuit(2, 2)" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -139,7 +134,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -148,7 +143,7 @@ "'QUEUED'" ] }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -159,16 +154,16 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'{\"quasi_dists\": {\"0\": 0.2393348760987308, \"1\": 0.7606651239012692}}'" + "'{\"quasi_dists\": {\"0\": 0.6107159035567002, \"1\": 0.3892840964432998}}'" ] }, - "execution_count": 8, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -194,7 +189,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/docs/running/notebooks/03_distributed_workloads.ipynb b/docs/running/notebooks/03_distributed_workloads.ipynb index 9bc00873c..9db86a2e4 100644 --- a/docs/running/notebooks/03_distributed_workloads.ipynb +++ b/docs/running/notebooks/03_distributed_workloads.ipynb @@ -65,25 +65,24 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false, - "jupyter": { - "outputs_hidden": false + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" } - }, - "outputs": [], + ], "source": [ "from quantum_serverless import QuantumServerless, Provider\n", - "import os" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ + "import os\n", + "\n", "provider = Provider(\n", " username=os.environ.get(\"GATEWAY_USER\", \"user\"),\n", " password=os.environ.get(\"GATEWAY_PASSWORD\", \"password123\"),\n", @@ -99,23 +98,23 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's create list of random circuit which we will be using as arguments" + "Let's create a list of random circuits which we will be passed as arguments to the program." ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[,\n", - " ,\n", - " ]" + "[,\n", + " ,\n", + " ]" ] }, - "execution_count": 6, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -132,21 +131,21 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Run program as usual" + "Run program as usual, but pass the circuits in as a keyword argument, `circuits`." ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 7, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -166,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -175,7 +174,7 @@ "'QUEUED'" ] }, - "execution_count": 8, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -186,16 +185,16 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'{\"results\": [{\"0\": 0.1434935972712797, \"2\": 0.8565064027287204}, {\"0\": 0.4999999999999999, \"2\": 0.4999999999999999}, {\"0\": 0.0225288870630969, \"2\": 0.977471112936903}]}'" + "'{\"results\": [{\"2\": 0.4999999999999999, \"3\": 0.4999999999999999}, {\"0\": 0.410199670072165, \"1\": 0.410199670072165, \"2\": 0.0898003299278348, \"3\": 0.0898003299278349}, {\"0\": 0.4999999999999999, \"2\": 0.4999999999999999}]}'" ] }, - "execution_count": 9, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -221,7 +220,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.9.13" } }, "nbformat": 4, diff --git a/docs/running/notebooks/04_retrieving_past_results.ipynb b/docs/running/notebooks/04_retrieving_past_results.ipynb index 5c3be61c7..3910fc186 100644 --- a/docs/running/notebooks/04_retrieving_past_results.ipynb +++ b/docs/running/notebooks/04_retrieving_past_results.ipynb @@ -10,17 +10,6 @@ "In this tutorial, we will run two programs and then retrieve the results of each program using the job IDs and the serverless client." ] }, - { - "cell_type": "code", - "execution_count": 1, - "id": "81dd7807-7180-4b87-bbf9-832b7cf29d69", - "metadata": {}, - "outputs": [], - "source": [ - "from quantum_serverless import QuantumServerless, Provider\n", - "import os" - ] - }, { "cell_type": "markdown", "id": "37322958-a029-46bb-bc46-82b7ded329b5", @@ -31,11 +20,15 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "acdec789-4967-48ee-8f6c-8d2b0ff57e91", "metadata": {}, - "outputs": [], + "outputs": [ + ], "source": [ + "from quantum_serverless import QuantumServerless, Provider\n", + "import os\n", + "\n", "provider = Provider(\n", " username=os.environ.get(\"GATEWAY_USER\", \"user\"),\n", " password=os.environ.get(\"GATEWAY_PASSWORD\", \"password123\"),\n", @@ -56,7 +49,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "d51df836-3f22-467c-b637-5803145d5d8a", "metadata": {}, "outputs": [], @@ -88,7 +81,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "f621f786-6ba7-4ef1-8121-741f21f70233", "metadata": {}, "outputs": [], @@ -107,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "cc7ccea6-bbae-4184-ba7f-67b6c20a0b0b", "metadata": {}, "outputs": [ @@ -117,7 +110,7 @@ "'[{\"0\": 0.4999999999999999, \"3\": 0.4999999999999999}]'" ] }, - "execution_count": 5, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -137,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "1dc78690-f61a-4dfe-bc0e-7007cf561a5b", "metadata": {}, "outputs": [], @@ -156,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "ca1cbfee-df32-4306-988f-ef0fa31605ee", "metadata": {}, "outputs": [ @@ -184,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "5e39caf1-1506-44de-9fbc-248e106be6b5", "metadata": {}, "outputs": [ @@ -192,9 +185,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Job 1 logs: OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k\n", - "OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k\n", - "Running program 1...\n", + "Job 1 logs: Running program 1...\n", "Completed running program 1.\n", "\n" ] @@ -209,24 +200,24 @@ "id": "15983446-497e-487b-b92d-5c5096f911d7", "metadata": {}, "source": [ - "To get list of all previously executed program, use `.get_jobs()` method of `QuantumServerless` object. \n", - "`get_jobs` method accepts 2 optional parameters `limit` and `offset` to control size of results returned." + "To get a list of all previously executed programs, use the `.get_jobs()` method of the `QuantumServerless` object. \n", + "The `get_jobs` method accepts 2 optional parameters, `limit` and `offset`, which control the size of returned results." ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 8, "id": "53f63569-3b80-4ebe-a181-1aa5b3537a7f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[,\n", - " ]" + "[,\n", + " ]" ] }, - "execution_count": 12, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -252,7 +243,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.9.13" } }, "nbformat": 4,