Skip to content

Results are limited to the current section: Cloud services

Product news

Run your first job

As mentioned in the Pasqal Tools overview you will use PasqalCloudConnection to send a job to Pasqal’s hardware.

The pasqal-cloud package can be installed using pip with

pip install pasqal-cloud

The package main component is a Python object called PasqalCloudConnection which can be used to submit jobs for execution.

You can send one or several jobs for execution to Pasqal’s cloud using:

  • the email and password combination you used to sign-up
  • the ID of the project you are a member of

Import PasqalCloudConnection and initialize it with your credentials, as shown below. You will be automatically prompted to enter your password.

from pasqal_cloud import PasqalCloudConnection
project_id = "your_project_id" # Replace this value by your project_id on the Pasqal platform.
username = "your_username" # Replace this value by your username or email on the Pasqal platform.
# Initialize the connection
connection = PasqalCloudConnection(username=username, project_id=project_id)

batch is a group of jobs with the same sequence that will run on the same backend. See the Advanced Usage section to learn more about how to use batches to optimize the scheduling of your jobs.

A sequence is the central object in Pulser and it consists essentially of a series of pulses. A sequence can be “parametrized” if you define variables inside it.

See the page Understand your sequence for more information on the sequence object.

Let’s see an example of the creation of a simple sequence with a single variable and its serialization to a string:

from pulser import Pulse, Register, Sequence
from pulser.devices import DigitalAnalogDevice
# Define a register for your sequence
register = Register.square(2, spacing=5, prefix="q")
# Create a sequence for that register
sequence = Sequence(register, DigitalAnalogDevice)
# Add a channel to your sequence
sequence.declare_channel("rydberg", "rydberg_global")
# Declare a variable
omega_max = sequence.declare_variable("omega_max")
# Add a pulse to that channel with the amplitude omega_max
generic_pulse = Pulse.ConstantPulse(100, omega_max, 2, 0.0)
sequence.add(generic_pulse, "rydberg")

Send your first batch with the PasqalCloudConnection through the Cloud

Section titled “Send your first batch with the PasqalCloudConnection through the Cloud”

Now that we are authenticated the connection and we have created a sequence, let’s send a batch of jobs for execution on one of our emulators.

To create a job, you need to define:

  • a number of runs. This sets the number of time the sequence will be run on the backend and the final state measured.
  • a value for each variable of the sequence, if any.

We are now ready to create our first batch with the PasqalCloudConnection:

from pasqal_cloud import PasqalCloudConnection, RemoteEmuFreeBackend
project_id = "your_project_id" # Replace this value by your project_id on the Pasqal platform.
username = "your_username" # Replace this value by your username or email on the Pasqal platform.
# Initialize the connection
# This will open a prompt to enter your password
connection = PasqalCloudConnection(username=username, project_id=project_id)
# When creating a job, select a number of runs and set the desired values for the variables
# defined in the sequence
job1 = {"runs": 20, "variables": {"omega_max": 6}}
job2 = {"runs": 50, "variables": {"omega_max": 10.5}}
# Send your batch on an emulator using a RemoteEmulatorBackend
# For a basic single-threaded QPU emulator that can go up to 12 qubits, you can use RemoteEmuFreeBackend
backend = RemoteEmuFreeBackend(sequence=sequence, connection=connection)
results = backend.run(job_params=[job1, job2], wait=True)
# Once the backend has returned the results, you can access them with the following:
for job_id, result in results.get_available_results().items():
print(f"job-id: {job_id}, result: {result}")

Once your script exits successfully, you can follow the status of your batch and its jobs during their life-cycle, cancel them or download their results directly in the User portal (external) .

Congrats! You just ran your first job on one of our backends (Emulators) through Pasqal’s Cloud platform 😃.

Once your jobs have been executed, each result includes key information to help you analyze the output.

This is an output example of printed results, more detail can be found in dedicated Results pulser documentation.

print(result.final_bitstrings)
{"0001": 100, "0101": 120, "1100": 90, "0011": 110, "1101": 95, "1001": 102}

You can inspect results directly in the User portal (external) :

  • Navigate to your batch then job
  • Check bitstring outputs and shot count by using the built-in histogram view

Screenshot of the bitstrings outputs in the cloud portal

Last updated: