-
Notifications
You must be signed in to change notification settings - Fork 86
/
run-jobs-batch.mdx
29 lines (21 loc) · 1.59 KB
/
run-jobs-batch.mdx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
title: Run jobs in a batch
description: How to run quantum computing jobs in batch mode using Qiskit Runtime.
---
# 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](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 minimal delay between jobs, which can help avoid drift.
<Admonition type="note">
When batching, jobs are not guaranteed to run in the order they are submitted. Also, while your batch jobs will run as closely together as possible, they don't get exclusive access to the backend. Therefore, your batch jobs might run in parallel with other users' jobs if there is enough processing capacity on the system. Additionally, system calibration jobs could run between the batched jobs.
</Admonition>
![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.](/images/run/batch.png '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.
```python
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))
```