Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run() and compile() methods of zhinst.qcodes.control.drivers.hdawg.AWG do not support 2x4 and 1x8 channelgrouping #25

Open
haroldmeerwaldt opened this issue Dec 3, 2021 · 3 comments

Comments

@haroldmeerwaldt
Copy link

Hi there,

I would like to use the 1x8 channelgrouping of the HDAWG8, so I can run programs from all 8 outputs synchronized.

The zhinst.qcodes HDAWG driver has 4 qcodes InstrumentChannels of class zhinst.qcodes.control.drivers.hdawg.AWG, regardless of channelgrouping, matching the 4 physical FPGAs I imagine.

If I switch to 1x8 channelgrouping, some methods work fine on the 4 InstrumentChannels (e.g. outputs). The run() method executes, but does not do anything (perhaps the set_sequence_params method as well) . The compile method fails with the following error:

ERROR: hdawg.awgs[3].compile()
hdawg-awg-3: Sequencer status: ELF upload failed!
Traceback (most recent call last):

  File "D:\users\hw_sw_integration\projects\low-level-software\untitled1.py", line 27, in <module>
    hdawg.awgs[3].compile()

  File "D:\users\hw_sw_integration\venv-3.9\lib\site-packages\zhinst\qcodes\control\drivers\hdawg.py", line 256, in compile
    self._awg.compile()

  File "D:\users\hw_sw_integration\venv-3.9\lib\site-packages\zhinst\toolkit\control\drivers\base\awg.py", line 303, in compile
    _logger.error(

  File "D:\users\hw_sw_integration\venv-3.9\lib\site-packages\zhinst\toolkit\interface\interface.py", line 193, in error
    raise LoggerModule.ToolkitError(msg)

ToolkitError: hdawg-awg-3: Sequencer status: ELF upload failed!

The following script will reproduce the error:

from zhinst.qcodes import HDAWG

hdawg = HDAWG("hdawg", "DEV8049")

hdawg.system.awg.channelgrouping(0)  # 4x2 channelgrouping

hdawg.awgs[3].set_sequence_params(sequence_type="Custom", program="")
hdawg.awgs[3].compile()
hdawg.awgs[3].run()
hdawg.awgs[3].output1("on")
hdawg.awgs[3].output1("off")
hdawg.awgs[3].stop()

hdawg.system.awg.channelgrouping(2)  # 1x8 channelgrouping

hdawg.awgs[3].set_sequence_params(sequence_type="Custom", program="")
hdawg.awgs[3].compile()  # <-- gives error
hdawg.awgs[3].run()
hdawg.awgs[3].output1("on")
hdawg.awgs[3].output1("off")
hdawg.awgs[3].stop()

If I take the LabOne interface as guidance, it makes perfect sense that I cannot do this, because there is only 1 AWG sequencer available. From the point of the qcodes driver, I would expect to be able to use the 4 InstrumentChannels, regardless of channelgrouping. I could switch back and forth between AWG channels, but it's not so pretty. For example, the following works:

hdawg.system.awg.channelgrouping(2)

hdawg.awgs[0].set_sequence_params(sequence_type="Custom", program="")
hdawg.awgs[0].compile()
hdawg.awgs[0].run()
hdawg.awgs[3].output1("on")
hdawg.awgs[3].output1("off")
hdawg.awgs[0].stop()

Would it be possible to have hdawg.awgs[0:4] point to the corresponding AWG sequencer, depending on the channelgrouping?

For compile, I am thinking this would mean changing self._index in this line to point to the sequencer:
https://github.com/zhinst/zhinst-toolkit/blob/bdeabc0d0e382246f82c9fe758631d43f54ada65/src/zhinst/toolkit/control/drivers/base/awg.py#L262

For run, this would mean changing self._index here:
https://github.com/zhinst/zhinst-toolkit/blob/bdeabc0d0e382246f82c9fe758631d43f54ada65/src/zhinst/toolkit/control/drivers/hdawg.py#L342

And I think this would involve changes for all other functionality in the zhinst.toolkit.control.drivers.hdawg.AWG class that uses f"awgs/{self._index}/"

Please let me know what you think.

Sincerely, Harold

@tobiasah
Copy link
Member

tobiasah commented Dec 3, 2021

Thanks for raising this issue.
From a first glimpse I would say it sound like a good idea and should be a small adjustment.

I will look into this a bit deeper and also discuss this with our application scientist.

I will keep you updated here.
(FYI since we are doing a refactoring of the toolkit and qcodes drivers at the moment it might take until the next LabOne Release end of February before we can ship a proper fix)

@haroldmeerwaldt
Copy link
Author

Okay, great. I discussed the use case with Florian a bit earlier. Thanks for the heads up on the timing! For now I'll just switch between InstrumentChannels.

@tobiasah
Copy link
Member

@haroldmeerwaldt I am happy to inform you that we have taken the initiative to refactor not only our QCoDeS driver but also zhinst-toolkit. We had some in depth discussions with our application scientists about you proposal. Since the channel grouping is something unique with the HDAWG we decided not to make any automatic channel resolving based on the grouping mode.

I will leave that issue open so that other people can see how one could get around that problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants