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

Change default resilience and optimization level #604

Merged
merged 5 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 24 additions & 6 deletions qiskit_ibm_runtime/options/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from .transpilation_options import TranspilationOptions
from .resilience_options import ResilienceOptions
from ..runtime_options import RuntimeOptions
from ..utils.deprecation import issue_deprecation_msg


@_flexible
Expand All @@ -35,7 +36,7 @@ class Options:
Higher levels generate more optimized circuits,
at the expense of longer transpilation times. This is based on the
``optimization_level`` parameter in qiskit-terra but may include
backend-specific optimization.
backend-specific optimization. Default: 3.

* 0: no optimization
* 1: light optimization
Expand All @@ -44,10 +45,19 @@ class Options:

resilience_level: How much resilience to build against errors.
Higher levels generate more accurate results,
at the expense of longer processing times.
at the expense of longer processing times. Default: 1.

* 0: no resilience
* 1: light resilience
* 0: No mitigation.
* 1: Minimal mitigation costs. Mitigate error associated with readout errors.
* 2: Medium mitigation costs. Typically reduces bias in estimators but
is not guaranteed to be zero bias. Only applies to estimator.
* 3: Heavy mitigation with layer sampling. Theoretically expected to deliver zero
bias estimators. Only applies to estimator.

Refer to the
`Qiskit Runtime documentation
<https://qiskit.org/documentation/partners/qiskit_ibm_runtime>`_.
for more information about the error mitigation methods used at each level.

max_execution_time: Maximum execution time in seconds. If
a job exceeds this time limit, it is forcibly cancelled. If ``None``, the
Expand All @@ -71,8 +81,8 @@ class Options:
:class:`SimulatorOptions` for all available options.
"""

optimization_level: int = 1
resilience_level: int = 0
optimization_level: int = 3
resilience_level: int = 1
max_execution_time: Optional[int] = None
transpilation: Union[TranspilationOptions, Dict] = field(
default_factory=TranspilationOptions
Expand Down Expand Up @@ -121,6 +131,14 @@ def _get_program_inputs(options: dict) -> dict:
}
)

for deprecated in ["translation_method", "timing_constraints"]:
if deprecated in inputs["transpilation_settings"]:
issue_deprecation_msg(
msg=f"The {deprecated} transpilation option has been deprecated",
version="0.8",
remedy="",
)

known_keys = list(Options.__dataclass_fields__.keys())
known_keys.append("image")
# Add additional unknown keys.
Expand Down
29 changes: 1 addition & 28 deletions qiskit_ibm_runtime/options/transpilation_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

"""Transpilation options."""

from typing import Optional, List, Union, Dict
from typing import Optional, List, Union
from dataclasses import dataclass

from .utils import _flexible
Expand All @@ -36,39 +36,12 @@ class TranspilationOptions:
routing_method: Name of routing pass.
One of 'basic', 'lookahead', 'stochastic', 'sabre', 'none'.

translation_method: Name of translation pass. One of 'unroller', 'translator', 'synthesis'.

approximation_degree: heuristic dial used for circuit approximation
(1.0=no approximation, 0.0=maximal approximation)

timing_constraints: An optional control hardware restriction on instruction time
resolution. A quantum computer backend may report a set of restrictions, namely:

* granularity: An integer value representing minimum pulse gate
resolution in units of ``dt``. A user-defined pulse gate should have
duration of a multiple of this granularity value.

* min_length: An integer value representing minimum pulse gate
length in units of ``dt``. A user-defined pulse gate should be longer
than this length.

* pulse_alignment: An integer value representing a time resolution of gate
instruction starting time. Gate instruction should start at time which
is a multiple of the alignment value.

* acquire_alignment: An integer value representing a time resolution of measure
instruction starting time. Measure instruction should start at time which
is a multiple of the alignment value.

This information will be provided by the backend configuration.
If the backend doesn't have any restriction on the instruction time allocation,
then ``timing_constraints`` is None and no adjustment will be performed.
"""

skip_transpilation: bool = False
initial_layout: Optional[Union[dict, List]] = None # TODO: Support Layout
layout_method: Optional[str] = None
routing_method: Optional[str] = None
translation_method: Optional[str] = None
approximation_degree: Optional[float] = None
timing_constraints: Optional[Dict[str, int]] = None
10 changes: 10 additions & 0 deletions releasenotes/notes/default-resilience-level-8122033dd1369bc8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
upgrade:
- |
The default ``resilience_level`` option for has been changed from 0 to 1.
In addition, the default ``optimization_level`` option has been changed
from 1 to 3.
deprecations:
- |
The transpilation options ``translation_method`` and ``timing_constraints``
have been deprecated.