Common problems

1. Cannot find /dev/sgX or /dev/mmcblk1

If the used neural network computing card is eMMC interface, please download and program the special firmware, or compile and use the kernel in the AI data U disk.

If the used neural network computing card is USB interface, please make sure that the sg.ko driver of SCSI exists, and specific steps are as follows:

  • 1). Built-in kernelConfirm that 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” can be printed, the driver exists. Please check whether the neural network computing card is in perfect condition.

  • 2). External module Command:

    firefly@firefly:~$ sudo modinfo sg
    

    In case of printing of “modinfo: ERROR: Module sg not found.”, the driver does not exist, otherwise, it exists. If the driver exists, the following step can be tried to load the driver.

    firefly@firefly:~$ sudo modprobe sg
    

If the driver does not exist, you need to compile it by yourself and load the sg.ko module.

2. Permission problem of /dev/sgX or /dev/mmcblk1

If the module with eMMC interface is used, please run program under the root user.

If the module with usb inference is used, please try the following step under the GTISDK directory:

firefly@firefly:~GTISDK$ sudo cp -i Lib/Linux/aarch64/50-emmc.rules  /etc/udev/rules.d/
firefly@firefly:~GTISDK$ sudo udevadm control --reload

or try the following step:

firefly@firefly:~$ sudo chmod 777 /dev/sg*

3. Error -lGTILibrary Not found

The LD_LIBRARY_PATH variable can be set to point to the directory where GTILibrary is located, for example:

firefly@firefly:~$ export LD_LIBRARY_PATH=/home/firefly/GTISDK/Lib/Linux/aarch64:$LD_LIBRARY_PATH

4. GTI initialization failure

You should check whether the node name (usb interface module node name is /dev/sg* while eMMC interface module node name is /dev/mmcblk1) in userinput.txt (under data/Models/gti2801/gnet2_3/cnn_3 directory of SDK) is consistent with that of the node generated in the terminal development board. A testing program under Tools directory can detect and test connectivity.

5. Read-write failure of GTI chip

  1. Check the value of max_sectors parameter (“USB write block numbers”: 2048) in userinput.txt, set the value of usb2.0 interface or eMMC interface to be 128, and set the value of usb3.0 interface to be 2048; or modify the value of max_sectors to that of userinput.txt, as shown below:

    ubunut16.04:~$ find /sys/devices/ -name max_sectors
    /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0/max_sectors
    ubunut16.04:~$ su
    ubunut16.04:~# echo 2048 > /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0/max_sectors
    
  2. Refer to /dev/sgXor /dev/mmcblk1 permission problem

6. TypeError: can’t convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

In case of use of PyTorch 1.0rc1, you may modify tensor.py in PyTorch package

def __array__(self, dtype=None):
    if dtype is None:
        return self.numpy()
    else:
        return self.numpy().astype(dtype, copy=False)

To be

def __array__(self, dtype=None):
    if dtype is None:
        return self.cpu().numpy()
    else:
        return self.cpu().numpy().astype(dtype, copy=False)

The reference path of tensor.py is /usr/lib/python3.7/site-packages/torch/tensor.py. Please find tensor.py according to the installation path of PyTorch.

7. OSError: libftd3xx.so.0.5.21: cannot open shared object file: No such file or directory

At the time of use of PLAI, in case of error of title, please execute the following command under the PLAI root directory:

ubunut16.04:~/PLAI$ export LD_LIBRARY_PATH=$(pwd)/lib/python/gtilib:$LD_LIBRARY_PATH

and then run PLAI.

8. Could not load model. Device:/dev/sg1—-usb_write error

In case of the following errors:

- 1541659252666 -140566399514112- 0-:usb_emmc_read ioctl error. code:-1
- 1541659252667 -140566399514112- 0-:Could not load model. Device:/dev/sg1----usb_write error

Please check whether you have a read-write access permission for /dev/sg*, if not, please refer to [2] for configuration. If the problems are still not solved, please refer to [5], and userinput.txt hereof corresponds to nets/netConfig*.txt in PLAI, and please modify it according to the trained model.