Error when using pynq_dpu.OverlayDPU together with pynq.Overlay

Hello,

I have tried to use pynq_dpu.OverlayDPU with the default dpu bitstream from DPU-PYNQ and the pynq.Overlay with my custom bitstream. My code is to run the dpu overlay first to classify the images then run my own overlay. However, I got errors as follows (pynq.bit is my custom bitstream) :

(main3.py:1031): Gdk-CRITICAL **: 00:22:07.126: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
Total number of test images: 10000
  Dimension of each picture: 28x28
Classifying 10000 digit pictures ...
Overall accuracy: 0.9871
  Execution time: 5.0068s
      Throughput: 1997.2905FPS
[  335.779414] [drm:zocl_xclbin_read_axlf [zocl]] *ERROR* Current xclbin is in-use, can't change, try again.
Load Xclbin Failed
Traceback (most recent call last):
  File "main3.py", line 245, in <module>
    ol = Overlay("pynq.bit")
  File "/root/.local/lib/python3.8/site-packages/pynq/overlay.py", line 354, in __init__
    self.download()
  File "/root/.local/lib/python3.8/site-packages/pynq/overlay.py", line 420, in download
    super().download(self.parser)
  File "/root/.local/lib/python3.8/site-packages/pynq/bitstream.py", line 187, in download
    self.device.download(self, parser)
  File "/root/.local/lib/python3.8/site-packages/pynq/pl_server/embedded_device.py", line 600, in download
    self._xrt_download(parser.xclbin_data)
  File "/root/.local/lib/python3.8/site-packages/pynq/pl_server/xrt_device.py", line 523, in _xrt_download
    raise RuntimeError("Programming Device failed: " +
RuntimeError: Programming Device failed: EBUSY (16) Device or resource busy/Bitstream in use by another program
root@pynq:/home/xilinx# 

I think this error indicates that dpu bitstream is still used in the device, and my custom bitstream cannot be loaded into that device. The question is there anyway to flush out the dpu bitstream and allows my own bitstream to go in to that device instead?

My settings as follow:

  • PYNQ 2.7
  • PYNQ-DPU 1.4
  • My board: Ultra96v2

Thank you

Hi there,

Does this happen when you load your bitstream first? Also have you included a .hwh and .xclbin files along with your custom .bit? The bitstream you use should match the xclbin loaded in /usr/lib.

Thanks
Shawn

Apologies, I think I misunderstood your question… The problem seems to stem from dpu runner keeping the zocl device busy even after clearing the overlay.

I can’t find a good solution at the moment, but for now a workaround could be to write your predictions into a file and then do the postprocessing with your custom overlay in a separate notebook/script.

Thanks
Shawn

1 Like

Hi @skalade,

Thank you for your response. Yes, this workaround will work; however, it will significantly increase overall runtime.

Interestingly, this also worked if I used my custom overlay first, then dpu overlay. I was unsure why the dpu overlay keeps the zocl driver busy until the end of the script while my custom pynq overlay does not.

Thanks,