nvdla整个build的flow

 

  1. 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
  2. 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
  3. 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
  4. UMD

    $ cd sw/umd
    $ export TOP=$(pwd)
    $ make TOOLCHAIN_PREFIX=(path_to)buildroot-2017.11/output/host/opt/ext-toolchain/bin/aarch64-linux-gnu-
  5. Usage

    1. Running nvdla_compile on Ubuntu

      1. Files needed:

        1. nvdla_compile binary file from /home/yiizy/nvdla/sw/prebuilt/linux

        2. prototxtfile (User input, such as the BVLC Alexnet https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet)

        3. caffemodelfile (User input, such as the BVLC Alexnet http://dl.caffe.berkeleyvision.org/bvlc_alexnet.caffemodel)

        4. 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.)

    2. Running nvdla_runtime on Virtual Environment

      1. 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
      2. In Ubuntu, copy the following files to vp:

        1. The nvdla_runtime binary just built in sw/umd/out/runtime/nvdla_runtime/
        2. buildroot/output/build/linux-4.13.3/drivers/gpu/drm/drm.ko
        3. sw/kmd/port/linux/opendla.ko
        4. basic.nvdla generated by compiler
        5. 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
      3. 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

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值