105 lines
4.5 KiB
Plaintext
105 lines
4.5 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "255dc213-977b-46de-86f4-3bab0a005340",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Dynamic repetition rate execution"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "6e5f6e09-ed60-4b74-a2fd-72da40d8645e",
|
|
"metadata": {
|
|
"tags": [
|
|
"version-info"
|
|
]
|
|
},
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "abdfb100-5321-41d7-8aee-117062aed595",
|
|
"metadata": {},
|
|
"source": [
|
|
"When a circuit is executed on an IBM® quantum processing unit (QPU), an implicit reset is typically inserted at the beginning of the circuit to ensure the qubits are initialized to zero. However, the reset process is not perfect, leading to state preparation errors. To alleviate the error, the system also inserts repetition delay time (or `rep_delay`) between circuits. Each backend has a different default `rep_delay`, but it's usually longer than T1 to allow the environment to reset the qubits. The default `rep_delay` can be queried by running `backend.default_rep_delay`.\n",
|
|
"\n",
|
|
"All IBM QPUs use dynamic repetition rate execution, which allows you to change the `rep_delay` for each job. Circuits you submit in a primitive job are batched together for execution on the QPU. These circuits are executed by iterating over the circuits for each shot requested; the execution is column-wise over a matrix of circuits and shots, as illustrated in the following figure.\n",
|
|
"\n",
|
|
"\n",
|
|
"\n",
|
|
"\n",
|
|
"Because `rep_delay` is inserted between circuits, each shot of the execution encounters this delay. Therefore, lowering the `rep_delay` decreases the total QPU execution time, but at the expense of increased state preparation error rate, as can be seen in the following image:\n",
|
|
"\n",
|
|
"\n",
|
|
"\n",
|
|
"\n",
|
|
"Note that while circuits in a primitive job are batched together for QPU execution, there is no guarantee on the order the circuits from PUBs are executed. Thus, even though you submit `pubs=[pub1, pub2]`, there is no guarantee the circuits from `pub1` will run before those from `pub2`. There is also no guarantee that circuits from the same job would run as a single batch on the QPU.\n",
|
|
"\n",
|
|
"## Specify rep_delay for a primitive job"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "aca7f18c-ee37-4f6f-a6a2-fe389459bb9b",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2 as Sampler\n",
|
|
"\n",
|
|
"service = QiskitRuntimeService()\n",
|
|
"\n",
|
|
"# Make sure your backend supports it\n",
|
|
"backend = service.least_busy(\n",
|
|
" operational=True, min_num_qubits=100, dynamic_reprate_enabled=True\n",
|
|
")\n",
|
|
"\n",
|
|
"# Determine the allowable range\n",
|
|
"backend.rep_delay_range\n",
|
|
"sampler = Sampler(mode=backend)\n",
|
|
"\n",
|
|
"# Specify a value in the supported range\n",
|
|
"sampler.options.execution.rep_delay = 0.0005"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "53c33092-8d59-4422-b438-1331afbacf17",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Next steps\n",
|
|
"\n",
|
|
"<Admonition type=\"tip\" title=\"Recommendations\">\n",
|
|
" - Try an example in the [Quantum approximate optimization algorithm (QAOA)](https://learning.quantum.ibm.com/tutorial/quantum-approximate-optimization-algorithm) tutorial.\n",
|
|
" - Review how to [get started with primitives.](./get-started-with-primitives)\n",
|
|
"</Admonition>"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"description": "Explanatory content about dynamic repetition rate execution",
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3"
|
|
},
|
|
"title": "Dynamic repetition rate execution"
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|