One- and Two-Qubit Randomized Benchmarking in LabOne Q with Qiskit¶
In this notebook, we'll use the Qiskit Experiment Library to generate one and two qubit randomized benchmarking experiments. We'll then export the generated experiment to OpenQASM, import these OpenQASM experiments into LabOne Q, compile, and simulate the output signals.
When generating randomized benchmarking experiments in Qiskit, it will return a list of quantum circuits with the specified parameters. We show here how to efficiently import, compile and execute such a list into LabOne Q, resulting in a single, large experiment.
0. Python Imports¶
# LabOne Q:
# additional imports
from math import pi
# device setup and descriptor
from laboneq._utils import id_generator
from laboneq.contrib.example_helpers.generate_device_setup import (
generate_device_setup_qubits,
)
# plotting functionality
from laboneq.contrib.example_helpers.plotting.plot_helpers import plot_simulation
# core LabOne Q functionality
from laboneq.simple import *
# qiskit
from qiskit import qasm3, transpile
from qiskit_experiments.library import randomized_benchmarking
1. LabOne Q startup¶
1.1 Generate pre-calibrated setup - Qubits and setup configuration & set up LabOne Q session¶
# specify the number of qubits you want to use
number_of_qubits = 2
# generate the device setup and the qubit objects using a helper function
device_setup, qubits = generate_device_setup_qubits(
number_qubits=number_of_qubits,
pqsc=[{"serial": "DEV10001"}],
hdawg=[{"serial": "DEV8001", "zsync": 0, "number_of_channels": 8, "options": None}],
shfqc=[
{
"serial": "DEV12001",
"zsync": 1,
"number_of_channels": 6,
"readout_multiplex": 6,
"options": None,
}
],
include_flux_lines=True,
server_host="localhost",
setup_name=f"my_{number_of_qubits}_tuneable_qubit_setup",
)
q0, q1 = qubits[:2]
# create and connect to Session
# use emulation mode - no connection to instruments
use_emulation = True
my_session = Session(device_setup=device_setup)
my_session.connect(do_emulation=use_emulation, reset_devices=True)
[2024.11.07 16:39:56.094] INFO Logging initialized from [Default inline config in laboneq.laboneq_logging] logdir is /builds/qccs/laboneq-applications/docs/sources/how-to-guides/sources/04_qasm/laboneq_output/log
[2024.11.07 16:39:56.095] INFO VERSION: laboneq 2.41.0
[2024.11.07 16:39:56.096] INFO Connecting to data server at localhost:8004
[2024.11.07 16:39:56.098] INFO Connected to Zurich Instruments LabOne Data Server version 24.10 at localhost:8004
[2024.11.07 16:39:56.099] WARNING HDAWG:dev8001: Include the device options 'HDAWG8/MF/ME/SKW/PC' in the device setup ('options' field of the 'instruments' list in the device setup descriptor, 'device_options' argument when constructing instrument objects to be added to 'DeviceSetup' instances). This will become a strict requirement in the future.
[2024.11.07 16:39:56.100] WARNING SHFQC/QA:dev12001: Include the device options 'SHFQC/QC6CH' in the device setup ('options' field of the 'instruments' list in the device setup descriptor, 'device_options' argument when constructing instrument objects to be added to 'DeviceSetup' instances). This will become a strict requirement in the future.
[2024.11.07 16:39:56.111] INFO Configuring the device setup
[2024.11.07 16:39:56.163] INFO The device setup is configured
<laboneq.dsl.session.ConnectionState at 0x7da6009128d0>
2. Defining a LabOne Q Backend¶
Here, we add Gate and Pulse Definitions for Transpilation Support from QASM into LabOne Q
def drive_pulse(qubit: Qubit, label: str, amplitude_scale=1.0):
"""Return a drive pulse for the given qubit.
Pulse parameters are taken from the qubit parameters.
"""
return pulse_library.drag(
uid=f"{qubit.uid}_{label}",
length=qubit.parameters.user_defined["pulse_length"],
amplitude=amplitude_scale * qubit.parameters.user_defined["amplitude_pi"],
)
def rz(qubit: Qubit):
"""Return a parameterized rotation (virtual z) gate for the specified qubit.
The gate is a function that takes the angle to rotate and
returns a LabOne Q section that performs the rotation.
"""
def rz_gate(angle: float):
"""Rz(theta).
Theta is in radians - implements a virtual z-gate
"""
gate = Section(uid=id_generator(f"p_{qubit.uid}_rz_{int(180 * angle / pi)}"))
gate.play(
signal=qubit.signals["drive"],
pulse=None,
increment_oscillator_phase=angle,
)
return gate
return rz_gate
def measurement(qubit: Qubit):
"""Return a measurement operation of the specified qubit.
The operation is a function that takes the measurement handle (a string)
and returns a LabOne Q section that performs the measurement.
"""
def measurement_gate(handle: str):
"""Perform a measurement.
Handle is the name of where to store the measurement result. E.g. "meas[0]".
"""
measure_pulse = pulse_library.gaussian_square(
uid=f"{qubit.uid}_readout_pulse",
length=qubit.parameters.user_defined["readout_length"],
amplitude=qubit.parameters.user_defined["readout_amplitude"],
zero_boundaries=True,
)
integration_kernel = pulse_library.const(
uid=f"{qubit.uid}_integration_kernel",
length=qubit.parameters.user_defined["readout_length"],
)
gate = Section(uid=id_generator(f"meas_{qubit.uid}_{handle}"))
gate.reserve(signal=qubit.signals["drive"])
gate.play(signal=qubit.signals["measure"], pulse=measure_pulse)
gate.acquire(
signal=qubit.signals["acquire"],
handle=handle,
kernel=integration_kernel,
)
return gate
return measurement_gate
def reset(qubit: Qubit, reset_pulse):
"""Reset the specified qubit to the ground state with the supplied reset pulse.
The reset gate function takes no arguments and returns a LabOne Q section that performs
the reset.
"""
def reset_gate():
sig = qubit.signals
# Reset Section
reset = Section(uid=f"{qubit.uid}_reset")
# qubit state readout
readout = measurement(qubit)(f"{qubit.uid}_qubit_state")
# delay after measurement
readout.delay(
signal=sig["acquire"],
time=qubit.parameters.user_defined["reset_delay_length"],
)
# real-time feedback, fetching the measurement data identified by handle locally from the QA unit of the SHFQC
match_case = Match(
uid=f"{qubit.uid}_feedback",
handle=f"{qubit.uid}_qubit_state",
play_after=readout,
)
# measurement result 0 - ground state
case_0 = Case(uid=f"{qubit.uid}_0_Case", state=0)
case_0.play(signal=sig["drive"], pulse=reset_pulse, amplitude=0.01)
# measurement result 1 - excited state
case_1 = Case(uid=f"{qubit.uid}_1_Case", state=1)
# play x180 pulse
case_1.play(signal=sig["drive"], pulse=reset_pulse)
match_case.add(case_0)
match_case.add(case_1)
reset.add(readout)
reset.add(match_case)
return reset
return reset_gate
def cx(control: Qubit, target: Qubit):
"""Return a controlled X gate for the specified control and target qubits.
The CX gate function takes the control and target qubit and returns a LabOne Q section that performs
a controlled X gate between these two qubits using a cross-resonance scheme.
"""
def cx_gate():
cx_id = f"cx_{control.uid}_{target.uid}"
gate = Section(uid=id_generator(cx_id))
# define X pulses for target and control
x180_pulse_control = drive_pulse(control, label="x180")
x180_pulse_target = drive_pulse(target, label="x180")
# define cancellation pulses for target and control
cancellation_control_n = pulse_library.gaussian_square(uid="CR-")
cancellation_control_p = pulse_library.gaussian_square(uid="CR+")
cancellation_target_p = pulse_library.gaussian_square(uid="q1+")
cancellation_target_n = pulse_library.gaussian_square(uid="q1-")
# play X pulses on both target and control
x180_both = Section(uid=id_generator(f"{cx_id}_x_both"))
x180_both.play(signal=control.signals["drive"], pulse=x180_pulse_control)
x180_both.play(signal=target.signals["drive"], pulse=x180_pulse_target)
gate.add(x180_both)
# First cross-resonance component
cancellation_p = Section(
uid=id_generator(f"{cx_id}_canc_p"), play_after=x180_both.uid
)
cancellation_p.play(signal=target.signals["drive"], pulse=cancellation_target_p)
cancellation_p.play(
signal=control.signals["flux"], pulse=cancellation_control_n
)
gate.add(cancellation_p)
# play X pulse on control
x180_control = Section(
uid=id_generator(f"{cx_id}_x_q0"), play_after=cancellation_p.uid
)
x180_control.play(signal=control.signals["drive"], pulse=x180_pulse_control)
gate.add(x180_control)
# Second cross-resonance component
cancellation_n = Section(
uid=id_generator(f"cx_{cx_id}_canc_n"), play_after=x180_control.uid
)
cancellation_n.play(signal=target.signals["drive"], pulse=cancellation_target_n)
cancellation_n.play(
signal=control.signals["flux"], pulse=cancellation_control_p
)
gate.add(cancellation_n)
return gate
return cx_gate
3. Randomised benchmarking circuits from Qiskit¶
You'll start by creating Standard RB experiments from the Qiskit Experiment Library here. We do this for one and two qubits for a few different sequence lengths.
Note that most circuits that can be generated in Qiskit and converted to OpenQASM could be adapted to be run in a similar way in LabOne Q!
# Use Qiskit Experiment Library to Generate RB
rb1_qiskit_circuits = randomized_benchmarking.StandardRB(
physical_qubits=[0],
lengths=[4, 8, 16],
num_samples=2,
).circuits()
rb2_qiskit_circuits = randomized_benchmarking.StandardRB(
physical_qubits=[0, 1],
lengths=[4, 8, 16],
num_samples=2,
).circuits()
When efficiently importing and executing a list of quantum circuits, there currently are strong limitations as to how the measurements are scheduled in these experiment. We strip them here from the Qiskit circuit. We will re-add them to the LabOne Q experiment separately when doing the import.
for circuit in rb1_qiskit_circuits:
circuit.remove_final_measurements()
for circuit in rb2_qiskit_circuits:
circuit.remove_final_measurements()
rb1_qiskit_circuits[2].draw()
┌────────────────┐ ░ ┌────────────────┐ ░ ┌────────────────┐ ░ » q: ┤ Clifford-1Q(7) ├─░─┤ Clifford-1Q(2) ├─░─┤ Clifford-1Q(8) ├─░─» └────────────────┘ ░ └────────────────┘ ░ └────────────────┘ ░ » « ┌────────────────┐ ░ ┌────────────────┐ ░ ┌─────────────────┐ ░ » «q: ┤ Clifford-1Q(5) ├─░─┤ Clifford-1Q(9) ├─░─┤ Clifford-1Q(13) ├─░─» « └────────────────┘ ░ └────────────────┘ ░ └─────────────────┘ ░ » « ┌─────────────────┐ ░ ┌─────────────────┐ ░ ┌─────────────────┐ ░ » «q: ┤ Clifford-1Q(16) ├─░─┤ Clifford-1Q(23) ├─░─┤ Clifford-1Q(14) ├─░─» « └─────────────────┘ ░ └─────────────────┘ ░ └─────────────────┘ ░ » « ┌─────────────────┐ ░ ┌────────────────┐ ░ ┌─────────────────┐ ░ » «q: ┤ Clifford-1Q(20) ├─░─┤ Clifford-1Q(4) ├─░─┤ Clifford-1Q(22) ├─░─» « └─────────────────┘ ░ └────────────────┘ ░ └─────────────────┘ ░ » « ┌─────────────────┐ ░ ┌─────────────────┐ ░ ┌────────────────┐ ░ » «q: ┤ Clifford-1Q(15) ├─░─┤ Clifford-1Q(17) ├─░─┤ Clifford-1Q(1) ├─░─» « └─────────────────┘ ░ └─────────────────┘ ░ └────────────────┘ ░ » « ┌─────────────────┐ ░ ┌────────────────┐ «q: ┤ Clifford-1Q(15) ├─░─┤ Clifford-1Q(6) ├ « └─────────────────┘ ░ └────────────────┘
rb2_qiskit_circuits[2].draw()
┌─────────────────────┐ ░ ┌────────────────────┐ ░ ┌────────────────────┐» q_0: ┤0 ├─░─┤0 ├─░─┤0 ├» │ Clifford-2Q(10054) │ ░ │ Clifford-2Q(6335) │ ░ │ Clifford-2Q(1386) │» q_1: ┤1 ├─░─┤1 ├─░─┤1 ├» └─────────────────────┘ ░ └────────────────────┘ ░ └────────────────────┘» « ░ ┌────────────────────┐ ░ ┌────────────────────┐ ░ » «q_0: ─░─┤0 ├─░─┤0 ├─░─» « ░ │ Clifford-2Q(8090) │ ░ │ Clifford-2Q(5190) │ ░ » «q_1: ─░─┤1 ├─░─┤1 ├─░─» « ░ └────────────────────┘ ░ └────────────────────┘ ░ » « ┌───────────────────┐ ░ ┌────────────────────┐ ░ ┌────────────────────┐» «q_0: ┤0 ├─░─┤0 ├─░─┤0 ├» « │ Clifford-2Q(670) │ ░ │ Clifford-2Q(7386) │ ░ │ Clifford-2Q(2027) │» «q_1: ┤1 ├─░─┤1 ├─░─┤1 ├» « └───────────────────┘ ░ └────────────────────┘ ░ └────────────────────┘» « ░ ┌────────────────────┐ ░ ┌───────────────────┐ ░ » «q_0: ─░─┤0 ├─░─┤0 ├─░─» « ░ │ Clifford-2Q(7388) │ ░ │ Clifford-2Q(798) │ ░ » «q_1: ─░─┤1 ├─░─┤1 ├─░─» « ░ └────────────────────┘ ░ └───────────────────┘ ░ » « ┌────────────────────┐ ░ ┌─────────────────────┐ ░ » «q_0: ┤0 ├─░─┤0 ├─░─» « │ Clifford-2Q(2606) │ ░ │ Clifford-2Q(10376) │ ░ » «q_1: ┤1 ├─░─┤1 ├─░─» « └────────────────────┘ ░ └─────────────────────┘ ░ » « ┌─────────────────────┐ ░ ┌───────────────────┐ ░ ┌────────────────────┐» «q_0: ┤0 ├─░─┤0 ├─░─┤0 ├» « │ Clifford-2Q(10137) │ ░ │ Clifford-2Q(815) │ ░ │ Clifford-2Q(1206) │» «q_1: ┤1 ├─░─┤1 ├─░─┤1 ├» « └─────────────────────┘ ░ └───────────────────┘ ░ └────────────────────┘» « ░ ┌────────────────────┐ ░ ┌────────────────────┐ «q_0: ─░─┤0 ├─░─┤0 ├ « ░ │ Clifford-2Q(6771) │ ░ │ Clifford-2Q(7167) │ «q_1: ─░─┤1 ├─░─┤1 ├ « ░ └────────────────────┘ ░ └────────────────────┘
You can then use the Qiskit transpile
function to obtain a representation of the circuits in your favorite set of basis gates.
# Choose basis gates
rb1_transpiled_circuits = transpile(
rb1_qiskit_circuits, basis_gates=["id", "sx", "x", "rz", "cx"]
)
rb2_transpiled_circuits = transpile(
rb2_qiskit_circuits, basis_gates=["id", "sx", "x", "rz", "cx"]
)
rb1_transpiled_circuits[2].draw()
┌──────────┐┌────┐┌─────────┐ ░ ┌────────┐┌────┐┌────────┐ ░ ┌────┐ ░ » q: ┤ Rz(-π/2) ├┤ √X ├┤ Rz(π/2) ├─░─┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├─░─┤ √X ├─░─» └──────────┘└────┘└─────────┘ ░ └────────┘└────┘└────────┘ ░ └────┘ ░ » « ┌─────────┐┌────┐┌────────┐ ░ ┌────────┐┌────┐┌─────────┐ ░ ┌──────────┐» «q: ┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├─░─┤ Rz(-π) ├┤ √X ├┤ Rz(π/2) ├─░─┤ Rz(-π/2) ├» « └─────────┘└────┘└────────┘ ░ └────────┘└────┘└─────────┘ ░ └──────────┘» « ┌────┐┌──────────┐ ░ ┌───┐┌─────────┐ ░ ┌─────────┐┌────┐ ░ ┌────┐» «q: ┤ √X ├┤ Rz(-π/2) ├─░─┤ X ├┤ Rz(π/2) ├─░─┤ Rz(π/2) ├┤ √X ├─░─┤ √X ├» « └────┘└──────────┘ ░ └───┘└─────────┘ ░ └─────────┘└────┘ ░ └────┘» « ┌────────┐ ░ ┌────────┐┌────┐ ░ ┌─────────┐ ░ ┌──────────┐ ░ ┌────────┐» «q: ┤ Rz(-π) ├─░─┤ Rz(-π) ├┤ √X ├─░─┤ Rz(π/2) ├─░─┤ Rz(-π/2) ├─░─┤ Rz(-π) ├» « └────────┘ ░ └────────┘└────┘ ░ └─────────┘ ░ └──────────┘ ░ └────────┘» « ┌────┐┌──────────┐ ░ ┌──────────┐┌────┐┌────────┐ ░ ┌─────────┐┌────┐» «q: ┤ √X ├┤ Rz(-π/2) ├─░─┤ Rz(-π/2) ├┤ √X ├┤ Rz(-π) ├─░─┤ Rz(π/2) ├┤ √X ├» « └────┘└──────────┘ ░ └──────────┘└────┘└────────┘ ░ └─────────┘└────┘» « ┌─────────┐ ░ ┌────────┐┌────┐┌──────────┐ ░ ┌───┐ «q: ┤ Rz(π/2) ├─░─┤ Rz(-π) ├┤ √X ├┤ Rz(-π/2) ├─░─┤ X ├ « └─────────┘ ░ └────────┘└────┘└──────────┘ ░ └───┘
rb1_program_list = []
for circuit in rb1_transpiled_circuits:
rb1_program_list.append(qasm3.dumps(circuit))
rb2_program_list = []
for circuit in rb2_transpiled_circuits:
rb2_program_list.append(qasm3.dumps(circuit))
print(rb1_program_list[2])
OPENQASM 3.0; include "stdgates.inc"; qubit[1] q; rz(-pi/2) q[0]; sx q[0]; rz(pi/2) q[0]; barrier q[0]; rz(-pi) q[0]; sx q[0]; rz(-pi) q[0]; barrier q[0]; sx q[0]; barrier q[0]; rz(pi/2) q[0]; sx q[0]; rz(-pi) q[0]; barrier q[0]; rz(-pi) q[0]; sx q[0]; rz(pi/2) q[0]; barrier q[0]; rz(-pi/2) q[0]; sx q[0]; rz(-pi/2) q[0]; barrier q[0]; x q[0]; rz(pi/2) q[0]; barrier q[0]; rz(pi/2) q[0]; sx q[0]; barrier q[0]; sx q[0]; rz(-pi) q[0]; barrier q[0]; rz(-pi) q[0]; sx q[0]; barrier q[0]; rz(pi/2) q[0]; barrier q[0]; rz(-pi/2) q[0]; barrier q[0]; rz(-pi) q[0]; sx q[0]; rz(-pi/2) q[0]; barrier q[0]; rz(-pi/2) q[0]; sx q[0]; rz(-pi) q[0]; barrier q[0]; rz(pi/2) q[0]; sx q[0]; rz(pi/2) q[0]; barrier q[0]; rz(-pi) q[0]; sx q[0]; rz(-pi/2) q[0]; barrier q[0]; x q[0];
4. Execute one Qubit RB¶
Define Gates, Load QASM 3 Program, and Go!¶
Now, you'll map your OpenQASM gates to signals produced on the instruments using register_gate
and register_gate_section
functions.
Once you've done that, you can compile your experiment and plot the output using the LabOne Q simulator.
rb1_gate_store = GateStore()
# Note: the below may need to be updated to match the
# names of your qubits from your QASM circuit!
rb1_qubit_map = {"q[0]": q0}
# Single qubit gates:
for oq3_qubit, l1q_qubit in rb1_qubit_map.items():
rb1_gate_store.register_gate(
"sx",
oq3_qubit,
drive_pulse(l1q_qubit, label="sx", amplitude_scale=0.5),
signal=l1q_qubit.signals["drive"],
)
rb1_gate_store.register_gate(
"x",
oq3_qubit,
drive_pulse(l1q_qubit, label="x"),
signal=l1q_qubit.signals["drive"],
)
rb1_gate_store.register_gate_section("rz", (oq3_qubit,), rz(l1q_qubit))
rb1_gate_store.register_gate_section(
"measure", (oq3_qubit,), measurement(l1q_qubit)
)
4.1 Compile and execute a single QASM program¶
rb1_exp = exp_from_qasm(
rb1_program_list[2], qubits=rb1_qubit_map, gate_store=rb1_gate_store
)
rb1_compiled_exp = my_session.compile(rb1_exp)
# _ = my_session.run(rb1_compiled_exp)
[2024.11.07 16:39:57.517] INFO Resolved modulation type of oscillator 'q0_readout_acquire_osc' on signal '/logical_signal_groups/q0/acquire_line' to SOFTWARE
[2024.11.07 16:39:57.518] INFO Resolved modulation type of oscillator 'q0_drive_ge_osc' on signal '/logical_signal_groups/q0/drive_line' to HARDWARE
[2024.11.07 16:39:57.519] INFO Starting LabOne Q Compiler run...
[2024.11.07 16:39:57.524] INFO Schedule completed. [0.002 s]
[2024.11.07 16:39:57.536] INFO Code generation completed for all AWGs. [0.011 s]
[2024.11.07 16:39:57.536] INFO Completed compilation step 1 of 1. [0.014 s]
[2024.11.07 16:39:57.540] INFO ────────────────────────────────────────────────────────────────
[2024.11.07 16:39:57.540] INFO Device AWG SeqC LOC CT entries Waveforms Samples
[2024.11.07 16:39:57.540] INFO ────────────────────────────────────────────────────────────────
[2024.11.07 16:39:57.541] INFO hdawg_0 0 4 1 0 0
[2024.11.07 16:39:57.542] INFO shfqc_0 0 3 0 0 0
[2024.11.07 16:39:57.542] INFO shfqc_0_sg 0 30 9 6 4416
[2024.11.07 16:39:57.543] INFO ────────────────────────────────────────────────────────────────
[2024.11.07 16:39:57.543] INFO TOTAL 37 10 4416
[2024.11.07 16:39:57.544] INFO ────────────────────────────────────────────────────────────────
[2024.11.07 16:39:57.548] INFO Finished LabOne Q Compiler run.
Draw the circuit from above¶
rb1_transpiled_circuits[2].draw()
┌──────────┐┌────┐┌─────────┐ ░ ┌────────┐┌────┐┌────────┐ ░ ┌────┐ ░ » q: ┤ Rz(-π/2) ├┤ √X ├┤ Rz(π/2) ├─░─┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├─░─┤ √X ├─░─» └──────────┘└────┘└─────────┘ ░ └────────┘└────┘└────────┘ ░ └────┘ ░ » « ┌─────────┐┌────┐┌────────┐ ░ ┌────────┐┌────┐┌─────────┐ ░ ┌──────────┐» «q: ┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├─░─┤ Rz(-π) ├┤ √X ├┤ Rz(π/2) ├─░─┤ Rz(-π/2) ├» « └─────────┘└────┘└────────┘ ░ └────────┘└────┘└─────────┘ ░ └──────────┘» « ┌────┐┌──────────┐ ░ ┌───┐┌─────────┐ ░ ┌─────────┐┌────┐ ░ ┌────┐» «q: ┤ √X ├┤ Rz(-π/2) ├─░─┤ X ├┤ Rz(π/2) ├─░─┤ Rz(π/2) ├┤ √X ├─░─┤ √X ├» « └────┘└──────────┘ ░ └───┘└─────────┘ ░ └─────────┘└────┘ ░ └────┘» « ┌────────┐ ░ ┌────────┐┌────┐ ░ ┌─────────┐ ░ ┌──────────┐ ░ ┌────────┐» «q: ┤ Rz(-π) ├─░─┤ Rz(-π) ├┤ √X ├─░─┤ Rz(π/2) ├─░─┤ Rz(-π/2) ├─░─┤ Rz(-π) ├» « └────────┘ ░ └────────┘└────┘ ░ └─────────┘ ░ └──────────┘ ░ └────────┘» « ┌────┐┌──────────┐ ░ ┌──────────┐┌────┐┌────────┐ ░ ┌─────────┐┌────┐» «q: ┤ √X ├┤ Rz(-π/2) ├─░─┤ Rz(-π/2) ├┤ √X ├┤ Rz(-π) ├─░─┤ Rz(π/2) ├┤ √X ├» « └────┘└──────────┘ ░ └──────────┘└────┘└────────┘ ░ └─────────┘└────┘» « ┌─────────┐ ░ ┌────────┐┌────┐┌──────────┐ ░ ┌───┐ «q: ┤ Rz(π/2) ├─░─┤ Rz(-π) ├┤ √X ├┤ Rz(-π/2) ├─░─┤ X ├ « └─────────┘ ░ └────────┘└────┘└──────────┘ ░ └───┘
Look at the pulse sheet¶
show_pulse_sheet(name="1-qubit RB", compiled_experiment=rb1_compiled_exp)
[2024.11.07 16:39:57.757] INFO Recompiling the experiment due to missing extra information in the compiled experiment. Compile with `OUTPUT_EXTRAS=True` and `MAX_EVENTS_TO_PUBLISH=1000` to bypass this step with a small impact on the compilation time.
[2024.11.07 16:39:57.762] INFO Resolved modulation type of oscillator 'q0_readout_acquire_osc' on signal '/logical_signal_groups/q0/acquire_line' to SOFTWARE
[2024.11.07 16:39:57.762] INFO Resolved modulation type of oscillator 'q0_drive_ge_osc' on signal '/logical_signal_groups/q0/drive_line' to HARDWARE
[2024.11.07 16:39:57.762] INFO Starting LabOne Q Compiler run...
[2024.11.07 16:39:57.767] INFO Schedule completed. [0.003 s]
[2024.11.07 16:39:57.777] INFO Code generation completed for all AWGs. [0.010 s]
[2024.11.07 16:39:57.778] INFO Completed compilation step 1 of 1. [0.014 s]
[2024.11.07 16:39:57.779] INFO Finished LabOne Q Compiler run.
[2024.11.07 16:39:57.788] INFO Writing html file to /builds/qccs/laboneq-applications/docs/sources/how-to-guides/sources/04_qasm/1-qubit RB_2024-11-07-16-39-57.html
4.2 Compile and execute a list of QASM programs¶
exp = exp_from_qasm_list(
rb1_program_list,
qubits=rb1_qubit_map,
gate_store=rb1_gate_store,
repetition_time=20e-5,
# batch_execution_mode="rt",
batch_execution_mode="pipeline",
do_reset=False,
count=1,
pipeline_chunk_count=2,
)
compiled_exp = my_session.compile(exp)
_ = my_session.run(compiled_exp)
[2024.11.07 16:39:57.833] INFO Resolved modulation type of oscillator 'q0_readout_acquire_osc' on signal '/logical_signal_groups/q0/acquire_line' to SOFTWARE
[2024.11.07 16:39:57.834] INFO Resolved modulation type of oscillator 'q0_drive_ge_osc' on signal '/logical_signal_groups/q0/drive_line' to HARDWARE
[2024.11.07 16:39:57.835] INFO Starting LabOne Q Compiler run...
[2024.11.07 16:39:57.843] INFO Schedule completed. [0.004 s]
[2024.11.07 16:39:57.996] INFO Code generation completed for all AWGs. [0.152 s]
[2024.11.07 16:39:57.996] INFO Completed compilation step 1 of 2. [0.158 s]
[2024.11.07 16:39:58.000] INFO Schedule completed. [0.003 s]
[2024.11.07 16:39:58.016] INFO Code generation completed for all AWGs. [0.015 s]
[2024.11.07 16:39:58.017] INFO Completed compilation step 2 of 2. [0.020 s]
[2024.11.07 16:39:58.021] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.022] INFO Step Device AWG SeqC LOC CT entries Waveforms Samples
[2024.11.07 16:39:58.022] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.023] INFO 0 hdawg_0 0 4 1 0 0
[2024.11.07 16:39:58.024] INFO shfqc_0 0 8 0 1 8000
[2024.11.07 16:39:58.024] INFO shfqc_0_sg 0 46 14 6 4416
[2024.11.07 16:39:58.025] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.026] INFO 1 hdawg_0 0 4 1 0 0
[2024.11.07 16:39:58.026] INFO shfqc_0 0 8 0 1 8000
[2024.11.07 16:39:58.027] INFO shfqc_0_sg 0 49 14 7 5216
[2024.11.07 16:39:58.028] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.028] INFO TOTAL 107 29 17632
[2024.11.07 16:39:58.029] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.036] INFO Finished LabOne Q Compiler run.
[2024.11.07 16:39:58.050] INFO Starting near-time execution...
[2024.11.07 16:39:58.089] INFO Finished near-time execution.
## KNOWN ISSUE - pulse sheet viewer and output simulation are not available
4.3 Compile and execute a list of QASM programs - including active qubit reset¶
# add reset operation to the gate store
for oq3_qubit, l1q_qubit in rb1_qubit_map.items():
rb1_gate_store.register_gate_section(
"reset", (oq3_qubit,), reset(l1q_qubit, drive_pulse(l1q_qubit, "reset"))
)
exp = exp_from_qasm_list(
rb1_program_list,
qubits=rb1_qubit_map,
gate_store=rb1_gate_store,
repetition_time=20e-5,
# batch_execution_mode="rt",
batch_execution_mode="pipeline",
do_reset=True,
count=1,
pipeline_chunk_count=3,
)
compiled_exp = my_session.compile(exp)
_ = my_session.run(compiled_exp)
[2024.11.07 16:39:58.147] INFO Resolved modulation type of oscillator 'q0_readout_acquire_osc' on signal '/logical_signal_groups/q0/acquire_line' to SOFTWARE
[2024.11.07 16:39:58.148] INFO Resolved modulation type of oscillator 'q0_drive_ge_osc' on signal '/logical_signal_groups/q0/drive_line' to HARDWARE
[2024.11.07 16:39:58.149] INFO Starting LabOne Q Compiler run...
[2024.11.07 16:39:58.157] INFO Due to feedback latency constraints, the timing of the following match sections with corresponding handles were changed: [2024.11.07 16:39:58.157] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns [2024.11.07 16:39:58.157] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns
[2024.11.07 16:39:58.157] INFO Schedule completed. [0.005 s]
[2024.11.07 16:39:58.171] INFO Code generation completed for all AWGs. [0.013 s]
[2024.11.07 16:39:58.172] INFO Completed compilation step 1 of 3. [0.019 s]
[2024.11.07 16:39:58.176] INFO Due to feedback latency constraints, the timing of the following match sections with corresponding handles were changed: [2024.11.07 16:39:58.176] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns [2024.11.07 16:39:58.176] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns [2024.11.07 16:39:58.176] INFO [2 similar messages suppressed, see log file for full set of messages.]
[2024.11.07 16:39:58.177] INFO Schedule completed. [0.004 s]
[2024.11.07 16:39:58.193] INFO Code generation completed for all AWGs. [0.016 s]
[2024.11.07 16:39:58.194] INFO Completed compilation step 2 of 3. [0.021 s]
[2024.11.07 16:39:58.198] INFO Due to feedback latency constraints, the timing of the following match sections with corresponding handles were changed: [2024.11.07 16:39:58.198] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns [2024.11.07 16:39:58.198] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns [2024.11.07 16:39:58.198] INFO [4 similar messages suppressed, see log file for full set of messages.]
[2024.11.07 16:39:58.199] INFO Schedule completed. [0.004 s]
[2024.11.07 16:39:58.214] INFO Code generation completed for all AWGs. [0.015 s]
[2024.11.07 16:39:58.215] INFO Completed compilation step 3 of 3. [0.021 s]
[2024.11.07 16:39:58.221] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.221] INFO Step Device AWG SeqC LOC CT entries Waveforms Samples
[2024.11.07 16:39:58.222] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.223] INFO 0 hdawg_0 0 4 1 0 0
[2024.11.07 16:39:58.223] INFO shfqc_0 0 9 0 1 8000
[2024.11.07 16:39:58.224] INFO shfqc_0_sg 0 47 12 7 4832
[2024.11.07 16:39:58.225] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.225] INFO 1 hdawg_0 0 4 1 0 0
[2024.11.07 16:39:58.226] INFO shfqc_0 0 9 0 1 8000
[2024.11.07 16:39:58.227] INFO shfqc_0_sg 0 52 15 8 5632
[2024.11.07 16:39:58.227] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.228] INFO 2 hdawg_0 0 4 1 0 0
[2024.11.07 16:39:58.229] INFO shfqc_0 0 9 0 1 8000
[2024.11.07 16:39:58.229] INFO shfqc_0_sg 0 54 15 8 5632
[2024.11.07 16:39:58.230] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.231] INFO TOTAL 166 43 24096
[2024.11.07 16:39:58.231] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.240] INFO Finished LabOne Q Compiler run.
[2024.11.07 16:39:58.254] INFO Starting near-time execution...
[2024.11.07 16:39:58.306] INFO Finished near-time execution.
5. Execute two Qubit RB¶
Define Gates, Load QASM 3 Program, and Go!¶
Now, you'll map your OpenQASM gates to signals produced on the instruments using register_gate
and register_gate_section
functions.
Once you've done that, you can compile your experiment and plot the output using the LabOne Q simulator.
rb2_gate_store = GateStore()
# Note: the below may need to be updated to match the
# names of your qubits from your QASM circuit!
rb2_qubit_map = {"q[0]": q0, "q[1]": q1}
# Single qubit gates:
for oq3_qubit, l1q_qubit in rb2_qubit_map.items():
rb2_gate_store.register_gate(
"sx",
oq3_qubit,
drive_pulse(l1q_qubit, label="sx", amplitude_scale=0.5),
signal=l1q_qubit.signals["drive"],
)
rb2_gate_store.register_gate(
"x",
oq3_qubit,
drive_pulse(l1q_qubit, label="x"),
signal=l1q_qubit.signals["drive"],
)
rb2_gate_store.register_gate_section("rz", (oq3_qubit,), rz(l1q_qubit))
rb2_gate_store.register_gate_section(
"measure", (oq3_qubit,), measurement(l1q_qubit)
)
# Two qubit gates:
rb2_gate_store.register_gate_section("cx", ("q[0]", "q[1]"), cx(q0, q1))
rb2_gate_store.register_gate_section("cx", ("q[1]", "q[0]"), cx(q1, q0))
5.1 Compile and execute a single QASM program¶
rb2_exp = exp_from_qasm(
rb2_program_list[2], qubits=rb2_qubit_map, gate_store=rb2_gate_store
)
rb2_compiled_exp = my_session.compile(rb2_exp)
_ = my_session.run(rb2_compiled_exp)
[2024.11.07 16:39:58.377] INFO Resolved modulation type of oscillator 'q0_readout_acquire_osc' on signal '/logical_signal_groups/q0/acquire_line' to SOFTWARE
[2024.11.07 16:39:58.378] INFO Resolved modulation type of oscillator 'q0_drive_ge_osc' on signal '/logical_signal_groups/q0/drive_line' to HARDWARE
[2024.11.07 16:39:58.378] INFO Resolved modulation type of oscillator 'q1_readout_acquire_osc' on signal '/logical_signal_groups/q1/acquire_line' to SOFTWARE
[2024.11.07 16:39:58.379] INFO Resolved modulation type of oscillator 'q1_drive_ge_osc' on signal '/logical_signal_groups/q1/drive_line' to HARDWARE
[2024.11.07 16:39:58.380] INFO Starting LabOne Q Compiler run...
[2024.11.07 16:39:58.392] INFO Schedule completed. [0.008 s]
[2024.11.07 16:39:58.439] INFO Code generation completed for all AWGs. [0.046 s]
[2024.11.07 16:39:58.440] INFO Completed compilation step 1 of 1. [0.055 s]
[2024.11.07 16:39:58.443] INFO ────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.444] INFO Device AWG SeqC LOC CT entries Waveforms Samples
[2024.11.07 16:39:58.444] INFO ────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.445] INFO hdawg_0 0 113 9 8 3328
[2024.11.07 16:39:58.446] INFO shfqc_0 0 3 0 0 0
[2024.11.07 16:39:58.446] INFO shfqc_0_sg 0 148 27 14 8512
[2024.11.07 16:39:58.447] INFO shfqc_0_sg 1 144 26 17 10912
[2024.11.07 16:39:58.448] INFO ────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.448] INFO TOTAL 408 62 22752
[2024.11.07 16:39:58.449] INFO ────────────────────────────────────────────────────────────────
[2024.11.07 16:39:58.458] INFO Finished LabOne Q Compiler run.
[2024.11.07 16:39:58.475] INFO Starting near-time execution...
[2024.11.07 16:39:58.507] INFO Finished near-time execution.
plot_simulation(
rb2_compiled_exp,
length=15e-6,
plot_width=12,
plot_height=3,
signals=[
"/logical_signal_groups/q0/flux_line",
"/logical_signal_groups/q1/flux_line",
"/logical_signal_groups/q0/drive_line",
"/logical_signal_groups/q1/drive_line",
],
)
Draw the circuit from above¶
rb2_transpiled_circuits[2].draw()
┌────────┐┌────┐┌────────┐ ┌──────────┐┌────┐ ░ » q_0: ┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├──■──┤ Rz(-π/2) ├┤ √X ├─────────────░─» ├────────┤├────┤├────────┤┌─┴─┐└┬────────┬┘├────┤┌──────────┐ ░ » q_1: ┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├┤ X ├─┤ Rz(-π) ├─┤ √X ├┤ Rz(-π/2) ├─░─» └────────┘└────┘└────────┘└───┘ └────────┘ └────┘└──────────┘ ░ » « ┌─────────┐ ┌────┐ ┌─────────┐ ┌───┐ ┌────┐ ┌──────────┐ ░ » «q_0: ┤ Rz(π/2) ├───┤ √X ├──┤ Rz(π/2) ├──■──┤ X ├───┤ √X ├──┤ Rz(-π/2) ├─░─» « └──┬────┬─┘┌──┴────┴─┐└─────────┘┌─┴─┐└─┬─┘┌──┴────┴─┐└──┬────┬──┘ ░ » «q_1: ───┤ √X ├──┤ Rz(π/2) ├───────────┤ X ├──■──┤ Rz(π/2) ├───┤ √X ├────░─» « └────┘ └─────────┘ └───┘ └─────────┘ └────┘ ░ » « ┌────┐┌─────────┐ ┌────────┐ ┌────┐┌──────────┐ ░ ┌─────────┐» «q_0: ┤ √X ├┤ Rz(π/2) ├──■───┤ Rz(-π) ├─┤ √X ├┤ Rz(-π/2) ├─░─┤ Rz(π/2) ├» « ├────┤├─────────┤┌─┴─┐┌┴────────┴┐├────┤└┬────────┬┘ ░ └──┬────┬─┘» «q_1: ┤ √X ├┤ Rz(π/2) ├┤ X ├┤ Rz(-π/2) ├┤ √X ├─┤ Rz(-π) ├──░────┤ √X ├──» « └────┘└─────────┘└───┘└──────────┘└────┘ └────────┘ ░ └────┘ » « ┌────────┐┌────┐┌──────────┐ ░ ┌─────────┐┌────┐» «q_0: ─────────────■──┤ Rz(-π) ├┤ √X ├┤ Rz(-π/2) ├─░─┤ Rz(π/2) ├┤ √X ├» « ┌─────────┐┌─┴─┐├────────┤├────┤├──────────┤ ░ └┬────────┤├────┤» «q_1: ┤ Rz(π/2) ├┤ X ├┤ Rz(-π) ├┤ √X ├┤ Rz(-π/2) ├─░──┤ Rz(-π) ├┤ √X ├» « └─────────┘└───┘└────────┘└────┘└──────────┘ ░ └────────┘└────┘» « ┌────────┐ ┌────────┐┌────┐┌─────────┐ ░ » «q_0: ┤ Rz(-π) ├──■──┤ Rz(-π) ├┤ √X ├┤ Rz(π/2) ├─░────────────────────────────» « ├────────┤┌─┴─┐├───────┬┘├───┬┘└─────────┘ ░ ┌─────────┐┌────┐┌────────┐» «q_1: ┤ Rz(-π) ├┤ X ├┤ Rz(π) ├─┤ X ├─────────────░─┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├» « └────────┘└───┘└───────┘ └───┘ ░ └─────────┘└────┘└────────┘» « ┌───────┐ ░ ┌────────┐┌────┐┌────────┐ ┌───────┐┌───┐ ░ » «q_0: ──■──┤ Rz(π) ├──────░──┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├──■──┤ Rz(π) ├┤ X ├─░─» « ┌─┴─┐├───────┤┌───┐ ░ ┌┴────────┤├────┤├────────┤┌─┴─┐├───────┤├───┤ ░ » «q_1: ┤ X ├┤ Rz(π) ├┤ X ├─░─┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├┤ X ├┤ Rz(π) ├┤ X ├─░─» « └───┘└───────┘└───┘ ░ └─────────┘└────┘└────────┘└───┘└───────┘└───┘ ░ » « ┌─────────┐┌────┐┌────────┐ ┌────────┐┌────┐┌──────────┐ ░ » «q_0: ┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├──■───┤ Rz(-π) ├┤ √X ├┤ Rz(-π/2) ├─░─» « └─────────┘└────┘└────────┘┌─┴─┐┌┴────────┤├────┤└──────────┘ ░ » «q_1: ───────────────────────────┤ X ├┤ Rz(π/2) ├┤ √X ├─────────────░─» « └───┘└─────────┘└────┘ ░ » « ┌────────┐┌────┐┌────────┐ ┌───────┐ ░ » «q_0: ─┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├──■──┤ Rz(π) ├─░────────────────────────────» « ┌┴────────┤├────┤├────────┤┌─┴─┐└───────┘ ░ ┌─────────┐┌────┐┌────────┐» «q_1: ┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├┤ X ├──────────░─┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├» « └─────────┘└────┘└────────┘└───┘ ░ └─────────┘└────┘└────────┘» « ┌─────────┐ ┌────┐ ░ ┌─────────┐┌────┐┌────────┐ » «q_0: ──■──┤ Rz(π/2) ├─┤ √X ├───────────░─┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├──■──» « ┌─┴─┐├─────────┴┐├────┤┌────────┐ ░ ├─────────┤├────┤├────────┤┌─┴─┐» «q_1: ┤ X ├┤ Rz(-π/2) ├┤ √X ├┤ Rz(-π) ├─░─┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├┤ X ├» « └───┘└──────────┘└────┘└────────┘ ░ └─────────┘└────┘└────────┘└───┘» « ┌───────┐ ░ ┌────────┐┌────┐┌────────┐ » «q_0: ┤ Rz(π) ├────────────────────░──┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├──■──» « ├───────┴┐┌────┐┌──────────┐ ░ ┌┴────────┤└────┘└────────┘┌─┴─┐» «q_1: ┤ Rz(-π) ├┤ √X ├┤ Rz(-π/2) ├─░─┤ Rz(π/2) ├────────────────┤ X ├» « └────────┘└────┘└──────────┘ ░ └─────────┘ └───┘» « ┌──────────┐ ┌────┐ ┌────────┐ ░ ┌────────┐┌────┐┌────────┐ ┌───┐» «q_0: ┤ Rz(-π/2) ├───┤ √X ├──┤ Rz(-π) ├─░─┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├──■──┤ X ├» « └──┬────┬──┘┌──┴────┴─┐└────────┘ ░ ├────────┤├────┤├────────┤┌─┴─┐└─┬─┘» «q_1: ───┤ √X ├───┤ Rz(π/2) ├───────────░─┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├┤ X ├──■──» « └────┘ └─────────┘ ░ └────────┘└────┘└────────┘└───┘ » « ┌────────┐┌────┐┌──────────┐ ░ ┌───┐» «q_0: ┤ Rz(-π) ├┤ √X ├┤ Rz(-π/2) ├─░──────────────────────────────■──┤ X ├» « └─┬───┬──┘└────┘└──────────┘ ░ ┌─────────┐┌────┐┌────────┐┌─┴─┐└─┬─┘» «q_1: ──┤ X ├──────────────────────░─┤ Rz(π/2) ├┤ √X ├┤ Rz(-π) ├┤ X ├──■──» « └───┘ ░ └─────────┘└────┘└────────┘└───┘ » « ┌───────┐ ░ ┌────┐┌─────────┐ ┌───┐ ┌────────┐ ┌────┐┌─────────┐ ░ » «q_0: ┤ Rz(π) ├─░─┤ √X ├┤ Rz(π/2) ├──■──┤ X ├─┤ Rz(-π) ├─┤ √X ├┤ Rz(π/2) ├─░─» « ├───────┤ ░ └────┘└─────────┘┌─┴─┐└─┬─┘┌┴────────┴┐├────┤└┬────────┤ ░ » «q_1: ┤ Rz(π) ├─░──────────────────┤ X ├──■──┤ Rz(-π/2) ├┤ √X ├─┤ Rz(-π) ├─░─» « └───────┘ ░ └───┘ └──────────┘└────┘ └────────┘ ░ » « ┌────────┐┌────┐┌────────┐ ░ ┌────────┐ ┌────┐ » «q_0: ┤ Rz(-π) ├┤ √X ├┤ Rz(-π) ├──■────────────────────░─┤ Rz(-π) ├───┤ √X ├──» « └────────┘└────┘└────────┘┌─┴─┐┌─────────┐┌────┐ ░ └─┬────┬─┘┌──┴────┴─┐» «q_1: ──────────────────────────┤ X ├┤ Rz(π/2) ├┤ √X ├─░───┤ √X ├──┤ Rz(π/2) ├» « └───┘└─────────┘└────┘ ░ └────┘ └─────────┘» « ┌────────┐ ┌─────────┐┌────┐ «q_0: ┤ Rz(-π) ├──■──┤ Rz(π/2) ├┤ √X ├ « └────────┘┌─┴─┐└┬───────┬┘└────┘ «q_1: ──────────┤ X ├─┤ Rz(π) ├─────── « └───┘ └───────┘
Look at the pulse sheet¶
show_pulse_sheet(
name="2-qubit RB", compiled_experiment=rb2_compiled_exp, max_events_to_publish=10e4
)
[2024.11.07 16:39:58.994] INFO Recompiling the experiment due to missing extra information in the compiled experiment. Compile with `OUTPUT_EXTRAS=True` and `MAX_EVENTS_TO_PUBLISH=100000.0` to bypass this step with a small impact on the compilation time.
[2024.11.07 16:39:59.006] INFO Resolved modulation type of oscillator 'q0_readout_acquire_osc' on signal '/logical_signal_groups/q0/acquire_line' to SOFTWARE
[2024.11.07 16:39:59.007] INFO Resolved modulation type of oscillator 'q0_drive_ge_osc' on signal '/logical_signal_groups/q0/drive_line' to HARDWARE
[2024.11.07 16:39:59.007] INFO Resolved modulation type of oscillator 'q1_readout_acquire_osc' on signal '/logical_signal_groups/q1/acquire_line' to SOFTWARE
[2024.11.07 16:39:59.008] INFO Resolved modulation type of oscillator 'q1_drive_ge_osc' on signal '/logical_signal_groups/q1/drive_line' to HARDWARE
[2024.11.07 16:39:59.009] INFO Starting LabOne Q Compiler run...
[2024.11.07 16:39:59.028] INFO Schedule completed. [0.015 s]
[2024.11.07 16:39:59.074] INFO Code generation completed for all AWGs. [0.046 s]
[2024.11.07 16:39:59.075] INFO Completed compilation step 1 of 1. [0.062 s]
[2024.11.07 16:39:59.078] INFO Finished LabOne Q Compiler run.
[2024.11.07 16:39:59.109] INFO Writing html file to /builds/qccs/laboneq-applications/docs/sources/how-to-guides/sources/04_qasm/2-qubit RB_2024-11-07-16-39-58.html
5.2 Compile and execute a list of QASM programs¶
exp = exp_from_qasm_list(
rb2_program_list,
qubits=rb2_qubit_map,
gate_store=rb2_gate_store,
repetition_time=100e-5,
# batch_execution_mode="rt",
batch_execution_mode="pipeline",
do_reset=False,
count=1,
pipeline_chunk_count=3,
)
compiled_exp = my_session.compile(exp)
_ = my_session.run(compiled_exp)
[2024.11.07 16:39:59.490] INFO Resolved modulation type of oscillator 'q0_readout_acquire_osc' on signal '/logical_signal_groups/q0/acquire_line' to SOFTWARE
[2024.11.07 16:39:59.491] INFO Resolved modulation type of oscillator 'q0_drive_ge_osc' on signal '/logical_signal_groups/q0/drive_line' to HARDWARE
[2024.11.07 16:39:59.492] INFO Resolved modulation type of oscillator 'q1_readout_acquire_osc' on signal '/logical_signal_groups/q1/acquire_line' to SOFTWARE
[2024.11.07 16:39:59.492] INFO Resolved modulation type of oscillator 'q1_drive_ge_osc' on signal '/logical_signal_groups/q1/drive_line' to HARDWARE
[2024.11.07 16:39:59.495] INFO Starting LabOne Q Compiler run...
[2024.11.07 16:39:59.523] INFO Schedule completed. [0.015 s]
[2024.11.07 16:39:59.578] INFO Code generation completed for all AWGs. [0.054 s]
[2024.11.07 16:39:59.578] INFO Completed compilation step 1 of 3. [0.070 s]
[2024.11.07 16:39:59.596] INFO Schedule completed. [0.017 s]
[2024.11.07 16:39:59.680] INFO Code generation completed for all AWGs. [0.080 s]
[2024.11.07 16:39:59.682] INFO Completed compilation step 2 of 3. [0.103 s]
[2024.11.07 16:39:59.703] INFO Schedule completed. [0.021 s]
[2024.11.07 16:39:59.814] INFO Code generation completed for all AWGs. [0.110 s]
[2024.11.07 16:39:59.818] INFO Completed compilation step 3 of 3. [0.135 s]
[2024.11.07 16:39:59.828] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:59.829] INFO Step Device AWG SeqC LOC CT entries Waveforms Samples
[2024.11.07 16:39:59.829] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:59.829] INFO 0 hdawg_0 0 92 5 4 1664
[2024.11.07 16:39:59.830] INFO shfqc_0 0 11 0 2 16000
[2024.11.07 16:39:59.830] INFO shfqc_0_sg 0 126 18 8 4480
[2024.11.07 16:39:59.831] INFO shfqc_0_sg 1 116 18 10 6848
[2024.11.07 16:39:59.831] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:59.831] INFO 1 hdawg_0 0 148 9 8 3328
[2024.11.07 16:39:59.832] INFO shfqc_0 0 11 0 2 16000
[2024.11.07 16:39:59.832] INFO shfqc_0_sg 0 194 30 15 9312
[2024.11.07 16:39:59.833] INFO shfqc_0_sg 1 182 28 17 10912
[2024.11.07 16:39:59.833] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:59.833] INFO 2 hdawg_0 0 192 9 8 3328
[2024.11.07 16:39:59.834] INFO shfqc_0 0 11 0 2 16000
[2024.11.07 16:39:59.834] INFO shfqc_0_sg 0 233 29 16 10112
[2024.11.07 16:39:59.834] INFO shfqc_0_sg 1 220 26 16 10112
[2024.11.07 16:39:59.835] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:59.835] INFO TOTAL 1514 172 76096
[2024.11.07 16:39:59.837] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:39:59.859] INFO Finished LabOne Q Compiler run.
[2024.11.07 16:39:59.908] INFO Starting near-time execution...
[2024.11.07 16:39:59.993] INFO Finished near-time execution.
## KNOWN ISSUE - pulse sheet viewer and output simulation are not available
5.3 Compile and execute a list of QASM programs - including active qubit reset¶
# add reset operation to the gate store
for oq3_qubit, l1q_qubit in rb2_qubit_map.items():
rb2_gate_store.register_gate_section(
"reset", (oq3_qubit,), reset(l1q_qubit, drive_pulse(l1q_qubit, "reset"))
)
exp = exp_from_qasm_list(
rb2_program_list,
qubits=rb2_qubit_map,
gate_store=rb2_gate_store,
repetition_time=100e-5,
# batch_execution_mode="rt",
batch_execution_mode="pipeline",
do_reset=True,
count=1,
pipeline_chunk_count=3,
)
compiled_exp = my_session.compile(exp)
_ = my_session.run(compiled_exp)
[2024.11.07 16:40:00.543] INFO Resolved modulation type of oscillator 'q0_readout_acquire_osc' on signal '/logical_signal_groups/q0/acquire_line' to SOFTWARE
[2024.11.07 16:40:00.544] INFO Resolved modulation type of oscillator 'q0_drive_ge_osc' on signal '/logical_signal_groups/q0/drive_line' to HARDWARE
[2024.11.07 16:40:00.544] INFO Resolved modulation type of oscillator 'q1_readout_acquire_osc' on signal '/logical_signal_groups/q1/acquire_line' to SOFTWARE
[2024.11.07 16:40:00.545] INFO Resolved modulation type of oscillator 'q1_drive_ge_osc' on signal '/logical_signal_groups/q1/drive_line' to HARDWARE
[2024.11.07 16:40:00.552] INFO Starting LabOne Q Compiler run...
[2024.11.07 16:40:00.599] INFO Due to feedback latency constraints, the timing of the following match sections with corresponding handles were changed: [2024.11.07 16:40:00.599] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns [2024.11.07 16:40:00.599] INFO - 'q1_feedback' with handle 'q1_qubit_state', delayed by 272.00 ns [2024.11.07 16:40:00.599] INFO [2 similar messages suppressed, see log file for full set of messages.]
[2024.11.07 16:40:00.603] INFO Schedule completed. [0.027 s]
[2024.11.07 16:40:00.694] INFO Code generation completed for all AWGs. [0.091 s]
[2024.11.07 16:40:00.695] INFO Completed compilation step 1 of 3. [0.119 s]
[2024.11.07 16:40:00.718] INFO Due to feedback latency constraints, the timing of the following match sections with corresponding handles were changed: [2024.11.07 16:40:00.718] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns [2024.11.07 16:40:00.718] INFO - 'q1_feedback' with handle 'q1_qubit_state', delayed by 272.00 ns [2024.11.07 16:40:00.718] INFO [6 similar messages suppressed, see log file for full set of messages.]
[2024.11.07 16:40:00.723] INFO Schedule completed. [0.027 s]
[2024.11.07 16:40:00.848] INFO Code generation completed for all AWGs. [0.124 s]
[2024.11.07 16:40:00.854] INFO Completed compilation step 2 of 3. [0.158 s]
[2024.11.07 16:40:00.882] INFO Due to feedback latency constraints, the timing of the following match sections with corresponding handles were changed: [2024.11.07 16:40:00.882] INFO - 'q0_feedback' with handle 'q0_qubit_state', delayed by 272.00 ns [2024.11.07 16:40:00.882] INFO - 'q1_feedback' with handle 'q1_qubit_state', delayed by 272.00 ns [2024.11.07 16:40:00.882] INFO [10 similar messages suppressed, see log file for full set of messages.]
[2024.11.07 16:40:00.883] INFO Schedule completed. [0.028 s]
[2024.11.07 16:40:01.027] INFO Code generation completed for all AWGs. [0.143 s]
[2024.11.07 16:40:01.031] INFO Completed compilation step 3 of 3. [0.176 s]
[2024.11.07 16:40:01.043] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:40:01.044] INFO Step Device AWG SeqC LOC CT entries Waveforms Samples
[2024.11.07 16:40:01.045] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:40:01.045] INFO 0 hdawg_0 0 92 5 4 1664
[2024.11.07 16:40:01.046] INFO shfqc_0 0 12 0 2 16000
[2024.11.07 16:40:01.046] INFO shfqc_0_sg 0 137 20 9 4896
[2024.11.07 16:40:01.047] INFO shfqc_0_sg 1 127 20 11 7264
[2024.11.07 16:40:01.047] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:40:01.047] INFO 1 hdawg_0 0 148 9 8 3328
[2024.11.07 16:40:01.048] INFO shfqc_0 0 12 0 2 16000
[2024.11.07 16:40:01.048] INFO shfqc_0_sg 0 205 32 16 9728
[2024.11.07 16:40:01.049] INFO shfqc_0_sg 1 193 30 18 11328
[2024.11.07 16:40:01.049] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:40:01.050] INFO 2 hdawg_0 0 192 9 8 3328
[2024.11.07 16:40:01.052] INFO shfqc_0 0 12 0 2 16000
[2024.11.07 16:40:01.052] INFO shfqc_0_sg 0 244 31 17 10528
[2024.11.07 16:40:01.054] INFO shfqc_0_sg 1 231 28 17 10528
[2024.11.07 16:40:01.054] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:40:01.057] INFO TOTAL 1581 184 78592
[2024.11.07 16:40:01.058] INFO ───────────────────────────────────────────────────────────────────────
[2024.11.07 16:40:01.078] INFO Finished LabOne Q Compiler run.
[2024.11.07 16:40:01.119] INFO Starting near-time execution...
[2024.11.07 16:40:01.203] INFO Finished near-time execution.