Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp options page #1499

Merged
merged 69 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
7596162
rename files and update links
beckykd Jun 5, 2024
40f516b
update table
beckykd Jun 5, 2024
dbc738d
Add new sections
beckykd Jun 5, 2024
7c96520
update file names in entries.py
beckykd Jun 6, 2024
2d4c33f
change IDs to appease spell check
beckykd Jun 6, 2024
dd3679c
Update qiskit_bot.yaml
beckykd Jun 6, 2024
23b8481
update structure
beckykd Jun 6, 2024
af0b867
change order ToC
arnaucasau Jun 6, 2024
8adadc5
Merge branch 'main' into revamp-options-page
arnaucasau Jun 6, 2024
db404de
Merge branch 'main' into revamp-options-page
beckykd Jun 10, 2024
1257967
two versions
beckykd Jun 10, 2024
b6653fc
make build happy
beckykd Jun 10, 2024
34e1909
links
beckykd Jun 10, 2024
c2915fa
fix link
beckykd Jun 10, 2024
1976beb
trying something else for the br tags
beckykd Jun 10, 2024
799c7fb
fix all the br tags
beckykd Jun 10, 2024
dc6daf9
change formatting
beckykd Jun 10, 2024
06cfacf
no space
beckykd Jun 10, 2024
72b1477
estimatorV2 table
beckykd Jun 11, 2024
b96c3b5
edit
beckykd Jun 12, 2024
07a7980
Update runtime-options-overview.mdx
beckykd Jun 12, 2024
8f07ea6
spelling
beckykd Jun 12, 2024
5720489
fix link
beckykd Jun 12, 2024
5a618c0
updates from jessie
beckykd Jun 12, 2024
2b5f9cc
add more info
beckykd Jun 13, 2024
88ed741
precedence
beckykd Jun 13, 2024
330ee6c
further organization
beckykd Jun 13, 2024
7b74f8e
finish updating the table for Estimator V2
beckykd Jun 14, 2024
ac608d1
table first draft
beckykd Jun 14, 2024
2c24c70
spelling
beckykd Jun 14, 2024
6c16c7d
link to image
beckykd Jun 14, 2024
1389ce6
remove image links from table
beckykd Jun 14, 2024
e73127f
remove pasted images from table
beckykd Jun 14, 2024
361a182
no table
beckykd Jun 14, 2024
eb3e534
delete new section
beckykd Jun 14, 2024
439f5f3
Update docs/run/runtime-options-overview.mdx
beckykd Jun 25, 2024
727bc8c
Update docs/run/runtime-options-overview.mdx
beckykd Jun 25, 2024
6dbdd20
Update docs/run/runtime-options-overview.mdx
beckykd Jun 25, 2024
8f4836f
Update docs/run/runtime-options-overview.mdx
beckykd Jun 25, 2024
774ec9e
Update docs/run/runtime-options-overview.mdx
beckykd Jun 25, 2024
f3ec7e1
Review comments
beckykd Jun 25, 2024
9e0f484
more updates
beckykd Jun 25, 2024
02a68b2
ALL THE CLICKABLE TABS!!!
beckykd Jun 26, 2024
6e1ecb6
Big old table
beckykd Jun 26, 2024
fb6d1c8
add link in the table
beckykd Jun 26, 2024
bc7fcc1
add more links
beckykd Jun 26, 2024
654eac7
Version with working table
beckykd Jun 28, 2024
c36921f
clarify how to use tabs
beckykd Jun 28, 2024
95feef2
Merge branch 'main' of https://github.com/Qiskit/documentation into r…
beckykd Jun 28, 2024
b2e4b2d
address conflicts
beckykd Jun 28, 2024
9f9fa71
spelling
beckykd Jun 28, 2024
7e8ab44
spelling
beckykd Jun 28, 2024
2d34981
Delete advanced-runtime-options.mdx
beckykd Jun 28, 2024
1696dce
remove unneeded images
beckykd Jun 28, 2024
c0bd32f
Update v1 tables
beckykd Jun 28, 2024
2449a02
Merge branch 'main' of https://github.com/Qiskit/documentation into r…
beckykd Jul 2, 2024
cbea933
adding recent changes to new locations
beckykd Jul 2, 2024
c7210f4
links
beckykd Jul 2, 2024
4156e31
Don't need two tabs for V1
beckykd Jul 2, 2024
daa93ab
edits
beckykd Jul 2, 2024
43766c6
no optimization is done in V2
beckykd Jul 10, 2024
626fd4d
add more links
beckykd Jul 16, 2024
731d2ba
Merge branch 'main' into revamp-options-page
beckykd Jul 16, 2024
10dcf23
Updates
beckykd Jul 16, 2024
74f2c03
Merge branch 'revamp-options-page' of https://github.com/Qiskit/docum…
beckykd Jul 16, 2024
dc9d153
edits and new image
beckykd Jul 16, 2024
7241899
move image
beckykd Jul 16, 2024
22446a5
delete extra code
beckykd Jul 16, 2024
d4ee49e
Edis
beckykd Jul 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/api/migration-guides/qiskit-quantum-instance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ yourself two questions:
This question is not new. In the legacy algorithm workflow, you would set up a
[`qiskit.utils.QuantumInstance`](../qiskit/0.46/qiskit.utils.QuantumInstance) with either a real system from a provider, or a simulator.
For this migration, this "system selection" process is translated to **where** do you import your primitives from:

