Where is libovxlib.so on Ubuntu-XFce-SD/VIM3 Pro board?

I flashed the “VIM3_Ubuntu-xfce-bionic_Linux-4.9_arm64_SD-USB_V20190830” image into microSDcard as a first step.

https://dl.khadas.com/Firmware/VIM3/Ubuntu/SD_USB/VIM3_Ubuntu-xfce-bionic_Linux-4.9_arm64_SD-USB_V20190830.7z

In order to evaluate the NPU facility on VIM3 Pro board, I read the “How to use the NPU” at the below webpage.

https://docs.khadas.com/vim3/HowToUseNpu.html#Based-On-Linux

When I ran the below statement on Ubuntu-XFce/VIM3-Pro board, I got the unexpected situation as follows.

khadas@Khadas:~/demo/inceptionv3/bin_demo$ ./inceptionv3 ./inception_v3.nb ./goldfish_299x299.jpg
./inceptionv3: error while loading shared libraries: libovxlib.so: cannot open shared object file: No such file or directory

So, I checked the required files by runnign “readelf -d” command as follows.

khadas@Khadas:~/demo/inceptionv3/bin_demo$ readelf -d ./inceptionv3
Dynamic section at offset 0x1ec80 contains 26 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libovxlib.so]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [ld-linux-aarch64.so.1]

It seems that VIM3_Ubuntu-xfce-bionic_Linux-4.9_arm64_SD-USB_V20190830 image does not include “libovxlib.so” file by default. How can I get the required files such as libovxlib.so to run the “inception_v3” ELF file Ubunut-Xfce/VIM3-Pro board? Any hints will helpful to me.

In order to run the “inceptionv3” ELF file on Ubuntu/VIM3 Pro board,
I found the below directories after decompressing the aml_npu_sdk.tgz file.

  • ~/npu/aml_npu_sdk/linux_sdk/linux_sdk_6.3.3.4/build/sdk/drivers
  • ~/npu/aml_npu_sdk/linux_sdk/linux_sdk_6.3.3.4/linux_sdk_6.3.3.4/acuity-ovxlib-dev/lib/libovxlib.so

khadas$ sudo vi /ec/ld.so.conf.d/npu.conf
/home/khadas/demo/inceptionv3/bin_demo/lib/
/home/khadas/demo/inceptionv3/bin_demo/drivers/
khadas$
khadas$ ldconfig
khadas$ /home/khadas/demo/inceptionv3/bin_demo/drivers/
khadas$ sudo insmod ./galcore.ko
khadas$ lsmod | grep galcore
galcore 323584 0

Then, I tried to run the “inceptionv3” ELF file again as follows.
How can I run the “inceptionv3” ELF file on the VIM3 Pro board?

khadas@Khadas:~/demo/inceptionv3/bin_demo$ ./inceptionv3 ./inception_v3.nb ./goldfish_299x299.jpg
[ 1] Failed to open device: No such file or directory, Try again…
[ 2] Failed to open device: No such file or directory, Try again…
[ 3] Failed to open device: No such file or directory, Try again…
[ 4] Failed to open device: No such file or directory, Try again…
[ 5] _OpenDevice(1205): FATAL: Failed to open device, errno=No such file or directory.

The “strace” command show the absence of /dev/galcore (device node file) as follows.

