providers

Quandela

Quandela is Perceval default Cloud provider. If no session is created, Quandela Cloud endpoints will be used.

When using Quandela Cloud, you have the same capabilities with and without using a session. It’s a matter of code style.

class perceval.providers.quandela.quandela_session.Session(platform_name, token, url=None)

Quandela Cloud session

Parameters:
  • platform_name (str) – Name of an available platform on Quandela Cloud (e.g. “sim:slos”)

  • token (str) – A valid authentication token to use within the session

  • url (Optional[str]) – URL prefix for the endpoint to connect to. If omitted the Quandela Cloud endpoints will be used.

build_remote_processor()

Build a remote processor from the session information

Return type:

RemoteProcessor

Scaleway

Scaleway is a French cloud provider that provides, among a range of offers, binary power to emulate quantum computing compatible with Perceval.

This Scaleway Quantum as a Service (QaaS) leverages from GPUs like Nvidia P100 and H100 to increase mode limit and accelerate simulations.

You can find prices and additional information on the Scaleway Labs QaaS page.

Scaleway authentication

To use Scaleway QaaS as a provider you need a Scaleway account, a Scaleway Project ID and an API key.

  1. Create a Scaleway account

  2. Create a Scaleway Project

  3. Create a Scaleway API key

ScalewaySession

class perceval.providers.scaleway.Session(platform_name, project_id, token, max_idle_duration_s=1200, max_duration_s=3600, deduplication_id=None, url=None, proxies=None, provider_name=None)

Scaleway session used to keep a connexion opened with Scaleway Cloud for the duration of a Python scope.

Parameters:
  • platform_name (str) – platform on which circuits will be executed

  • project_id (str) – UUID of the Scaleway Project the session is attached to

  • token (str) – authentication token required to access the Scaleway API

  • deduplication_id (Optional[str]) – optional value, name mapping to a unique running session, allowing to share an alive session among multiple users

  • max_idle_duration_s (int) – optional value, duration in seconds that can elapsed without activity before the session terminates

  • max_duration_s (int) – optional value, duration in seconds for a session before it automatically terminates

  • url (Optional[str]) – optional value, endpoint URL of the API

  • proxies (Optional[dict[str, str]]) – optional value, dictionary mapping protocol to the URL of the proxy

build_remote_processor()

Build a RemoteProcessor object given the session data

Return type:

RemoteProcessor

start()

Start session

Return type:

None

stop()

Stop session

Return type:

None

Using a Scaleway session

Let’s see step by step how to instantiate and use a Scaleway session.

Import the library and Scaleway from the providers library:

>>> import perceval as pcvl
>>> import perceval.providers.scaleway as scw

Provide your Scaleway Project ID and API key:

>>> PROJECT_ID = "your-scaleway-project-id"
>>> TOKEN = "your-scaleway-api-key"

Choose one of the Perceval compatible platforms provided by Scaleway:

>>> PLATFORM_NAME = "sim:sampling:h100"

You can now create a Scaleway session:

>>> session = scw.Session(platform=PLATFORM_NAME, project_id=PROJECT_ID, token=TOKEN)
>>> session.start()
>>> /*
...  * Session scope
...  */
>>> session.stop()

You can also create a Scaleway session using a with block:

>>> with scw.Session(platform=PLATFORM_NAME, project_id=PROJECT_ID, token=TOKEN) as session:
...     #
...     # Session scope
...     #

Note: using a with block you do not need to start and stop your session: it starts automatically at the beginning of the block and stops automatically at its end.

Note

while using a Jupyter Notebook for convenience python objects are kept alive and we recommend using directly start and stop methods.

Using an existing Scaleway QPU session

If you created your session from the Scaleway console, you can retrieve it from Perceval.

For this, you only have to go to your session’s settings on the console, copy the deduplication identifier and put it to the session creation on your Perceval code.

>>> DEDUPLICATION_ID = "my-quantum-workshop-identifier"
>>> session = scw.Session(platform=PLATFORM_NAME, project_id=PROJECT_ID, token=TOKEN, deduplication_id=DEDUPLICATION_ID)

A session can be fetched until termination or timeout. If there is no alive session matching the deduplication_id, a new one will be created and returned. It is highly convenient if you wish to keep a specific amount of session alive at a time.

Send a circuit to a Scaleway QPU session

Now you are handling a session, you can instantiate a RemoteProcessor linked to the session:

>>> processor = session.build_remote_processor()

Then, we can attach a toy circuit and send it on our session

>>> processor.set_circuit(pcvl.Circuit(m=2, name="a-toy-circuit") // pcvl.BS.H())
>>> processor.with_input(pcvl.BasicState("|0,1>"))
>>> processor.min_detected_photons_filter(1)
>>> sampler = pcvl.algorithm.Sampler(processor, max_shots_per_call=10_000)
>>> job = sampler.samples(100)
>>> print(job)

Congratulation you can now design and send jobs to Scaleway QaaS through your processor. You can continue with the documentation of algorithm.