* Using **local** statevector simulators for quick prototyping: **Reference primitives**
* Using **local** noisy simulations for finer algorithm tuning: **Aer primitives**
* Accessing **runtime-enabled systems** (or cloud simulators): **Qiskit Runtime primitives**
Expand All @@ -90,7 +90,7 @@ yourself two questions:
Arguably, the `Sampler` is the closest primitive to [`qiskit.utils.QuantumInstance`](../qiskit/0.46/qiskit.utils.QuantumInstance), as they
both execute circuits and provide a result. However, with the [`qiskit.utils.QuantumInstance`](../qiskit/0.46/qiskit.utils.QuantumInstance),
the result data was system-dependent (it could be a counts `dict`, a `numpy.array` for
statevector simulations, and so on), while `Sampler` normalizes its `SamplerResult` to
statevector simulations, and so on), while `Sampler` normalizes its `SamplerResult` to
return a [`qiskit.result.QuasiDistribution`](../qiskit/qiskit.result.QuasiDistribution) object with the resulting quasi-probability distribution.

The `Estimator` provides a specific abstraction for the expectation value calculation that can replace
Expand Down Expand Up @@ -122,8 +122,8 @@ primitives expose a similar setting through their interface:
| Measurement error mitigation: `measurement_error_mitigation_cls`, `cals_matrix_refresh_period`, | No | No | Sampler default > M3 (*) | No |
| Job management: `job_callback`, `max_job_retries`, `timeout`, `wait` | Does not apply | Does not apply | Sessions, callback (**) | No |

(\*) For more information on error mitigation and setting options on Qiskit Runtime Primitives, see
[Advanced Runtime Options](../../run/advanced-runtime-options).
(\*) For more information on error mitigation and setting options on Qiskit Runtime Primitives, see the Qiskit Runtime options
[overview](../../run/runtime-options-overview).

(\*\*) For more information on Runtime sessions, see [About Sessions](../../run/sessions).

Expand Down
26 changes: 13 additions & 13 deletions docs/api/migration-guides/qiskit-runtime-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ service = QiskitRuntimeService()
# Get a backend
backend = service.least_busy(operational=True, simulator=False)

# Define Estimator
# Define Estimator
estimator = Estimator(backend)

# Run an expectation value calculation
Expand All @@ -77,10 +77,10 @@ from qiskit_ibm_runtime.fake_provider import FakeManilaV2
# Run the sampler job locally using FakeManilaV2
fake_manila = FakeManilaV2()

# You can use a fixed seed to get fixed results.
# You can use a fixed seed to get fixed results.
options = {"simulator": {"seed_simulator": 42}}

# Define Estimator
# Define Estimator
estimator = Estimator(backend=fake_manila, options=options)

# Run an expectation value calculation
Expand Down Expand Up @@ -225,7 +225,7 @@ Output
</TabItem>

<TabItem value="legacy" label="backend.run()">
The legacy workflow required additional elements and steps to compute an expectation value. The `QuantumInstance` class stored a `PassManager` and a `Backend` instance, and wrapped the conversion step to ISA circuits and `backend.run` calls. The `CircuitSampler` class from `qiskit.opflow` wrapped the `QuantumInstance` `run` and `transpile` methods. This degree of nesting is no longer supported, the new workflow allows to access and directly manipulate all the key components of the computation (backend, pass manager, circuits and observables) at all stages of the algorithm.
The legacy workflow required additional elements and steps to compute an expectation value. The `QuantumInstance` class stored a `PassManager` and a `Backend` instance, and wrapped the conversion step to ISA circuits and `backend.run` calls. The `CircuitSampler` class from `qiskit.opflow` wrapped the `QuantumInstance` `run` and `transpile` methods. This degree of nesting is no longer supported, the new workflow allows to access and directly manipulate all the key components of the computation (backend, pass manager, circuits and observables) at all stages of the algorithm.

