-
Virtual Enviroment
Follow this http://nvdla.org/vp.html
Download Virtual Simulator: $ git clone https://github.com/nvdla/vp.git $ cd vp $ git submodule update --init --recursive Install Dependencies $ sudo apt-get update $ sudo apt-get install g++ cmake libboost-dev python-dev libglib2.0-dev libpixman-1-dev liblua5.2-dev swig libcap-dev libattr1-dev Install SystemC 2.3.0 $ wget -O systemc-2.3.0a.tar.gz http://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.0a.tar.gz $ tar -xzvf systemc-2.3.0a.tar.gz $ cd systemc-2.3.0a $ sudo mkdir -p /usr/local/systemc-2.3.0/ $ mkdir objdir $ cd objdir $ ../configure --prefix=/usr/local/systemc-2.3.0 $ make $ sudo make install Download and build NVDLA CMOD Before download, install those two Perl packages! $ sudo apt install libyaml-perl libio-tee-perl $ git clone https://github.com/nvdla/hw.git $ cd hw $ make $ tools/bin/tmake -build cmod_top Build the Virtual Simulator $ cmake -DCMAKE_INSTALL_PREFIX=build -DSYSTEMC_PREFIX=/usr/local/systemc-2.3.0/ -DNVDLA_HW_PREFIX=/PATH/TO/NVDLA/hw -DNVDLA_HW_PROJECT=nv_full $ make $ make install
-
BuildRoot - (IF you want to use 2017-11)
Instead of downloading buildroot from its website, now need to download from its repository, and go back to branch 2017.11.
$ git clone git://git.buildroot.net/buildroot $ cd buildroot $ git branch -r list all remote branch $ git checkout -t the branch you want (orgin/2017.11.x)
Then can follow the link here: http://nvdla.org/vp.html#building-linux-kernel-for-nvdla-virtual-simulator
$ make qemu_aarch64_virt_defconfig $ make menuconfig * Target Options -> Target Architecture -> AArch64 (little endian) * Target Options -> Target Architecture Variant -> cortex-A57 * Toolchain -> Custom kernel headers series -> 4.13.x * Toolchain -> Toolchain type -> External toolchain * Toolchain -> Toolchain -> Linaro AArch64 2017.08 * Toolchain -> Toolchain origin -> Toolchain to be downloaded and installed * Kernel -> () Kernel version -> 4.13.3 * Kernel -> Kernel configuration -> Use the architecture default configuration * System configuration -> Enable root login with password -> Y * System configuration -> Root password -> nvdla * Target Packages -> Show packages that are also provided by busybox -> Y * Target Packages -> Networking applications -> openssh -> Y $ make -j4
-
KMD
$ git clone https://github.com/nvdla/sw.git $ cd sw/kmd $ make KDIR=(path_to)buildroot-2017.11/output/build/linux-4.13.3 ARCH=arm64 CROSS_COMPILE=(path_to_)buildroot-2017.11/output/host/bin/aarch64-linux-gnu-_ The opendla.ko is at sw/kmd/port/linux/opendla.ko
-
UMD
$ cd sw/umd $ export TOP=$(pwd) $ make TOOLCHAIN_PREFIX=(path_to)buildroot-2017.11/output/host/opt/ext-toolchain/bin/aarch64-linux-gnu-
-
Usage
-
Running
nvdla_compile
on Ubuntu-
Files needed:
-
nvdla_compile
binary file from/home/yiizy/nvdla/sw/prebuilt/linux
-
prototxt
file (User input, such as the BVLC Alexnet https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet) -
caffemodel
file (User input, such as the BVLC Alexnet http://dl.caffe.berkeleyvision.org/bvlc_alexnet.caffemodel) -
Running commands:
./nvdla_compiler --prototxt YOUR_prototxt_FILE --caffemodel YOUR_caffemodel_FILE -o YOUR/OUTPUT/NAME
(Normally one only needs the
basic.nvdla
file generated.)
-
-
-
Running
nvdla_runtime
on Virtual Environment-
Start the Virtual Environment following http://nvdla.org/vp.html , mount current directory
./vp
to/mnt
$ export SC_SIGNAL_WRITE_CHECK=DISABLE $ ./build/bin/aarch64_toplevel -c conf/aarch64_nvdla.lua Login the kernel. The demo image uses account 'root' and password 'nvdla'. # mount -t 9p -o trans=virtio r /mnt # cd /mnt
-
In Ubuntu, copy the following files to
vp
:- The
nvdla_runtime
binary just built insw/umd/out/runtime/nvdla_runtime/
buildroot/output/build/linux-4.13.3/drivers/gpu/drm/drm.ko
sw/kmd/port/linux/opendla.ko
basic.nvdla
generated by compiler- Your image to be inferenced
zhajio@ubuntu:~ sudo docker container ls | grep 'nvdla/vp' | awk '{print $1}' [sudo] password for zhajio: caf14f21334a zhajio@ubuntu:~ sudo docker cp ~/nvdla/sw/prebuilt/linux/basic.nvdla caf14f21334a:/usr/local/nvdla zhajio@ubuntu:~ sudo docker cp ~/nvdla/sw/regression/images/ caf14f21334a:/usr/local/nvdla
- The
-
Running commands inside of virtual environment:
# insmod drm.ko # insmod opendia.ko # ./nvdla_runtime --loadable basic.nvdla --image ./YOUR/IMAGE --normalize 1.0 --rawdump
-
-
推荐采用docker,免去各种build的步骤。
$ docker pull nvdla/vp
$ docker run -it -v /home:/home nvdla/vp
$ cd /usr/local/nvdla
$ aarch64_toplevel -c aarch64_nvdla.lua
Login the kernel with account 'root' and password 'nvdla'
然后,只需执行如下步骤即可:
# mount -t 9p -o trans=virtio r /mnt
# cd /mnt
zhajio@ubuntu:~ sudo docker container ls | grep 'nvdla/vp' | awk '{print $1}'
[sudo] password for zhajio:
caf14f21334a
zhajio@ubuntu:~ sudo docker cp ~/nvdla/sw/prebuilt/linux/basic.nvdla caf14f21334a:/usr/local/nvdla
zhajio@ubuntu:~ sudo docker cp ~/nvdla/sw/regression/images/ caf14f21334a:/usr/local/nvdla
# insmod drm.ko
# insmod opendia.ko
# ./nvdla_runtime --loadable basic.nvdla --image ./YOUR/IMAGE --normalize 1.0 --rawdump