项目作者: nixir

项目描述 :
This Repo contains a programs of calling Xilinx Alveo accelerator card from MATLAB
高级语言: C
项目地址: git://github.com/nixir/callAlveoFromMATLAB.git
创建时间: 2020-10-27T09:50:46Z
项目社区:https://github.com/nixir/callAlveoFromMATLAB

开源协议:

下载


call Alveo (accelerator card) from MATLAB example

An example of how to execute an operation in Xilinx Alveo accelerator card from MATLAB.

This README.md is under CC BY 4.0 license , although whole this repository is not free to use because the license of the referd repository is unknown.

How to execute

There are some limitations in the MEX execution of MATLAB, so it is not likely to be possible to run acceleration in Alveo as it is.

  • The MEX executable does not accept standard input.
    • We need to write the path to the xclbin file directly to the source code or to pass path via mex API.
  • MATLAB overwrites the LD_PRELOAD environment variable.
    • In the dynamic linking of the library, an error occurs when executing it because different versions of the library are linked depending on the environment.

Please see

Build

  1. Move ./codegen/mex/fir_filter
  2. Set your card name at design.cfg
  3. Build with ninja (Maybe need some uncomment. Please see build.ninja)
  4. Copy mex file and xclbin to top directory

Outputs

  1. kodama@XXXXXXX ~/R/callAlveoFromMATLAB> fish run.fish
  2. MATLAB is selecting SOFTWARE OPENGL rendering.
  3. < M A T L A B (R) >
  4. Copyright 1984-2019 The MathWorks, Inc.
  5. R2019b Update 1 (9.7.0.1216025) 64-bit (glnxa64)
  6. September 26, 2019
  7. To get started, type doc.
  8. For product information, visit www.mathworks.com.
  9. >> FIRfilter
  10. 0.0065 0.4935 0.4935 0.0065
  11. Elapsed time is 0.004253 seconds.
  12. /usr/local/MATLAB/R2019b/sys/opengl/lib/glnxa64:/usr/local/MATLAB/R2019b/sys/os/glnxa64:/usr/local/MATLAB/R2019b/bin/glnxa64:/usr/local/MATLAB/R2019b/extern/lib/glnxa64:/usr/local/MATLAB/R2019b/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/R2019b/sys/java/jre/glnxa64/jre/lib/amd64/server:/opt/xilinx/xrt/lib:/tools/Xilinx/Vitis/2019.2/lib/lnx64.o/Ubuntu/18:/tools/Xilinx/Vitis/2019.2/lib/lnx64.o/Ubuntu:/tools/Xilinx/Vitis/2019.2/lib/lnx64.o:/tools/Xilinx/Vitis/2019.2/runtime/lib/x86_64:/opt/xilinx/xrt/lib:/tools/Xilinx/Vitis/2019.2/lib/lnx64.o/Ubuntu/18:/tools/Xilinx/Vitis/2019.2/lib/lnx64.o/Ubuntu:/tools/Xilinx/Vitis/2019.2/lib/lnx64.o:/tools/Xilinx/Vitis/2019.2/runtime/lib/x86_64:/tools/Xilinx/Vivado/2019.2/lnx64/tools/opencv/opencv_gcc/:/tools/Xilinx/Vivado/2019.2/lnx64/tools/opencv/opencv_gcc/
  13. INFO: Found 2 platforms
  14. INFO: Selected platform 1 from Xilinx
  15. INFO: Found 1 devices
  16. CL_DEVICE_NAME xilinx_u250_xdma_201830_2
  17. Selected xilinx_u250_xdma_201830_2 as the target device
  18. INFO: Make context
  19. INFO: create a computer context
  20. INFO!create a command commands!
  21. INFO: loading xclbin ./fir_filter.xilinx_u250_xdma_201830_2.xclbin
  22. INFO:load kernel from xclbin!
  23. INFO:create compute program from binary
  24. INFO: build program executable!
  25. INFO: create compute kernel_fir_filter!
  26. FPGA execution time is 38671 nano sec
  27. Elapsed time is 0.617696 seconds.
  28. ans =
  29. logical
  30. 1
  31. >>

Reference