``` python
from qiskit.opflow import StateFn, PauliExpectation, CircuitSampler
Expand Down Expand Up @@ -256,7 +256,7 @@ expectation: -1.065734058826613
</Tabs>

<span id="sampler-algorithm"></span>
## Use Sampler to design an algorithm
## Use Sampler to design an algorithm

The Sampler primitive is used to design an algorithm that samples
circuits and extracts probability distributions.
Expand Down Expand Up @@ -286,7 +286,7 @@ difference is the format of the output: `backend.run()` outputs
# Run
result = backend.run(isa_circuits)
```

</TabItem>

<TabItem value="aer" label="qiskit-aer">
Expand Down Expand Up @@ -334,10 +334,10 @@ from qiskit_ibm_runtime.fake_provider import FakeManilaV2
# Run the sampler job locally using FakeManilaV2
fake_manila = FakeManilaV2()

# You can use a fixed seed to get fixed results.
# You can use a fixed seed to get fixed results.
options = {"simulator": {"seed_simulator": 42}}

# Define Sampler
# Define Sampler
sampler = Sampler(backend=fake_manila, options=options)

# Run calculation
Expand Down Expand Up @@ -366,7 +366,7 @@ When using the `Sampler` primitive, the circuit **must contain measurements**.
<TabItem value="PrimV2" label="Runtime Sampler">
``` python
from qiskit_ibm_runtime import SamplerV2 as Sampler

# Define a local backend
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
backend = FakeManilaV2()
Expand Down Expand Up @@ -438,11 +438,11 @@ result = job.result()
# Get results for the first (and only) PUB
pub_result = result[0]

# Get counts from the classical register "meas".
# Get counts from the classical register "meas".
print(f" >> Meas output register counts: {pub_result.data.meas.get_counts()}")

>> Meas output register counts: {'0001': 210, '0010': 305, '0000': 282, '0011': 201, '0101': 2, '1010': 6, '0110': 5, '0100': 6, '1000': 3, '0111': 1, '1001': 2, '1011': 1}
```
>> Meas output register counts: {'0001': 210, '0010': 305, '0000': 282, '0011': 201, '0101': 2, '1010': 6, '0110': 5, '0100': 6, '1000': 3, '0111': 1, '1001': 2, '1011': 1}
```
</TabItem>

<TabItem value="legacy" label="backend.run()">
Expand Down Expand Up @@ -502,7 +502,7 @@ to the following:
<Admonition type="tip" title="Recommendations">
- [Common use cases](qiskit-runtime-use-case)
- [Migrate `backend.run` options to primitive options](qiskit-runtime-options)
- [Setting execution options](../../run/advanced-runtime-options)
- [Qiskit Runtime options overview](../../run/runtime-options-overview)
- [Primitive execution options API reference](../qiskit-ibm-runtime/qiskit_ibm_runtime.options.Options)
- [How to run a session](../../run/run-jobs-in-session)
- [Qiskit Runtime local testing mode](../../verify/local-testing-mode)
Expand Down
4 changes: 2 additions & 2 deletions docs/api/migration-guides/qiskit-runtime-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ in_page_toc_max_heading_level: 2

# Migrate options

All `backend.run` options are now available through the Qiskit Runtime primitives, but there are additional options available with the V2 primitives. See the [API reference](/api/qiskit-ibm-runtime/options) for the full list of available options. See [End-to-end examples](qiskit-runtime-examples) and [Advanced Qiskit Runtime options](../../run/advanced-runtime-options) for more information about specifying V2 primitives options.
All `backend.run` options are now available through the Qiskit Runtime primitives, but there are additional options available with the V2 primitives. See the [API reference](/api/qiskit-ibm-runtime/options) for the full list of available options. See [End-to-end examples](qiskit-runtime-examples) and [Qiskit Runtime options overview](../../run/runtime-options-overview) for more information about specifying V2 primitives options.

| backend.run options | V2 Primitive options | Notes |
|---------------------|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
Expand Down Expand Up @@ -43,4 +43,4 @@ All `backend.run` options are now available through the Qiskit Runtime primitive
One of the advantages of the primitives is that they abstract away the
circuit execution setup so that algorithm developers can focus on the
pure algorithmic components. However, sometimes, to get the most out of
an algorithm, you might want to tune certain primitive options. For details, see [Advanced runtime options.](../../run/advanced-runtime-options)
an algorithm, you might want to tune certain primitive options. For details, see the [Qiskit Runtime options overview.](../../run/runtime-options-overview)
14 changes: 7 additions & 7 deletions docs/api/migration-guides/qiskit-runtime-use-case.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Common use cases when migrating from backend.run to Qiskit Runtime
This topic describes how to migrate programs with the most commonly used types of circuits. For a full example, see [End-to-end examples.](qiskit-runtime-examples)

## Basic circuits
The only changes when running basic circuits are how you run the job and retrieve results.
The only changes when running basic circuits are how you run the job and retrieve results.

<Tabs>
<TabItem value="Updated" label="Runtime primitives">
Expand Down Expand Up @@ -45,7 +45,7 @@ result = job.result()
<span id="migrate-options"></span>
## Specifying options

All options that were available with `backend.run` are available in the Qiskit Runtime primitives, but they are specified differently. For more information, see [Migrate options](qiskit-runtime-options) and [Advanced Qiskit Runtime options.](../../run/advanced-runtime-options)
All options that were available with `backend.run` are available in the Qiskit Runtime primitives, but they are specified differently. For more information, see [Migrate options](qiskit-runtime-options) and the [Qiskit Runtime options overview.](../../run/runtime-options-overview)

<Tabs>
<TabItem value="Updated" label="Runtime primitives">
Expand Down Expand Up @@ -80,7 +80,7 @@ To migrate programs that run dynamic circuits, change the run call.

<Tabs>
<TabItem value="primitives" label="Sampler">
```python
```python
from qiskit_ibm_runtime import SamplerV2 as Sampler

sampler = Sampler(backend)
Expand All @@ -92,7 +92,7 @@ print(f">>> Hardware counts: {pub_result.data.meas.get_counts()}")
</TabItem>

<TabItem value="backend" label="backend.run">
```python
```python
job = backend.run(dynamic_circ, dynamic=True)
job.job_id()

Expand Down Expand Up @@ -154,7 +154,7 @@ theta_values = [np.pi/2, np.pi/2, np.pi/2]

<Tabs>
<TabItem value="updated" label="Runtime primitives">
Only circuits that adhere to the Instruction Set Architecture (ISA) of a specific backend are accepted, so we must transform the circuits.
Only circuits that adhere to the Instruction Set Architecture (ISA) of a specific backend are accepted, so we must transform the circuits.

```python
from qiskit_ibm_runtime import QiskitRuntimeService
Expand Down Expand Up @@ -185,7 +185,7 @@ job = sampler.run([(isa_circuit, theta_values)])
result = job.result()
# Get results for the first (and only) PUB
pub_result = result[0]
# Get counts from the classical register "c".
# Get counts from the classical register "c".
print(f" >> Counts for the c output register: {pub_result.data.c.get_counts()}")
```
</TabItem>
Expand Down Expand Up @@ -232,7 +232,7 @@ pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(circuit)

sampler = Sampler(backend)
# Get the averaged IQ data.
# Get the averaged IQ data.
# This is equivalent to meas_level=1, meas_return="avg" in backend.run
sampler.options.execution.meas_type = "avg_kerneled"
job = sampler.run([isa_circuit], shots=10)
Expand Down
12 changes: 6 additions & 6 deletions docs/run/_toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"title": "Configure runtime options",
"children": [
{
"title": "Configure runtime compilation",
"url": "/run/configure-runtime-compilation"
"title": "Overview",
"url": "/run/runtime-options-overview"
},
{
"title": "Configure runtime error mitigation",
"url": "/run/configure-error-mitigation"
"title": "Configure runtime error suppression",
"url": "/run/configure-error-suppression"
},
{
"title": "Advanced runtime options",
"url": "/run/advanced-runtime-options"
"title": "Configure runtime error mitigation",
"url": "/run/configure-error-mitigation"
},
{
"title": "Error mitigation and suppression techniques",
Expand Down
1 change: 1 addition & 0 deletions docs/run/advanced-runtime-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,4 @@ estimator = Estimator(mode=backend, options=options)
- Learn how to transpile locally in the [Transpile](../transpile/) section.
- Try the [Submit pre-transpiled circuits](https://learning.quantum.ibm.com/tutorial/submitting-user-transpiled-circuits-using-primitives) tutorial.
</Admonition>

28 changes: 2 additions & 26 deletions docs/run/configure-error-mitigation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -471,33 +471,9 @@ job = estimator.run(circuits=[psi1], observables=[H1], parameter_values=[theta1]
psi1_H1 = job.result()
```

