Primitive options
qiskit_ibm_runtime.options
Options that can be passed to the Qiskit Runtime primitives.
V2 Primitives
SamplerV2
and EstimatorV2
each have their own options. You can use the options
attribute to set the options. For example:
from qiskit_ibm_runtime import QiskitRuntimeService, EstimatorV2
service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)
estimator = EstimatorV2(backend=backend)
estimator.options.resilience_level = 1
You can also use the update()
method to do bulk update. For example:
from qiskit_ibm_runtime import QiskitRuntimeService, EstimatorV2
service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)
estimator = EstimatorV2(backend=backend)
estimator.options.update(resilience_level=1)
Refer to SamplerOptions
and EstimatorOptions
for V2 Sampler and V2 Estimator options, respectively.
If an option is not specified, the server default value is used. The default values are subject to change. Refer to this current module’s documentation for the latest defaults.
V1 Primitives
The Options
class encapsulates all the options you can specify when invoking a V1 primitive. It includes frequently used options, such as optimization_level
and resilience_level
as well as sub-categories, such as transpilation
and execution
. You can use auto-complete to easily find the options inside each sub-category, for example:
from qiskit_ibm_runtime.options import Options
options = Options()
options.transpilation.initial_layout = [0, 1, 2, 3] # This an be done using auto-complete
You can also pass dictionaries to each sub-category, for example:
from qiskit_ibm_runtime.options import Options
options = Options(transpilation={"initial_layout": [0, 1, 2, 3]})
Classes
Base primitive options
EstimatorOptions (*args, **kwargs) | Options for V2 Estimator. |
SamplerOptions (*args, **kwargs) | Options for V2 Sampler. |
Options ([optimization_level, ...]) | Options for V1 primitives. |
Suboptions for V2 primitives only
DynamicalDecouplingOptions (*args, **kwargs) | Options for dynamical decoupling (DD). |
ResilienceOptionsV2 (*args, **kwargs) | Resilience options for V2 Estimator. |
LayerNoiseLearningOptions (*args, **kwargs) | Options for learning layer noise. |
MeasureNoiseLearningOptions (*args, **kwargs) | Options for measurement noise learning. |
PecOptions (*args, **kwargs) | Probabalistic error cancellation mitigation options. |
ZneOptions (*args, **kwargs) | Zero noise extrapolation mitigation options. |
TwirlingOptions (*args, **kwargs) | Twirling options. |
ExecutionOptionsV2 (*args, **kwargs) | Execution options for V2 primitives. |
SamplerExecutionOptionsV2 (*args, **kwargs) | Extension of ExecutionOptionsV2 for the sampler primitive. |
Suboptions for both V1 and V2 primitives
EnvironmentOptions (*args, **kwargs) | Options related to the execution environment. |
SimulatorOptions (*args, **kwargs) | Simulator options. |
Suboptions for V1 primitives only
TranspilationOptions (*args, **kwargs) | Transpilation options. |
ExecutionOptions (*args, **kwargs) | Execution options for V1 primitives. |
ResilienceOptions (*args, **kwargs) | Resilience options for V1 primitives. |