Skip to main contentIBM Quantum Documentation

Run jobs in a batch

Batch mode can shorten processing time if all jobs can be provided at the outset. If you want to submit iterative jobs, use sessions instead. Using batch mode has these benefits:

  • The jobs' classical computation, such as compilation, is run in parallel. Thus, running multiple jobs in a batch is significantly faster than running them serially.
  • There is no delay between job, which can help avoid drift.
Note

When batching, jobs are not guaranteed to run in the order they are submitted.

Batch execution diagram.
Figure 1: Batch execution

The following example shows how you can divide up a long list of circuits into multiple jobs and run them as a batch to take advantage of the parallel processing.

jobs = []
with Batch(backend) as batch:
    estimator = Estimator(batch)
    # calls within this context are part of the batch.
    for obs_set in observable_sets:
        jobs.append(estimator.run(circuits, observables=obs_set))

For a full example, see the following tutorials:


Next steps

Was this page helpful?