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.

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

This diagram illustrates jobs submitted in a batch.  It shows five jobs, numbered 0 through 4, in a queue. The jobs are a mix of Estimator and Sampler.
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(, observables=obs_set))

For a full example, see the following tutorials:

Next steps

Was this page helpful?