PennyLane Plugin for Quantum Inspire
Project description
The PennyLane-QuantumInspire plugin integrates the Quantum Inspire quantum computing backends with PennyLane’s quantum machine learning capabilities.
PennyLane is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations.
Quantum Inspire is a platform for quantum computing developed by QuTech.
This plugin relies heavily on the software development kit (SDK) for the Quantum Inspire platform and the PennyLane-Qiskit Plugin for Qiskit.
Qiskit is an open-source framework for quantum computing.
The Quantum Inspire device is build on top of the Qiskit device. The Quantum Inspire SDK registers a Quantum Inspire backend to Qiskit to run the algorithms on. This way we combine the strengths and ease of use of the Qiskit plugin with the computing power of Quantum Inspire backends.
Features
Grants access to Quantum Inspire’s cloud quantum emulators and hardware backends.
Emulator backends:
"QX single-node simulator" - Quantum Inspire emulator run on a commodity cloud-based server, with 4GB RAM. It has a fast turn-around time for simulations up to 26 qubits. For basic users, the commodity cloud-based server will be sufficient.
"QX-34-L" - Quantum Inspire emulator runs on the Lisa cluster computer uses four nodes of the fat_soil_shared partition of Lisa. With 1.5TB of memory each, this allows simulation jobs of up to 34 qubits [requires advanced account].
Hardware backends:
"Spin-2" - Quantum Inspire quantum 2-qubit semiconductor electron spin processor.
"Starmon-5" - Quantum Inspire quantum 5-qubit superconductor Transmon processor.
Installation
This plugin requires Python version 3.8 and above, as well as PennyLane-Qiskit. Installation of the dependencies can be done using pip:
pip install pennylane-quantuminspire
To ensure your device is working as expected, you can also install the development version from source by cloning this repository and running a pip install command in the root directory of the repository:
git clone https://github.com/QuTech-Delft/pennylane-quantuminspire.git
cd pennylane-quantuminspire
pip install -e pluginpath
where pluginpath is the location of the plugin. It will then be accessible via PennyLane.
Furthermore, the plugin assumes Quantum Inspire credentials are stored on your disk in the default location. A token can be set using the following steps:
Create a Quantum Inspire account if you do not already have one.
Get an API token from the Quantum Inspire website.
With your API token run:
from quantuminspire.credentials import save_account
save_account('YOUR_API_TOKEN')
After calling save_account(), your credentials will be stored on disk. Those who do not want to save their credentials to disk should use instead:
from quantuminspire.credentials import enable_account
enable_account('YOUR_API_TOKEN')
and the token will only be active for the session.
After calling save_account() once or enable_account() within your session, token authentication is done automatically.
More information on different accounts can be found here.
Installing for generating documentation
To install the necessary packages to perform documentation activities for this plugin do:
pip install -e .[rtd]
The documentation generation process is dependent on pandoc. When you want to generate the documentation and pandoc is not yet installed on your system navigate to Pandoc and follow the instructions found there to install pandoc. To build the readthedocs documentation do:
cd doc
make html
The documentation can then be found in the ‘doc/_build/html’ directory.
Installing for running tests
Make sure to install test dependencies first:
pip install -e .[dev]
Unit tests
Run the unit tests using:
pytest tests/unit_test
or including coverage:
pytest tests/unit_test --cov=pennylane_quantuminspire --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native
Device tests
Run the device tests using:
pytest
Getting started
Once the PennyLane-QuantumInspire plugin is installed, the provided Quantum Inspire device can be accessed straight away in PennyLane.
The Quantum Inspire device can be instantiated with a QX single-node simulator backend as follows:
import pennylane as qml
dev = qml.device('quantuminspire.qi', wires=2, backend='QX single-node simulator')
This device can then be used just like other devices for the definition and evaluation of QNodes within the PennyLane framework.
Inspecting results of computations in Quantum Inspire
When a computation has run on a Quantum Inspire backend the algorithm that was executed and the results can be inspected in Quantum Inspire. When algorithms are run on a backend of the Quantum Inspire device, all the executed algorithms are contained in a single Quantum Inspire project. After logging in to the Quantum Inspire platform an overview is given of the available projects. By opening your project the backend that computed the results is displayed. Navigating to Results show the computation results for each algorithm. Also the algorithms code can be inspected here. The project name that is used by the plugin can be passed as a separate argument project to the Quantum Inspire device constructor. For example:
dev = qml.device('quantuminspire.qi', wires=4, project='My project name')
When no project name is given the project name defaults to: 'PennyLane project 2023-02-27 16:32:38', where the last parts of the project name are replaced by the current date and local time. More information about working with Quantum Inspire can be found at Quantum Inspire Quick Guide. Specific information about managing projects can be found at Managing your projects.
Support
Source Code: https://github.com/QuTech-Delft/pennylane-quantuminspire
Issue Tracker: https://github.com/QuTech-Delft/pennylane-quantuminspire/issues
Quantum Inspire: https://www.quantum-inspire.com/contact
If you are having issues, please let us know by posting the issue on our Github issue tracker. For questions about Quantum Inspire see the contact info on the Quantum Inspire website.
License
The PennyLane QuantumInspire plugin is free and open source, released under the Apache License, Version 2.0.
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
File details
Details for the file pennylane-quantuminspire-0.4.1.tar.gz
.
File metadata
- Download URL: pennylane-quantuminspire-0.4.1.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 718053e95898dd72a602736b762a91092dcec0ceafe4e9790bc7fe440063e2da |
|
MD5 | 7207f07e73a02ccad1d12116c7be104f |
|
BLAKE2b-256 | 609a0ef4318699939523c747c20b3af050dd4b31bac42d182c88921d00112163 |