PennyLane plugin for interfacing with Anyon's quantum computers
Project description
pennylane-snowflurry
The PennyLane-Snowflurry plugin provides a PennyLane device that allows the use of Anyon Systems' Snowflurry quantum computing platform with PennyLane.
Pennylane is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations.
Snowflurry is a quantum computing framework developed in Julia by Anyon Systems and aims to provide access to quantum hardware and simulators.
PennyLane-Snowflurry makes use of dependencies such as PyJulia and PyCall to allow interfacing between Python and Julia, and thus between PennyLane and Snowflurry.
Project structure
As shown in the diagram below, this plugin is used in Pennylane as a device named snowflurry.qubit
. This device is defined by the class SnowflurryQubitDevice
. It converts a PennyLane circuit into a Snowflurry circuit, thanks to packages like PyJulia that allow the communication between Python and Julia environments. The Snowflurry circuit can then be used with the available backends, either a simulator or real quantum hardware. The results are then converted back into PennyLane's format and returned to the user.
Local installation
Since this plugin interfaces between Python and Julia, it requires both languages to be installed on your machine. As Python is widely used amongst the quantum computing community, we assume you already have it installed. The rest of this section will guide you through the installation of Julia and the plugin.
Julia
If you don't have Julia installed, you can download it from the official website.
PennyLane and Snowflurry
Before installing this plugin, makes sure you have a working Pennylane and Snowflurry installation.
For PennyLane, please refer to the PennyLane documentation.
For Snowflurry, please refer to the Snowflurry documentation.
Plugin installation
This plugin is available on PyPI, so you can install it with pip:
pip install pennylane-snowflurry
Alternatively, you can clone this repo and install the plugin with the following command from the root of the repo:
pip install -e .
PyJulia and PyCall
PyJulia and PyCall are used to communicate between Python and Julia. At this point, PyJulia should already be installed with the plugin as it is listed in the dependencies, but you'll need to install PyCall in your Julia environment. To do so open a python terminal and execute the following commands:
import julia
julia.install()
Alternatively, you could also install PyCall from the Julia REPL, but the previous method makes sure to build the package for your current python environment.
using Pkg
Pkg.add("PyCall")
Running files and tests
For now, the plugin is only tested on python scripts and doesn't work in a Juptyer notebook. To run a file, you can use the following command:
python-jl -m tests.test_pyjulia-snowflurry -v
Usage
Once installed, you can write your PennyLane circuits as usual, but you'll need to specify the device as snowflurry.qubit
and provide the Snowflurry backend you want to use if you have access to a quantum computer.
dev_def = qml.device("snowflurry.qubit", wires=1, shots=50)
Example if you have an API key from Anyon Systems:
dev_def = qml.device("snowflurry.qubit", wires=1, shots=50, host="example.anyonsys.com", user="test_user",access_token="not_a_real_access_token")
State of the project and known issues
This plugin is still very early in its development and aims to provide a basic interface between PennyLane and Snowflurry, which are both also under active development. As such, it is expected that there will be issues and limitations.
It is necessary to use the python-jl
command to execute files, as it essentially launches Python from within Julia. This is necessary for the use of Julia packages such as Snowflurry.
For the sake of simplicity, a workaround it being researched to allow the use of the plugin in a Jupyter notebook and to allow debugging in an IDE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pennylane_snowflurry-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2469dec63d62fda6cacbb11ac93add05a5f36cacf7f396bbc169d2434653a9cd |
|
MD5 | a13d90644c1d87838a5aa4dac854ea45 |
|
BLAKE2b-256 | 83f5196c62afaa987a9b38adff995ea7b061e9f7dd0acc442e254f404444ad3d |
Hashes for pennylane_snowflurry-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14b8e4a3e110a3ee0c58c5887aec63f8ab335e4383aa51da2101e4181e3064fd |
|
MD5 | d95073d0bc95202f3c80483d31559348 |
|
BLAKE2b-256 | 0126b176f9880c280f05632215ddfc317f168edf527252b0e7af7fe2bb18a553 |