Reuse QickSoc object when PL is already programmed
joelievt opened this issue · comments
I'm seeking a simple way to instantiate the QickSoc
object in a new kernel without reprogramming the PL if it is already programmed.
I would like to create a script that automatically programmed the PL running QickSoc.__init__()
at boot, and then be able to use qick in different kernels without having to reprogram the PL again, the issue is that soc = QickSoc()
always reprograms it.
I'm considering two approaches:
-
Creating a single reusable QickSoc object across multiple kernels. Attempted this with pickle, but is not possible because ctypes objects with pointers cannot be pickled.
-
Modifying the QickSoc init method to allow instantiation without reprogramming the PL. A first solution I tried involves making the
config_clocks()
call optional. Although it seems to work, I haven't tested it enough to confirm it won't have undesired effects.
Seeking advice on simpler or more reliable methods. Any insights would be appreciated.
I've never looked into this, but I doubt it would work. I think you're focusing on the parts of QickSoc that deal with high-level config and the interface to the user, but the fundamental purpose of the object (as a subclass of PYNQ.Overlay) is to encapsulate the memory-mapped interfaces to the firmware in the FPGA, everything else is built on top of that. It seems like if you create a new QickSoc without instantiating the Overlay (or saving the pointers that are inside the Overlay) you will have a pure software object without a connection to the FPGA, which is useless.
I think what you want to do is already provided by the Pyro interface described in https://github.com/openquantumhardware/qick/blob/main/pyro4/00_nameserver.ipynb - most people with complex experiments run QICK in this way.
In principle the connection to the FPGA is being made, since I have not altered the QickSoc
instantiation, which doesn't program the FPGA at that point
Overlay.__init__(self, bitfile_path(
), ignore_version=ignore_version, download=False, **kwargs)
The part I am avoiding is the Overlay.download()
call performed inside the QickSoc.config_clocks()
method. I only did a quick loopback test and I can generate and receive a pulse, but my concern was about introducing subtle errors which may not be trivial to detect.
However, as you have suggested, I have taken a look at the Pyro interface, and it looks like I can reuse a QickSoc object with it, which is what I was originally trying to achieve.