LoginSignup
1
1

More than 3 years have passed since last update.

Ultra96/Ultra96-V2 向け Debian GNU/Linux で XRT(Xilinx Runtime) を動かす(インストール編)【未完】

Last updated at Posted at 2020-03-23

注意(2020年3月26日追記)

この記事は Ultra96/Ultra96-V2 向け Debian GNU/Linux で XRT(Xilinx Runtime) を動作させようと試行錯誤していた時に投稿したもので、古い内容が含まれています。2020年3月26日に以下の記事を投稿したので参照してください。

はじめに

次の記事で、Ultra96/Ultra96-V2 向け Debian GNU/Linux で XRT(Xilinx Runtime) を動かすための Debian Package をビルドする方法について説明しました。

この記事は、上の記事の続編で、実際に Ultra96/Ultra96-V2 向け Debian GNU/Linux にインストールする方法について説明します。

注意

現時点(2020年3月23日)では、一応インストールは出来るものの、まだ動作していません。この記事はあくまでもトライアルの防備録です。

対応するプラットフォーム

現時点でインストール出来ることを確認しているのは(注:クドいようですが現時点ではあくまでもインストールのみ)、次のプラットフォームのみです。

  • ボード: Ultra96-V2
  • Linux カーネル: Linux 4.19.0 (linux-xlnx 4.19.0 v2019.2)
  • ディストリビューション: Ubuntu 18.04 or Debian10

Linux Kernel は以下の URL にあります。

ディストリビューションは以下の URL にあります。

それぞれの URL を参照して Ultra96 にインストールしてください。また、以下の記事も参考にしてください。

Debian Packagesの入手

『Ultra96/Ultra96-V2 向け Debian GNU/Linux で XRT(Xilinx Runtime) を動かす(ビルド編)【未完】』@Qiitaで説明した方法で XRT の Debian Packageをビルドするか、次の URL にある Debian Package をダウンロードしてください。

インストールする前に

インストールする前に以下のパッケージをインストールしておいてください。

  • ocl-icd-opencl-dev (>= 2.2.0)
  • libboost-filesystem-dev (>=1.65)
  • uuid-dev (>= 2.27.1)
  • dkms (>= 2.2.0)
  • libprotoc-dev (>=2.61)
  • libssl-dev (>=1.0.2)
  • protobuf-compiler (>=2.6.1)
  • libncurses5-dev (>=6.0)
  • lsb-release
  • libxml2-dev (>=2.9.1)
  • libyaml-dev (>= 0.1.6)
  • libc6 (>= 2.27)
  • python (>= 2.7)
  • python-pip
  • libudev-dev

上で紹介したパッケージは、xrt_202010.2.6.0_Ubuntu_18.04-arm64-xrt.deb をビルドした際に明示的に依存関係にあることを宣言したものです。

また、上記以外にも、以下のパッケージをインストールしておいてください。

  • python-pyopencl

このパッケージがインストールされていないと、xrt_202010.2.6.0_Ubuntu_18.04-arm64-xrt.deb のインストールの際に pyopencl を pip でインストールしようとします。pip で pyopencl をインストールする場合は C で書かれたプログラムをコンパイルする必要があり、いろいろとトラブルが発生して結局インストールに失敗しました。最初から Debian/Ubuntu 用にビルド済みの pyopencl をインストールしておいたほうがトラブルが発生しなくて済みます。

XRT(Xilinx Runtime) Package のインストール

dpkg コマンドでxrt_202010.2.6.0_Ubuntu_18.04-arm64-xrt.deb をインストールします。なお、このパッケージをインストールする時、その工程の途中で、dkms の仕組みを使って xocl および xlmgmt カーネルモジュールをビルドします。そのためインストールに時間がかかります。

fpga@ubuntu-fpga:~$ cd work/ZynqMP-FPGA-XRT
fpga@ubuntu-fpga:~/work/ZynqMP-FPGA-XRT$ sudo dpkg -i xrt_202010.2.6.0_Ubuntu_18.04-arm64-xrt.deb
Selecting previously unselected package xrt.
(Reading database ... 114575 files and directories currently installed.)
Preparing to unpack xrt_202010.2.6.0_Ubuntu_18.04-arm64-xrt.deb ...
Unpacking xrt (2.6.0) ...
Setting up xrt (2.6.0) ...
Unloading old XRT Linux kernel modules
rmmod: ERROR: Module xocl is not currently loaded
rmmod: ERROR: Module xclmgmt is not currently loaded
Invoking DKMS common.postinst for xrt
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
Loading new xrt-2.6.0 DKMS files...
Building for 4.19.0-xlnx-v2019.2-zynqmp-fpga
Building initial module for 4.19.0-xlnx-v2019.2-zynqmp-fpga

