メインコンテンツへスキップ
このプロジェクトはベータ版です。バグを見つけましたか?GitHub Issueを開く。質問やアイデアがありますか?Discussionsで質問する — フィードバックをお待ちしています!
このページの翻訳品質はいかがですか?

Executor オプションの指定

パッケージ・バージョン

このページのコードは、以下の要件を使用して開発されました。 これらのバージョン以降を使用することをお勧めします。

qiskit-ibm-runtime~=0.47.0

Executorプリミティブをカスタマイズするためにオプションを使用できます。SamplerやEstimatorとは異なり、Executorは設計意図の大部分がsamplexにエンコードされているため、オプションが非常に少なくなっています。

注意
  • プリミティブの初期化中および初期化後に、利用可能なオプションを確認してオプション値を更新できます。

  • options 属性に変更を適用するには update() メソッドを使用します。

  • options 属性は Python の dataclass 型です。組み込みの asdict メソッドを使用して辞書に変換できます。

  • Executorは、samplexにエンコードされた情報のみを処理できます。制限事項については、Samplomaticガイドを参照してください。

Executor オプションの設定​

オプションがプリミティブの初期化中と初期化後の両方で指定された場合、プリミティブの初期化後に設定された値が使用されます。

プリミティブの初期化​

Executor の初期化時にオプション・クラスのインスタンスまたは辞書を渡すことができます。その後、プリミティブはこれらのオプションをコピーします。したがって、元の辞書またはオプション・インスタンスを変更しても、プリミティブが所有するオプションには影響しません。

オプション・クラス​

Executor クラスのインスタンスを作成する際に、オプション・クラスのインスタンスを渡すことができます。これらのオプションは、run() を使用して計算を実行するときに適用されます。オプションは options.option.sub-option.sub-sub-option = choice の形式で指定します。例:options.environment.log_level = INFO。

例:

# Added by doQumentation — installs the packages this notebook needs if they are missing
import importlib.util

_needed = {"qiskit_ibm_runtime": "qiskit-ibm-runtime"}
_missing = [pip for module, pip in _needed.items()
if importlib.util.find_spec(module) is None]
# One at a time, so a package that fails to install does not block the others
for _pip in _missing:
%pip install -q {_pip}
if not _missing:
print("\u2713 All required packages are installed")
from qiskit_ibm_runtime import QiskitRuntimeService, Executor
from qiskit_ibm_runtime.options_models 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)

辞書​

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},
},
)

利用可能なオプション​

次の表は、最新バージョンの qiskit-ibm-runtime で利用できるオプションをまとめたものです。古いオプション・バージョンを確認するには、qiskit-ibm-runtime API リファレンスにアクセスして以前のバージョンを選択してください。

environment

environment API ドキュメント

environment.job_tags

タグのリスト。

選択肢: None

デフォルト: None

environment.log_level

選択肢: DEBUG, INFO, WARNING, ERROR, CRITICAL

デフォルト: WARNING

environment.private

選択肢: True, False

デフォルト: False

environment.max_execution_time

選択肢: [1, 10800] の範囲の整数(秒数)

デフォルト: 10800(3 時間)

execution

execution API ドキュメント

execution.init_qubits

各ショットで Qubit を基底状態にリセットするかどうか。

選択肢: True, False

デフォルト: True

execution.rep_delay

測定と後続の量子回路の間の遅延。

選択肢: backend.rep_delay_range で指定された範囲内の値

デフォルト: backend.default_rep_delay で指定された値

execution.meas_type

選択肢: classified, kerneled, avg_kerneled

デフォルト: classified

experimental

実験的なオプション(利用可能な場合)。

次のステップ​

おすすめ