Open GeorgDaniel opened 1 year ago
In pending until issues with higher prio have been resolved
Rigetti is only implemented in a very experimental stage - Needs further Clarification to determine further actions regarding the Pilot.
Rigetti Pilot has been surrounded by Experimental Environment variables. Need to be specifically activated.
Problem Statement
Depends on: #1 #10
As a user, I want to use the pyQuil Framework. pyQuil needs a QVM, which need to be run somewhere.
References
https://pyquil-docs.rigetti.com/en/stable/
You can copy this jupyter notebook to have a quick overview how it works
Click to expand
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "#### Installation\n", "\n", "- Install pyquil with pip install pyquil\n", "- Install the Forest SDK https://qcs.rigetti.com/sdk-downloads\n", "\n", "Start qvm -S\n", "Start quilc -S\n", "\n", "Requests will be sent to the local simulators which are running under:\n", "\n", "localhost:5000\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from pyquil import Program, get_qc\n", "from pyquil.gates import *" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# construct a Bell State program\n", "p = Program(H(0), CNOT(0, 1))" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "DECLARE result BIT[3]\n", "CNOT 0 2\n", "CNOT 2 0\n", "CNOT 0 2\n", "RX(pi/2) 2\n", "MEASURE 0 result[0]\n", "MEASURE 1 result[1]\n", "MEASURE 2 result[2]\n", "\n" ] } ], "source": [ "from pyquil import Program\n", "from pyquil.gates import *\n", "from math import pi\n", "\n", "p = Program()\n", "ro = p.declare('result', 'BIT', 3)\n", "# p += H(0)\n", "p += CNOT(0,2)\n", "p += CNOT(2,0)\n", "p += CNOT(0,2)\n", "p += RX(pi/2, 2)\n", "p += MEASURE(0, ro[0])\n", "p += MEASURE(1, ro[1])\n", "p += MEASURE(2, ro[2])\n", "\n", "print(p)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 48, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[0 0 1]]\n", "[[0 0 0]]\n", "[[0 0 1]]\n", "[[0 0 1]]\n", "[[0 0 0]]\n", "[[0 0 1]]\n", "[[0 0 1]]\n", "[[0 0 0]]\n", "[[0 0 1]]\n", "[[0 0 1]]\n" ] } ], "source": [ "from pyquil import get_qc\n", "\n", "# the number before q defines the number of qubits\n", "\n", "qc = get_qc('3q-qvm')\n", "executable = qc.compile(p)\n", "for i in range(10):\n", " result = qc.run(executable)\n", " #print(result)\n", " bitstrings = result.readout_data.get('result')\n", " print(bitstrings)" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "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.0" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }Expected Behavior
The pyQuil code (Quil specific definition) or QASM is submitted In-Request and the Rigetti Pilot should be able to execute it on a QVM.
Tasks
Notes
As the environment is different from just using the SDK calls, a architecture sketch with the communication and the components could be useful.