RXCalibrationBuilder¶
- class qiskit.transpiler.passes.RXCalibrationBuilder(*args, **kwargs)[source]¶
Bases:
CalibrationBuilder
Add single-pulse RX calibrations that are bootstrapped from the SX calibration.
Note
Requirement: NormalizeRXAngles pass (one of the optimization passes).
It is recommended to place this pass in the post-optimization stage of a passmanager. A simple demo:
from qiskit.providers.fake_provider import FakeBelemV2 from qiskit.transpiler import PassManager, PassManagerConfig from qiskit.transpiler.preset_passmanagers import level_1_pass_manager from qiskit.circuit import Parameter from qiskit.circuit.library import QuantumVolume from qiskit.circuit.library.standard_gates import RXGate from calibration.rx_builder import RXCalibrationBuilder qv = QuantumVolume(4, 4, seed=1004) # Transpiling with single pulse RX gates enabled backend_with_single_pulse_rx = FakeBelemV2() rx_inst_props = {} for i in range(backend_with_single_pulse_rx.num_qubits): rx_inst_props[(i,)] = None backend_with_single_pulse_rx.target.add_instruction(RXGate(Parameter("theta")), rx_inst_props) config_with_rx = PassManagerConfig.from_backend(backend=backend_with_single_pulse_rx) pm_with_rx = level_1_pass_manager(pass_manager_config=config_with_rx) rx_builder = RXCalibrationBuilder(target=backend_with_single_pulse_rx.target) pm_with_rx.post_optimization = PassManager([rx_builder]) transpiled_circ_with_single_pulse_rx = pm_with_rx.run(qv) transpiled_circ_with_single_pulse_rx.count_ops() # Conventional transpilation: each RX gate is decomposed into a sequence with two SX gates original_backend = FakeBelemV2() original_config = PassManagerConfig.from_backend(backend=original_backend) original_pm = level_1_pass_manager(pass_manager_config=original_config) original_transpiled_circ = original_pm.run(qv) original_transpiled_circ.count_ops()
- References
[1]: Gokhale et al. (2020), Optimized Quantum Compilation for Near-Term Algorithms with OpenPulse. arXiv:2004.11205 <https://arxiv.org/abs/2004.11205>
Bootstrap single-pulse RX gate calibrations from the (hardware-calibrated) SX gate calibration.
- Parameters:
target (Target) – Should contain a SX calibration that will be
calibrations. (used for bootstrapping RX) –
Attributes
- is_analysis_pass¶
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
- is_transformation_pass¶
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).
Methods
- execute(passmanager_ir, state, callback=None)¶
Execute optimization task for input Qiskit IR.
- Parameters:
passmanager_ir (Any) – Qiskit IR to optimize.
state (PassManagerState) – State associated with workflow execution by the pass manager itself.
callback (Callable | None) – A callback function which is caller per execution of optimization task.
- Returns:
Optimized Qiskit IR and state of the workflow.
- Return type:
tuple[Any, qiskit.passmanager.compilation_status.PassManagerState]
- get_calibration(node_op, qubits)[source]¶
Generate RX calibration for the rotation angle specified in node_op.
- Return type:
- run(dag)¶
Run the calibration adder pass on dag.
- Parameters:
dag (DAGCircuit) – DAG to schedule.
- Returns:
A DAG with calibrations added to it.
- Return type:
- supported(node_op, qubits)[source]¶
Check if the calibration for SX gate exists and it’s a single DRAG pulse.
- Return type:
- update_status(state, run_state)¶
Update workflow status.
- Parameters:
state (PassManagerState) – Pass manager state to update.
run_state (RunState) – Completion status of current task.
- Returns:
Updated pass manager state.
- Return type: