Specify Executor options
Package versions
The code on this page was developed using the following requirements. We recommend using these versions or newer.
qiskit[all]~=2.3.0
qiskit-ibm-runtime~=0.43.1
You can use options to customize the Executor primitive.
- You can see the available options and update option values during or after primitive initialization.
- Use the
update()method to apply changes to theoptionsattribute. - The
optionsattribute is thedataclassPython type. You can use the built-inasdictmethod to convert it to a dictionary.
Set Executor options
If an option is specified both during and after primitive initialization, the value set after initializing the primitive is used.
Primitive initialization
You can pass in an instance of the options class or a dictionary when initializing Executor, which then makes a copy of those options. Thus, changing the original dictionary or options instance doesn't affect the options owned by the primitive.
Options class
When creating an instance of the Executor class, you can pass in an instance of the options class. Those options are then applied when you use run() to perform the calculation. Specify the options in this format: options.option.sub-option.sub-sub-option = choice. For example: options.environment.log_level = INFO.
Example:
from qiskit_ibm_runtime import QiskitRuntimeService, Executor
from qiskit_ibm_runtime.options import ExecutorOptions
service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)
options = ExecutorOptions(
environment={"log_level": "INFO"},
execution={"init_qubits": True},
)
# or use the following instead:
options = ExecutorOptions()
options.environment.log_level = "INFO"
options.execution.init_qubits = True
executor = Executor(mode=backend, options=options)Dictionary
You can specify options as a dictionary when initializing Executor.
from qiskit_ibm_runtime import QiskitRuntimeService, Executor
service = QiskitRuntimeService()
backend = service.least_busy(operational=True, simulator=False)
# Setting options during primitive initialization
executor = Executor(
backend,
options={
"environment": {"log_level": "INFO"},
"execution": {"init_qubits": True},
},
)Available options
The following table documents options from the latest version of qiskit-ibm-runtime. To see older option versions, visit the qiskit-ibm-runtime API reference and select a previous version.
List of tags.
Choices: None
Default: None
Choices: DEBUG, INFO, WARNING, ERROR, CRITICAL
Default: WARNING
Choices:
True,FalseDefault:
FalseChoices: Integer number of seconds in the range [1, 10800]
Default: 10800 (3 hours)
Whether to reset the qubits to the ground state for each shot.
Choices:
True,FalseDefault:
TrueThe delay between a measurement and the subsequent quantum circuit.
Choices: Value in the range supplied by
backend.rep_delay_rangeDefault: Given by
backend.default_rep_delayChoices:
classified,kerneled,avg_kerneledDefault:
classified
Experimental options, when available.
Feature compatibility
Certain runtime features cannot be used together in a single job. Click the appropriate tab for a list of features that are incompatible with the selected feature:
Incompatible with:
- Gate-folding ZNE
- PEA
- PEC
- Dynamical decoupling
Other notes:
- Gate twirling can be applied to dynamic circuits, but only to gates not inside conditional blocks. Measurement twirling can only be applied to terminal measurements.
- Compatible with fractional gates when using
qiskit-ibm-runtimev0.42.0 or later.
Incompatible with dynamic circuits.
Incompatible with:
- Gate twirling
- PEA
- PEC
Compatible with dynamic circuits when using qiskit-ibm-runtime v0.42.0 or later.
Incompatible with:
- Dynamic circuits
- PEA
- PEC
Might not work when using custom gates.
Incompatible with fractional gates or with stretches.
Other notes:
- Gate twirling can be applied to dynamic circuits, but only to gates not inside conditional blocks. Measurement twirling can only be applied to terminal measurements.
- Does not work with non-Clifford entanglers.
Incompatible with:
- Dynamic circuits
- Fractional gates
- Gate-folding ZNE
- PEC
Incompatible with:
- Dynamic circuits
- Fractional gates
- Gate-folding ZNE
- PEA
Next steps
- Review the ExecutionOptionsV2 API documentation.
- Review the EnvironmentOptions API documentation.