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.
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.
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.
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
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.
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.
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
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")
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.
- 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.