Skip to main content

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.

interaction_diagram

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pennylane_snowflurry-0.4.3.tar.gz (518.7 kB view details)

Uploaded Source

Built Distribution

pennylane_snowflurry-0.4.3-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file pennylane_snowflurry-0.4.3.tar.gz.

File metadata

  • Download URL: pennylane_snowflurry-0.4.3.tar.gz
  • Upload date:
  • Size: 518.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pennylane_snowflurry-0.4.3.tar.gz
Algorithm Hash digest
SHA256 aa8117234f6ea6db88fb1c6c212b6cde071a9fd0a9ffa220e0f4053456d777d8
MD5 6195ff9487e083b5907d62d70d2a7f90
BLAKE2b-256 726b2b336cd597eb4e5e81cc223bcaa005ac270ba350e1081ab93bba366c71e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_snowflurry-0.4.3.tar.gz:

Publisher: python-publish.yml on calculquebec/pennylane-snowflurry

Attestations:

File details

Details for the file pennylane_snowflurry-0.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pennylane_snowflurry-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ac6205f3e0c854beff89450327f07e95cffa7f0ba72e262ebc768fa0cd78b9ca
MD5 c1af019be39dc8d266682622a2614947
BLAKE2b-256 a441b430232e1b1183b357a4eb1432e4143de642902831a0c3b4c167e20fe1e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_snowflurry-0.4.3-py3-none-any.whl:

Publisher: python-publish.yml on calculquebec/pennylane-snowflurry

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page