Skip to main content

A Pennylane-compatible package to run pennylane circuits on Scaleway Quantum as a Service

Project description

Pennylane Logo × Scaleway Logo

Pennylane devices running on Scaleway's Quantum-as-a-Service

Pennylane is an open-source framework for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations.

Pennylane-Scaleway is a Python package to run pennylane's QML circuits on Scaleway infrastructure, providing access to:

  • Aer state vector and tensor network multi-GPU emulators
  • AQT trapped-ions quantum computers
  • Coming Soon! - IQM superconducting quantum computers

More info on the Quantum service web page.

Installation

Prerequisites

Get your project-id as well as secret-key credentials from your Scaleway account. You can create and find them in the Scaleway console. Here how to create an API key.

For more information about the device you want to use, its pricing and capabilities, you can visit this page. Use the backend parameter to select the device you want to use (for instance backend="EMU-IBEX-12PQ-L4" if you want to try AQT emulation using a L4 GPU).

Supported device names

The following device names are supported:

  • scaleway.aer - Aer emulation, offers flexibility, noiseless by default but can handle given Aer's noise models, large choice of backends.
  • scaleway.aqt - AQT (Alpine Quantum Technologies), noisy trapped-ions based quantum computers.
  • scaleway.iqm - Coming soon IQM, superconducting quantum computers.

Install the package

We encourage installing Scaleway provider via pip:

pip install pennylane-scaleway

Getting started

To run your pennylane's circuits on Scaleway's quantum backends, simply change your device's name and add your project_id and secret_key (OR set the environment variables SCW_PROJECT_ID and SCW_SECRET_KEY):

import pennylane as qml # No need to import pennylane-scaleway as long as it is installed in your current environment.

device = qml.device("scaleway.aer",
        wires=2,
        project_id=<your-project-id>,   # Or set SCW_PROJECT_ID environment variable
        secret_key=<your-secret-key>,   # Or set SCW_SECRET_KEY environment variable
        backend="EMU-AER-16C-128M"
    )

@qml.set_shots(512)
@qml.qnode(device)
def my_circuit():
    qml.Hadamard(wires=0)
    qml.CNOT(wires=[0, 1])
    return qml.counts()

print(my_circuit())

device.stop() # Don't forget to close the session when you're done!

You can also use the device as a context manager so your session is automatically closed when exiting the context:

import pennylane as qml

with qml.device("scaleway.aqt",
    project_id=<your-project-id>,
    secret_key=<your-secret-key>,
    backend="EMU-IBEX-12PQ-L4",
) as dev:

    @qml.set_shots(512)
    @qml.qnode(dev)
    def circuit():
        qml.Hadamard(wires=0)
        qml.CNOT(wires=[0, 1])
        return qml.counts()

    print(circuit())

Friendly reminder to avoid writing your credentials directly in your code. Use environment variables instead, load from a .env file or any secret management technique of your choice.

Session management

A QPU session is automatically created when you instantiate a device. You can manage it manually by calling device.start() and device.stop(), but it is recommended to use the context manager approach instead. You may also attach to an existing session, handle maximum session duration and idle duration by setting these as keyword arguments when instantiating the device. For example:

import pennylane as qml

with qml.device("scaleway.aer",
    wires=2,
    project_id=<your-project-id>,
    secret_key=<your-secret-key>,
    backend="EMU-AER-16C-128M",
    max_duration="1h",
    max_idle_duration="5m"
) as dev:
...

You can visualize your sessions on the Scaleway Console under the Labs/Quantum section.

Documentation

Documentation is available at Scaleway Docs.

You can find examples under the examples folder of this repository.

Development

This repository is in a very early stage and is still in active development. If you are looking for a way to contribute please read CONTRIBUTING.md.

Reach us

We love feedback. Feel free to reach us on Scaleway Slack community, we are waiting for you on #opensource..

License

License Apache 2.0

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_scaleway-0.2.4.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pennylane_scaleway-0.2.4-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file pennylane_scaleway-0.2.4.tar.gz.

File metadata

  • Download URL: pennylane_scaleway-0.2.4.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pennylane_scaleway-0.2.4.tar.gz
Algorithm Hash digest
SHA256 b6b1a7fd7462f55b079eef5d4f95e9e10ad8da0715405d92baabb01a9995679d
MD5 b6f28cafbafa0405d6654aa01c777a45
BLAKE2b-256 1950e5d2e802066748095b2c094c87c1bb65e521d8d8d40fa701d5481467466b

See more details on using hashes here.

File details

Details for the file pennylane_scaleway-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pennylane_scaleway-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 852bd6a78d9458df7881b224c53cb6885386332dcec8fd65887878d8109729a8
MD5 fd9191a5bbb84cebd8172373eef0c12a
BLAKE2b-256 d8218660e4f8a4eb842cd3fed31b41b041860707f88e1e5febf2ed96bbc0dfbc

See more details on using hashes here.

Supported by

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