From f1a5bcdc1c06f61c6612b3c988cb7b881f4f049e Mon Sep 17 00:00:00 2001 From: Cheng Xing Date: Sat, 2 Apr 2022 00:58:52 +0000 Subject: [PATCH] Minor cleanup of QCS tutorial --- docs/tutorials/google/start.ipynb | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/docs/tutorials/google/start.ipynb b/docs/tutorials/google/start.ipynb index b5144d0d8de..0fb35409547 100644 --- a/docs/tutorials/google/start.ipynb +++ b/docs/tutorials/google/start.ipynb @@ -98,10 +98,13 @@ "source": [ "try:\n", " import cirq\n", + " import cirq_google as cg\n", "except ImportError:\n", " print(\"installing cirq-google...\")\n", " !pip install --quiet cirq-google --pre\n", - " print(\"installed cirq-google.\")" + " print(\"installed cirq-google.\")\n", + " import cirq\n", + " import cirq_google as cg" ] }, { @@ -160,8 +163,6 @@ } ], "source": [ - "import cirq_google as cg\n", - "\n", "# The Google Cloud Project id to use.\n", "project_id = \"\" #@param {type:\"string\"}\n", "processor_id = \"pacific\" #@param {type:\"string\"}\n", @@ -191,7 +192,7 @@ }, "source": [ "## Create a circuit\n", - "Now that you've enabled Quantum Computing Service and configured the notebook, let's create a basic program with Cirq. After reviewing the code, **run this block** to run a circuit, and print a circuit diagram and results. To learn more, refer to the [Intro to Cirq](../basics.ipynb) and [Cirq documentation](https://cirq.readthedocs.io)." + "Now that you've enabled Quantum Computing Service and configured the notebook, let's create a basic program with Cirq. After reviewing the code, **run this block** to run a circuit, and print a circuit diagram and results. To learn more, refer to the [Cirq overview](https://quantumai.google/cirq) and [Cirq basics](../basics.ipynb) pages." ] }, { @@ -212,9 +213,6 @@ } ], "source": [ - "import cirq\n", - "import cirq_google as cg\n", - "\n", "# Define a qubit at an arbitrary grid location.\n", "qubit = cirq.GridQubit(0, 0)\n", "\n", @@ -272,7 +270,7 @@ }, "source": [ "## Run on quantum hardware\n", - "Approved users can access quantum hardware in two modes. First, all approved users have access to a processor in \"open-swim\" which is a first-in-first-out queue with fairness algorithm that balances jobs across users in the queue. Secondly, processors can be reserved in hourly blocks if the user is approved. You can learn more about the reservation system on the [concepts page](../../google/engine.md). We'll use the processor `pacific` in this demo." + "Approved users can access quantum hardware in two modes. First, all approved users have access to a processor in \"open-swim\" which is a first-in-first-out queue with fairness algorithm that balances jobs across users in the queue. Secondly, processors can be reserved in hourly blocks if the user is approved. You can learn more about the reservation system on the [concepts page](../../google/concepts.ipynb). We'll use the processor `pacific` in this demo." ] }, { @@ -462,23 +460,17 @@ "\n", "If you are planning to access Quantum Computing Service from the command line, follow these instructions to get started. If you plan on executing all of your programs from an ipython notebook, you can skip this section.\n", "\n", - "We assume that your local machine is configured to run Python 3.6 or greater. \n", + "### Setup Cirq\n", "\n", - "Instructions for installing Python 3:\n", + "Follow the [Cirq Install](../../install.md) page to install Cirq locally. We highly recommend that you setup a virtual environment for this installation to isolate your development stack from your overall system installations. Make sure to setup the virtual environment for Python 3 and not Python 2.\n", "\n", - "* Linux: https://docs.python-guide.org/starting/install3/linux/\n", - "* Mac: https://docs.python-guide.org/starting/install3/osx/\n", - "* Windows: If you are using Windows Subsystem for Linux: https://docs.python-guide.org/starting/install3/linux/, otherwise: https://docs.python-guide.org/starting/install3/win/\n", + "### Setup Google Cloud authentication\n", "\n", - "### Setup authentication\n", - "\n", - "In this quickstart we will authenticate using the gcloud command line cool. To do this, one must first install gcloud. Follow the instructions for this at https://cloud.google.com/sdk/install. If you are running on a corp desktop, gcloud should be installed. We will authenticate using Application Default Credentials. To do this simply run the following on your shell command line\n", + "In this quickstart we will authenticate using the gcloud command line cool. To do this, one must first install gcloud. Follow the instructions for this at https://cloud.google.com/sdk/install. We will authenticate using Application Default Credentials. To do this simply run the following on your shell command line\n", "\n", "`gcloud auth application-default login`\n", "\n", - "This will open up a browser window or give you a link to a webpage you can navigate to in order to go through an authentication flow. Complete this using your @google.com account. After this command is run, credentials will be stored on your local machine. If at any point you want to revoke these credentials you can run `gcloud auth application-default revoke`\n", - "\n", - "We highly recommend that you setup a virtual environment for this installation to isolate your development stack from your overall system installations. Instructions for virtual environments are at https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/. Make sure to setup the virtual environment for Python 3 and not Python 2." + "This will open up a browser window or give you a link to a webpage you can navigate to in order to go through an authentication flow. Complete this using your Google account. After this command is run, credentials will be stored on your local machine. If at any point you want to revoke these credentials you can run `gcloud auth application-default revoke`." ] }, {