<span id="no-error-mitigation"></span>
## Turn off all error mitigation and error suppression
## Turn off all error mitigation

You can turn off all error mitigation and suppression if you are, for example, doing research on your own mitigation techniques. To accomplish this, for EstimatorV2, set `resilience_level = 0` and `optimization_level = 0`. For SamplerV2, no changes are necessary because no error mitigation or suppression options are enabled by default.

Example:

Turn off all error mitigation and suppression in EstimatorV2.

```python
from qiskit_ibm_runtime import EstimatorV2 as Estimator, Options, QiskitRuntimeService

# Define the service. This allows you to access IBM Quantum systems.
service = QiskitRuntimeService()

# Get a backend
backend = service.least_busy(operational=True, simulator=False)

# Define Estimator
estimator = Estimator(backend)

options = estimator.options

# Turn off all error mitigation and suppression
options.resilience_level = 0
options.optimization_level = 0
```
For instructions to turn off all error mitigation, see the [Turn off all error suppression and mitigation](runtime-options-overview#no-error-mitigation) section.

## Next steps

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Configure runtime compilation
description: How to configure runtime compilation in Qiskit Runtime.
title: Configure error suppression
description: How to configure error suppression in Qiskit Runtime. (Previous topic - runtime compilation)

---

# Configure runtime compilation for Qiskit Runtime
# Configure error suppression for Qiskit Runtime

Runtime compilation techniques optimize and transform your circuit to minimize errors. Runtime compilation adds some classical pre-processing overhead to your overall runtime. Therefore, it is important to achieve a balance between perfecting your results and ensuring that your job completes in a reasonable amount of time.

Primitives let you employ runtime compilation by choosing advanced runtime compilation options and, for Estimator V2, by setting the optimization level (`optimization_level`) option. If you don't want any processing done to minimize errors, follow the instructions in the [Turn off all error mitigation and error suppression](configure-error-mitigation#no-error-mitigation) section.
Primitives let you employ runtime compilation by choosing advanced runtime compilation options and, for Estimator V2, by setting the optimization level (`optimization_level`) option. If you don't want any processing done to minimize errors, follow the instructions in the [Turn off all error mitigation and error suppression](runtime-options-overview#no-error-mitigation) section.

<admonition type="note">Estimator V2 supports optimization levels 0 and 1 only. Sampler V2 does not support setting the optimization level.</admonition>

Expand Down Expand Up @@ -164,6 +164,9 @@ print(f">>> dynamical decoupling sequence to use: {sampler.options.dynamical_dec
</TabItem>
</Tabs>

## Turn off all error suppression

For instructions to turn off all error suppression, see the [Turn off all error suppression and mitigation](runtime-options-overview#no-error-mitigation) section.

## Next steps

Expand Down
2 changes: 1 addition & 1 deletion docs/run/minimize-time.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ There are several ways you can limit the amount of quantum time spent processing

- Set limits on execution time: You can limit how long each job or session runs. For details, see [Maximum execution time for a Qiskit Runtime job or session](max-execution-time).

- Use only the necessary settings for error suppression, error mitigation, and optimization, because higher values can cause your jobs to run longer. See [Algorithm tuning options](advanced-runtime-options), [Configure runtime compilation](configure-runtime-compilation), and [Configure error mitigation](configure-error-mitigation) for details.
- Use only the necessary settings for error suppression, error mitigation, and optimization, because higher values can cause your jobs to run longer. See the [Qiskit Runtime options overview](runtime-options-overview), [Configure error suppression](configure-error-suppression), and [Configure error mitigation](configure-error-mitigation) for details.

## Next steps

Expand Down
2 changes: 1 addition & 1 deletion docs/run/primitives-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ print(f" > Quasi-probability distribution job 2: {another_result.quasi_dists}")

<Admonition type="tip" title="Recommendations">
- Read [Migrate to V2 primitives](/api/migration-guides/v2-primitives).
- [Specify advanced runtime options.](advanced-runtime-options)
- [Specify advanced runtime options.](runtime-options-overview)
- Practice with primitives by working through the [Cost function lesson](https://learning.quantum.ibm.com/course/variational-algorithm-design/cost-functions#primitives) in IBM Quantum Learning.
- Learn how to transpile locally in the [Transpile](../transpile/) section.
- Try the [Submit pre-transpiled circuits](https://learning.quantum.ibm.com/tutorial/submitting-user-transpiled-circuits-using-primitives) tutorial.
Expand Down
Loading
Loading