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 like PythonCall and JuliaCall 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 JuliaCall 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 with a package manager like pip.
Note that to use Calcul Québec's services, you may not need to install the plugin locally as our users might have access to a pre-configured environment.
Plugin installation
Pennylane-snowflurry can be installed using 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 .
Pennylane and other Python dependencies will be installed automatically during the installation process.
The plugin will also take care of installing Julia and the required Julia packages, such as Snowflurry and PythonCall during the first run. Some notes on that matter are provided below.
If you wish to disable this behaviour, you can edit the julia_env.py file and set the value of the variable IS_USER_CONFIGURED
to TRUE
:
IS_USER_CONFIGURED = True
Julia
As of version 0.3.0, there is no need to install Julia manually, since the plugin will download and install the required version automatically upon first use. This Julia environment is bound to the plugin.
However, if you wish to manage your Julia environment, you can download it from the official website. It is highly recommended to install using the installer file, as it will ask to add Julia to the system's environment variables.
To ensure this correct configuration, during the installation process, the checkbox Add Julia to PATH
must be checked.
PennyLane and Snowflurry
Those packages are installed automatically during the plugin installation process and are necessary for the plugin to work. Here are the links to their respective documentation:
For PennyLane, please refer to the PennyLane documentation.
For Snowflurry, please refer to the Snowflurry documentation.
Usage
Running files
The plugin can be used both in python scripts and Jupyter notebooks. To run a script, you can use the following command:
python base_circuit.py
How to call the device
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", realm="realm_name")
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.
Future plans
- Add a test suite to ensure the plugin works as expected.
- Integrate a compiler to optimize the circuits.
- Add device that allows for communication with MonarQ directly through its API.
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.4.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 922bf7a5c991b85976d8e755af01793c13af2dd7a0608adcaa45df06d620f030 |
|
MD5 | 86f5b8329ec7a1c117243f037b0a6734 |
|
BLAKE2b-256 | 9d17ea5e7a5484557a09266cb5571c221c3135560ed837575041825aea57aa92 |
Hashes for pennylane_snowflurry-0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcdbfd7d1363e592838a78497ae85d5c8aa0671cd01da0c261fdd50805cf39cc |
|
MD5 | 218847c64596bdcc3ec7b37c3e003955 |
|
BLAKE2b-256 | 09040ad3ffd429547a26477da52d86a3a7c5d87ce0ec7601df4518c9e3dcd076 |