PYNQ: PYTHON PRODUCTIVITY FOR ZYNQ

Feasibility for performing linear algebra on a PYNQ-Z1 (or on any PYNQ in general)

Greetings,

Simple question: Is there a library for linear algebra that would allow me to calculate the eigenvalues of a matrix on the FPGA portion of the PYNQ-Z1?

More detailed question: I am working a fairly basic project to explore the use of FPGAs for accelerating portions of a modeling application. I purchased a PYNQ-Z1 and after learning some of the basics I have come to the preliminary conclusion that the libraries and overlays are more suited for the interfacing of hardware with the system than they are a way of implementing python code in an FPGA. For example, I have the following code

eigvals,eigvects = sp.linalg.eig(A,B)

that takes 159 ms running on the ARM portion of the PYNQ-Z1 and I would like to implement this (or something similar) in an FPGA. Is there a way that I could easily do this? Would the require building my one library? Is there a place I could look for some user-created libraries?

Thanks in advance for any help,
Austin

“Easily” is not an absolute term, it always depends on the skills level…
In general you need to write your PYNQ-Z1 PL hardware coprocessor to do that, and then you would need to write your own python function to initialize the hardware with the desired inputs and read out the outputs. PYNQ helps you with the second part, exposing the hardware coprocessor I\Os to your software application for easy access, but the hardware coprocessor itself, you either buy it or painfully, very painfully, select a proper algorithm an write it down yourself in a hardware design language… you can now write the coprocessor in a high level language, like C\C++ with the Vivado HLS flow or with MATLAB HDL tools and get part of the pain done for you automatically. Still is not so easy and straightforward, IMPO, as it is hoped to. BTW There is a lot of academic literature on eigenvalues\vector computation FPGA acceleration, but, to my knowledge, no commercial or open-source IP available.
Best regards

1 Like

Thank you for taking the time to help me out. I think for now, given a few other constraints on my project, I will try to implement this in an FPGA using LabVIEW hardware. However, after playing around with PYNQ I see how this could be very useful.

Thanks again!

On a second thought, you may have a look at XAPP1170, i.e. the implementation of matrix multiplication with Vivado HLS, and implement an eigenvector\eigenvalues matrix product based algorithm. Surely it will be fast, but, for large, sparse matrices, I wouldn’t go for such an algorithm, it is going to require too much hardware to be suitable.