SDK

Neural network computing card configuration

Download from u disk of AI data and unzip GTISDK to the development board. Here unzip GTISDK to /home/firefly/GTISDK, assuming SDK archive is under the current directory, the operations are as follows:

firefly@firefly:~$ tar zxvf GTISDK_Linux_aarch64_v3-1-2a.tar.gz -C ~/   

Then carry out the driver installation.

If the neural network computing card in use is NCC S1, please download from Firmware Download or u disk of AI data and flash the corresponding firmware, or compile the kernel of AI data u disk.

If the neural network computing card in use is USB Dongle module, please confirm that whether sg.ko driver module exists, the procedures are as follows:

  • 1). Kernel built-inConfirm modules.builtin includes “kernel/drivers/scsi/sg.ko”, command:

    firefly@firefly:~$ cat /lib/modules/$(uname -r)/modules.builtin | grep sg.ko   
    

    If “kernel/drivers/scsi/sg.ko” is printed, the driver exists and please skip 2).

  • 2). External moduleCommand for use:

    firefly@firefly:~$ sudo modinfo sg   
    

If “modinfo: ERROR: Module sg not found.” is printed, the driver does not exist, otherwise it exists.If the driver exists, make sure that the module has been loaded. Try the following operations to load the driver:

    firefly@firefly:~$ sudo modprobe sg    
    ```   

If the driver does not exist, then compile and load sg.ko module (the options in the kernel are SCSI generic support).   
Finally install udev configuration file. The operations are as follows: 
```bash   
firefly@firefly:~$ sudo cp -i GTISDK/Lib/Linux/aarch64/50-emmc.rules  /etc/udev/rules.d/   
firefly@firefly:~$ sudo udevadm control –reload   

Compilation tool

SDK needs g++ 7.2.1 version and above, compiling the sample code with g++ below 7.2.1 version may cause unexpected problems, you can install it according to the following procedures if the development board system is Ubuntu:

   
firefly@firefly:~$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test   
firefly@firefly:~$ sudo apt-get update   
firefly@firefly:~$ sudo install g++-7   

Set the environment variable GTI_CC before compiling the sample code, as follows:

firefly@firefly:~$ export GTI_CC=g++-7   

userinput.txt configuration

{   
    "Gti device type": 0,  
    "model": [  
        {
            "Network name": "Gnet3",  
            "Image output format": 0,  
            "Dump input image": 0,  
            "eMMC write block numbers": 128,  
            "eMMC read delay": 5000,  
            "eMMC device node": "/dev/sg0",  
        }  
    ]  
}  
  

eMMC write block numbers, eMMC read delay and eMMC device node may be

Gti device type

Set GTI chip type: 0 is GTI 2801,1 is GTI 2803.

model

Network name

This configuration is related to the implementation of the PLAI training model.

Image output format

The chip returns to the data format, 0: Conv out pooling, 1: Sub layers, 2: Conv out, 3: Major layers

Dump input image

Default is 0.

eMMC write block numbers

Set the data sectors wrote or read by the device at once to 2018 can gain the best performance, and usb 2.0 device can be compatible by setting that to 128, but this parameter is related to specific max_sectors value of the corresponding device nodes under /sys/devices/.

eMMC read delay

Time delay between writing data and reading data by device, and the unit is us, which is generally related to network model, and GNet1 is 12000

eMMC device node

The first possible device node of neural network computing card could be found under /dev/ directory after connecting the device, generally USB Dongle is /dev/sg0, and NCC S1 is /dev/mmcblk1.