mmap(NULL, 2887680, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb233a000 <0.000066>
openat(AT_FDCWD, “/dev/galcore”, O_RDWR) = -1 ENOENT (No such file or directory) <0.000049>
openat(AT_FDCWD, “/dev/graphics/galcore”, O_RDWR) = -1 ENOENT (No such file or directory) <0.000019>
nanosleep({tv_sec=1, tv_nsec=0}, NULL) = 0 <1.000100>
write(2, "[ 1] Failed to open device: "…, 72[ 1] Failed to open device: No such file or directory, Try again…
) = 72 <0.000018>
openat(AT_FDCWD, “/dev/galcore”, O_RDWR) = -1 ENOENT (No such file or directory) <0.000022>
openat(AT_FDCWD, “/dev/graphics/galcore”, O_RDWR) = -1 ENOENT (No such file or directory) <0.000156>
nanosleep({tv_sec=1, tv_nsec=0}, NULL) = 0 <1.000117>
write(2, "[ 2] Failed to open device: "…, 72[ 2] Failed to open device: No such file or directory, Try again…
) = 72 <0.000220>

Could you give me a hint to fix this issue? Welcome to any hints.

@leemgs Can you try with this

NPU Demo and source code

NPU Demo and source code

Thank you for sharing the information.
However, the execution result is failed as follows.

@Frank, Can you successfully run the inception_v3 example in your case? How did you enable /dev/galcore (device node file) to run the inception_v3 (ELF file)? Any comments will be helpful to me.

khadas@Khadas:~/mywork/aml_npu_demo_binaries/inceptionv3/VIM3$ ./run.sh
[ 1] Failed to open device: No such file or directory, Try again…
[ 2] Failed to open device: No such file or directory, Try again…
[ 3] Failed to open device: No such file or directory, Try again…
[ 4] Failed to open device: No such file or directory, Try again…
[ 5] _OpenDevice(1205): FATAL: Failed to open device, errno=No such file or directory.

BRs,
Geunsik Lim.

@leemgs Can you try it with root user. I will check it later.

@leemgs I check it just now .It such as worked fine .

khadas@Khadas:~/aml_npu_demo_binaries/inceptionv3/VIM3$ ./run.sh 
Create Neural Network: 41ms or 41282us
Verify...
Verify Graph: 1ms or 1568us
Start run graph [1] times...
Run the 1 time: 27ms or 27855us
vxProcessGraph execution time:
Total   27ms or 27876us
Average 27.88ms or 27876.00us
 --- Top5 ---
  2: 0.826660
795: 0.008255
974: 0.004066
393: 0.002390
408: 0.002285

@leemgs Maybe you need to follow this topic

Thank you sharing additional contents to narrow a reason.
Could you share the kernel version and Ubuntu version with the below statements?
root@Khadas:~# uname -a
root@Khadas:~# cat /etc/os-release
root@Khadas:~# /lib/aarch64-linux-gnu/libc.so.6
root@Khadas:~# cat /lib/modules/{kernel_version}/module.dep | grep galcore

@leemgs I am so sorry that my board has been flashed into other firmware. I think you should follow this two topic to try again. If you don’t success. I will do it agagin and put you the info which you need .

I solve this issue thanks to your hints. I found the galcore.ko file directly at dl.khadas.com - Index of /repos/vim3/pool/main/l/linux-4.9.190/ webpage. Then, installed all kernel packages as follows. Then I could find the galcore.ko with “find” command. Finally, I could check the existence of the /dev/galcore (device node file). Now, I can get the normal result whenever run the “inceptionv3” ELF file on Ubuntu18.04_SD/VIM3 Pro board.

khadas# wget https://dl.khadas.com/repos/vim3/pool/main/l/linux-4.9.190/linux-dtb-amlogic-4.9_0.7-4_arm64.deb
khadas# wget https://dl.khadas.com/repos/vim3/pool/main/l/linux-4.9.190/linux-headers-amlogic-4.9_0.7-4_arm64.deb
khadas# wget https://dl.khadas.com/repos/vim3/pool/main/l/linux-4.9.190/linux-image-amlogic-4.9_0.7-4_arm64.deb
khadas# wget https://dl.khadas.com/repos/vim3/pool/main/l/linux-4.9.190/linux-libc-dev-amlogic-4.9_0.7-4_arm64.deb
khadas# dpkg -i .deb
khadas#
khadas# find /lib/modules/ -name galcore.ko
/lib/modules/4.9.190/kernel/drivers/amlogic/npu/galcore.ko
khadas# modprobe galcore.ko
khadas# lsmod | grep galcore
galcore 331776 0
khadas#
khadas#
khadas#
khadas# ./inceptionv3 ./inception_v3.nb ./goldfish_299x299.jpg
D [setup_node:367]Setup node id[0] uid[0] op[NBG]
D [print_tensor:129]in : id[ 1] shape[ 3, 299, 299, 1 ] fmt[u8 ] qnt[ASM zp=137, scale=0.007292]
D [print_tensor:129]out: id[ 0] shape[ 1001, 1 ] fmt[f16] qnt[NONE]
D [optimize_node:311]Backward optimize neural network
D [optimize_node:318]Forward optimize neural network
I [compute_node:260]Create vx node
Create Neural Network: 33ms or 33294us
I [vsi_nn_PrintGraph:1308]Graph:
I [vsi_nn_PrintGraph:1309]
**************** Tensors ******************
D [print_tensor:137]id[ 0] shape[ 1001, 1 ] fmt[f16] qnt[NONE]
D [print_tensor:137]id[ 1] shape[ 3, 299, 299, 1 ] fmt[u8 ] qnt[ASM zp=137, scale=0.007292]
I [vsi_nn_PrintGraph:1318]***************** Nodes ******************
I vsi_nn_PrintNode:156node[0] [in: 1 ], [out: 0 ] [216c4ec0]
I [vsi_nn_PrintGraph:1327]******************************************
I [vsi_nn_ConvertTensorToData:732]Create 268203 data.
Verify…
Verify Graph: 1ms or 1537us
Start run graph [1] times…
Run the 1 time: 27ms or 27841us
vxProcessGraph execution time:
Total 27ms or 27855us
Average 27.85ms or 27855.00us
I [vsi_nn_ConvertTensorToData:732]Create 2002 data.
— Top5 —
2: 0.826660
795: 0.008255
974: 0.004066
393: 0.002390
408: 0.002285
I [vsi_nn_ConvertTensorToData:732]Create 2002 data.

1 Like

@leemgs OK,that’s good.