pasqal-io / pasqal-cloud

Apache License 2.0
16 stars 1 forks source link

Feature Suggestion: Batching jobs with different sequence #134

Closed ShaheenPasqal closed 2 months ago

ShaheenPasqal commented 2 months ago

Description

I'd like to suggest the introduction of a way to group jobs of different sequences but with the same "job parameters" (e.g. number of runs, Omega_max, etc.).

In machine learning training or inference scenarios, it's common to have datasets with different graphs (i.e. different register), resulting in the current API in multiple batch submissions. More precisely, one batch of one jobs per element in the dataset. This leads to cluttered views and increased complexity when trying to monitor progress.

Feature request:

Create a feature that allows users to group jobs with different sequences.

MatthieuMoreau0 commented 2 months ago

Hey Shaheen! How does each job of your batch differ? Is it only the register? Do they all derive from the same layout? If yes, you can create a single batch by defining only a mappable register for your sequence. Then for each job, you can define the traps you want to use by adding a qubits argument to the job variables. I now see we are lacking documentation for this feature.

Would that cover your use case? If so, I can send you some examples on how to do that.

In any case I'll add a ticket to our backlog to extend the documentation around batches with mappable registers.

Edit: Here is the Pulser documentation about mappable registers. For the cloud interface there is only a slight change.

# Assuming you have defined a Sequence object `seq` with a mappable register
# If you want to use traps with ids 1,2,5 for the first job and 2,4,6 for the second one
job_vars = [ {"runs": 100, "variables": {"qubits": {"q0": 1, "q1": 2, "q2": 5}},  {"runs": 100, "variables": {"qubits": {"q0": 2, "q1":4, "q2": 6}}]

sdk.create_batch(sequence, jobs=job_vars)
ShaheenPasqal commented 2 months ago

Hello Matthieu,

That is exactly my case ! Thank you for the answer and the example.

ShaheenPasqal commented 2 months ago

We can close the issue since there is a way of doing the batching of sequences that differ only by the register