Qililab is a generic and scalable quantum control library used for fast characterization and calibration of quantum chips. Qililab also offers the ability to execute high-level quantum algorithms with your quantum hardware.
Apache License 2.0
30
stars
2
forks
source link
[BUG] QPySequence cache for QProgram execution messes up with instrument sync/desync #692
When execution starts all sequencers that will be used in the execution are marked as synced and when execution finishes they are desynced.
This behavior should happen both when executing QProgram a single time like platform.execute_qprogram(qp) and when executing inside a software loop
for frequency in frequencies:
platform.set_parameter("drive_q0_bus", Parameter.LO_FREQUENCY, frequency)
platform.execute_qprogram(qp)
Actual behavior
When executing QProgram within a software loop, the sequencers are desynced after the first iteration, and stay desynced. This is because the syncing happens in the upload_qpysequence() method which is only called the first time (since the rest the cache is populated and upload is not called).
# qililab/instruments/qblox/qblox_module.py
def upload_qpysequence(self, qpysequence: QpySequence, port: str):
"""Upload the qpysequence to its corresponding sequencer.
Args:
qpysequence (QpySequence): The qpysequence to upload.
port (str): The port of the sequencer to upload to.
"""
sequencers = self.get_sequencers_from_chip_port_id(chip_port_id=port)
for sequencer in sequencers:
logger.info("Sequence program: \n %s", repr(qpysequence._program)) # pylint: disable=protected-access
self.device.sequencers[sequencer.identifier].sequence(qpysequence.todict())
self.device.sequencers[sequencer.identifier].sync_en(True)
self.sequences[sequencer.identifier] = qpysequence
The desyncing however happens at the end of the platform.execute_qprogram() method, so after the first iteration the sequencers are desynced and never synced again.
Additional information
We should be able to defer the desyncing after all iterations of the software loop are done.
This is not possible right now, because the execute_qprogram() has no knowledge of what happens outside. One idea is to wrap the whole execution in a context manager, which will be responsible for interacting with the instruments. This can also involve the chain of initial_setup, turn_on_instruments, etc.
with platform.execution() as execution:
for frequency in frequencies:
platform.set_parameter("drive_q0_bus", Parameter.LO_FREQUENCY, frequency)
platform.execute_qprogram(qp)
Expected behavior
When execution starts all sequencers that will be used in the execution are marked as synced and when execution finishes they are desynced.
This behavior should happen both when executing QProgram a single time like
platform.execute_qprogram(qp)
and when executing inside a software loopActual behavior
When executing QProgram within a software loop, the sequencers are desynced after the first iteration, and stay desynced. This is because the syncing happens in the
upload_qpysequence()
method which is only called the first time (since the rest the cache is populated and upload is not called).The desyncing however happens at the end of the
platform.execute_qprogram()
method, so after the first iteration the sequencers are desynced and never synced again.Additional information
We should be able to defer the desyncing after all iterations of the software loop are done.
This is not possible right now, because the
execute_qprogram()
has no knowledge of what happens outside. One idea is to wrap the whole execution in a context manager, which will be responsible for interacting with the instruments. This can also involve the chain ofinitial_setup
,turn_on_instruments
, etc.Source code
No response
Tracebacks
No response
System Information
Existing GitHub issues