カーネルモジュールのビルド中に、うかつに Ctrl-C 等で中断しないで、終わるまで待ってあげてください。

Done.
xocl:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.19.0-xlnx-v2019.2-zynqmp-fpga/updates/dkms/
xclmgmt.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.19.0-xlnx-v2019.2-zynqmp-fpga/updates/dkms/
depmod...
DKMS: install completed.
Finished DKMS common.postinst
Loading new XRT Linux kernel modules
Installing MSD / MPD daemons
Skipping pyopencl installation...

zocl のインストール

dpkg コマンドで zocl-dkms_2.6.0_arm64.deb をインストールします。

fpga@ubuntu-fpga:~/work/ZynqMP-FPGA-XRT$ sudo dpkg -i zocl-dkms_2.6.0_arm64.deb
Selecting previously unselected package zocl-dkms.
(Reading database ... 114905 files and directories currently installed.)
Preparing to unpack zocl-dkms_2.6.0_arm64.deb ...
Unpacking zocl-dkms (2.6.0) ...
Setting up zocl-dkms (2.6.0) ...
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
Loading new zocl-2.6.0 DKMS files...
Building for 4.19.0-xlnx-v2019.2-zynqmp-fpga
Building for architecture arm64
Building initial module for 4.19.0-xlnx-v2019.2-zynqmp-fpga
Done.
zocl:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.19.0-xlnx-v2019.2-zynqmp-fpga/updates/dkms/
depmod...
DKMS: install completed.

zocl はカーネルモジュールですが、insmod で Linux に組み込んだだけではダメで、デバイスツリーが必要です。ZynqMP-FPGA-Linux では Device Tree Overlay をサポートしてるので、次のようなデバイスツリーをオーバーレイすることによって zocl をアクティブにします。

zocl.dts
/dts-v1/; /plugin/;
/ {
        fragment@1 {
                target-path = "/amba_pl@0";
                __overlay__ {
                        #address-cells = <2>;
                        #size-cells = <1>;
                        zyxclmm_drm {
                                compatible = "xlnx,zocl";
                                status = "okay";
                                reg = <0x0 0xA0000000 0x10000>;
                        };
                };
        };
};

fpga@ubuntu-fpga:~/work/streaming_lap_filter5$ sudo ./dtbocfg.rb -i zocl --dts zocl.dts
<stdin>:8.16-12.6: Warning (unit_address_vs_reg): /fragment@1/__overlay__/zyxclmm_drm: node has a reg or ranges property, but no unit name
fpga@ubuntu-fpga:~/work/streaming_lap_filter5$ dmesg | tail -4
[ 8401.997049] [drm] Probing for xlnx,zocl
[ 8401.997156] [drm] FPGA programming device pcap founded.
[ 8401.997161] [drm] PR Isolation addr 0x0
[ 8401.997750] [drm] Initialized zocl 2018.2.1 20180313 for a0000000.zyxclmm_drm on minor 1

現状

とりあえずXRT(Xilinx Runtime) のビルドとインストールは出来ました。ただし、XRT はまだ動いていません。FPGA の部屋の @marsee101 さんに Vitis で作ったサンプルを提供していただいて実行してみたところ、次のような結果になりました。

fpga@ubuntu-fpga:~/work/streaming_lap_filter5$ source /opt/xilinx/xrt/setup.sh
XILINX_XRT      : /opt/xilinx/xrt
PATH            : /opt/xilinx/xrt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
LD_LIBRARY_PATH : /opt/xilinx/xrt/lib:
PYTHONPATH     : /opt/xilinx/xrt/python:
fpga@ubuntu-fpga:~/work/streaming_lap_filter5$ ./streaming_lap_filter5.exe streaming_lap_filter5.xclbin
Using FPGA binary file specfied through the command line: streaming_lap_filter5.xclbin
XRT build version: 2.6.0
Build hash: b69d97cd7827bda97b194006be3b46809fc1b843
Build date: 2020-03-23 06:41:22
Git branch: 2019.2_Ultra96
PID: 16657
UID: 1000
[Mon Mar 23 14:21:54 2020]
HOST: ubuntu-fpga
EXE: /home/fpga/work/streaming_lap_filter5/streaming_lap_filter5.exe
[XRT] ERROR: No devices found
../src/krnl_streaming_lap_host3.cpp:71 Error calling err = cl::Platform::get(&platforms), error code is: -1

どうやら OpenCL のデバイスが見つからないと言っているようです。まだ何か設定が必要なのかもしれません。

今後も引き続きデバッグしていくつもりです。

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1