Closed steven9046 closed 2 years ago
I followed BuildGuideNative.md in delegate/ and successfully build armnn and delegate. When I come to this:
To ensure that the build was successful you can run the unit tests for the delegate that can be found in the build directory for the delegate. Doctest was used to create those tests. Using test filters you can filter out tests that your build is not configured for. In this case, because Arm NN was only built for Cpu acceleration (CpuAcc), we filter for all test suites that have
CpuAcc
in their name.cd $BASEDIR/armnn/delegate/build ./DelegateUnitTests --test-suite=*CpuAcc*
If you have built for Gpu acceleration as well you might want to change your test-suite filter:
./DelegateUnitTests --test-suite=*CpuAcc*,*GpuAcc*
I build this project on an aarch64 machine. The cpu test is ok but GpuAcc did't work.
When I test with tflite another error came up.
temi@temi:~/ArmNNDelegate/benchmarking$ LD_LIBRARY_PATH=../armnn/build ./benchmark_model --graph=mobilenet_v2_1.0_224_quantized_1_default_1.tflite --external_delegate_path="../armnn/build/delegate/libarmnnDelegate.so" --external_delegate_options="backends:CpuAcc;logging-severity:info" STARTING! Log parameter values verbosely: [0] Graph: [mobilenet_v2_1.0_224_quantized_1_default_1.tflite] External delegate path: [../armnn/build/delegate/libarmnnDelegate.so] External delegate options: [backends:CpuAcc;logging-severity:info] Loaded model mobilenet_v2_1.0_224_quantized_1_default_1.tflite EXTERNAL delegate created
When I type clinfo it prints"Number of platforms 0 " Is this means my driver for Mali GPU is missing?
How to solve this? Any suggestions? Thanks!
I have fix the mali driver problem. I donwload the mali.so from here and now when I run
sudo clinfo
It prints
arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.Number of platforms 1
Platform Name ARM Platform
Platform Vendor ARM
Platform Version OpenCL 1.2 v1.r18p0-01rel0.5cb5681058e8e076ff89747c20c32578
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_exte nded_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp16 cl_khr_icd cl_khr_egl_image c l_khr_image2d_from_buffer cl_arm_core_id cl_arm_printf cl_arm_thread_limit_hint cl_arm_non_uniform_work_group_size cl_arm_import_memory
Platform Extensions function suffix ARM
Platform Name ARM Platform
Number of devices 1
Device Name Mali-T860
Device Vendor ARM
Device Vendor ID 0x8602000
Device Version OpenCL 1.2 v1.r18p0-01rel0.5cb5681058e8e076ff89747c20c32578
Driver Version 1.2
Device OpenCL C Version OpenCL C 1.2 v1.r18p0-01rel0.5cb5681058e8e076ff89747c20c32578
Device Type GPU
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 4
Max clock frequency 5MHz
Device Partition (core)
Max number of sub-devices 0
Supported partition types None
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 256x256x256
Max work group size 256
Preferred work group size multiple 4
Preferred / native vector sizes
char 16 / 16
short 8 / 8
int 4 / 4
long 2 / 2
half 8 / 8 (cl_khr_fp16)
float 4 / 4
double 2 / 2 (cl_khr_fp64)
Half-precision Floating-point support (cl_khr_fp16)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Single-precision Floating-point support (core)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (cl_khr_fp64)
Denormals Yes
Infinity and NANs Yes
Round to nearest Yes
Round to zero Yes
Round to infinity Yes
IEEE754-2008 fused multiply-add Yes
Support is emulated in software No
Address bits 64, Little-Endian
Global memory size 4030976000 (3.754GiB)
Error Correction support No
Max memory allocation 1007744000 (961.1MiB)
Unified memory for Host and Device Yes
Minimum alignment for any data type 128 bytes
Alignment of base address 1024 bits (128 bytes)
Global Memory cache type Read/Write
Global Memory cache size 262144 (256KiB)
Global Memory cache line size 64 bytes
Image support Yes
Max number of samplers per kernel 16
Max size for 1D images from buffer 65536 pixels
Max 1D or 2D image array size 2048 images
Base address alignment for 2D image buffers 32 bytes
Pitch alignment for 2D image buffers 16 pixels
Max 2D image size 65536x65536 pixels
Max 3D image size 65536x65536x65536 pixels
Max number of read image args 128
Max number of write image args 8
Local memory type Global
Local memory size 32768 (32KiB)
Max number of constant args 8
Max constant buffer size 65536 (64KiB)
Max size of kernel argument 1024
Queue properties
Out-of-order execution Yes
Profiling Yes
Prefer user sync for interop No
Profiling timer resolution 1000ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels No
printf() buffer size 1048576 (1024KiB)
Built-in kernels (n/a)
Device Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_3d_image_writes cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp16 cl_khr_icd cl_khr_egl_image cl_khr_image2d_from_buffer cl_arm_core_id cl_arm_printf cl_arm_thread_limit_hint cl_arm_non_uniform_work_group_size cl_arm_import_memory
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) ARM Platform
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [ARM]
clCreateContext(NULL, ...) [default] Success [ARM]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name ARM Platform
Device Name Mali-T860
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name ARM Platform
Device Name Mali-T860
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1)
Platform Name ARM Platform
Device Name Mali-T860
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.11
But when I run the test, it still failed.
/home/temi/ArmNNDelegate/armnn/delegate/src/test/UnpackTest.cpp:163:
TEST SUITE: Unpack_GpuAccTests
TEST CASE: Unpack_Uint8_Axis0_Num4_GpuAcc_Test
/home/temi/ArmNNDelegate/armnn/delegate/src/test/UnpackTest.cpp:163: ERROR: test case THREW exception: TfLiteArmnnDelegate: No known backend specified.
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
INFO: TfLiteArmnnDelegate: Requested unknown backend GpuAcc
arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.===============================================================================
/home/temi/ArmNNDelegate/armnn/delegate/src/test/UnpackTest.cpp:169:
TEST SUITE: Unpack_GpuAccTests
TEST CASE: Unpack_Uint8_Axis2_Num6_GpuAcc_Test
/home/temi/ArmNNDelegate/armnn/delegate/src/test/UnpackTest.cpp:169: ERROR: test case THREW exception: TfLiteArmnnDelegate: No known backend specified.
===============================================================================
[doctest] test cases: 185 | 3 passed | 182 failed | 396 skipped
[doctest] assertions: 1240 | 1240 passed | 0 failed |
[doctest] Status: FAILURE!
If I run the test with sudo:
temi@temi:~/ArmNNDelegate/armnn/delegate/build$ sudo ./DelegateUnitTests --test-suite=*GpuAcc*
[doctest] doctest version is "2.4.0"
[doctest] run with "--help" for options
INFO: TfLiteArmnnDelegate: Created TfLite ArmNN delegate.
arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.===============================================================================
/home/temi/ArmNNDelegate/armnn/delegate/src/test/ActivationTest.cpp:261:
TEST SUITE: Activation_GpuAccTests
TEST CASE: Activation_ReLu_GpuAcc_Test
/home/temi/ArmNNDelegate/armnn/delegate/src/test/ActivationTest.cpp:261: FATAL ERROR: test case CRASHED: SIGABRT - Abort (abnormal termination) signal
===============================================================================
[doctest] test cases: 1 | 0 passed | 1 failed | 580 skipped
[doctest] assertions: 9 | 9 passed | 0 failed |
[doctest] Status: FAILURE!
Aborted
Does this mean that I need to fix the linux kernel? I'm not very familiar with these linux things. Any suggestion?Thanks a lot!
Hey @sunforever1990
it looks to me like you haven't built Acl and ArmNN with Gpu support. Have you added the Gpu flags as mentioned in this comment in the guide?
The machine used for this guide only has a Neon CPU which is why I only have "neon=1" but if your machine has an arm Gpu you can enable that by adding opencl=1 embed_kernels=1 to the command below:
scons arch=arm64-v8a neon=1 extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0
and the same when building ArmNN:
if you've got an arm Gpu add -DARMCOMPUTECL=1 to the command below
cmake .. -DARMCOMPUTE_ROOT=$BASEDIR/ComputeLibrary -DARMCOMPUTENEON=1 -DBUILD_UNIT_TESTS=0
Let me know how you are getting on! Jan
Hey @sunforever1990
it looks to me like you haven't built Acl and ArmNN with Gpu support. Have you added the Gpu flags as mentioned in this comment in the guide?
The machine used for this guide only has a Neon CPU which is why I only have "neon=1" but if your machine has an arm Gpu you can enable that by adding opencl=1 embed_kernels=1 to the command below:
scons arch=arm64-v8a neon=1 extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0
and the same when building ArmNN:
if you've got an arm Gpu add -DARMCOMPUTECL=1 to the command below
cmake .. -DARMCOMPUTE_ROOT=$BASEDIR/ComputeLibrary -DARMCOMPUTENEON=1 -DBUILD_UNIT_TESTS=0
Let me know how you are getting on! Jan
Sorry, did't repay at weekends. I'm sure I have add these flags
if you've got an arm Gpu add -DARMCOMPUTECL=1 to the command below
cmake .. -DARMCOMPUTE_ROOT=$BASEDIR/ComputeLibrary -DARMCOMPUTENEON=1 -DBUILD_UNIT_TESTS=0
The machine used for this guide only has a Neon CPU which is why I only have "neon=1" but if your machine has an arm Gpu you can enable that by adding opencl=1 embed_kernels=1 to the command below:
scons arch=arm64-v8a neon=1 extra_cxx_flags="-fPIC" benchmark_tests=0 validation_tests=0
I follwed BuildGuideNative.md step by step.
./DelegateUnitTests --test-suite=*CpuAcc*,*GpuAcc*
I built v21.05 because there were some errors building v21.08
These are exactly the kind of errors that you see when you haven't built armnn for the backend that you try to run tests on.
Have you tried only running CpuAcc tests?
./DelegateUnitTests --test-suite=*CpuAcc*
If that works I suggest to rebuild armnn and ensure that the correct flags are set.
These are exactly the kind of errors that you see when you haven't built armnn for the backend that you try to run tests on. Have you tried only running CpuAcc tests?
./DelegateUnitTests --test-suite=*CpuAcc*
If that works I suggest to rebuild armnn and ensure that the correct flags are set.
CpuAcc is OK. I rebuilt ACL and Armnn. This error it still there. I'm sure the flags have been set correctlly this time. I'm afraid the problem may due to my hardware? I will test it on another hardware later. Thanks very much!
Can I ask what hardware you are running on?
Can I ask what hardware you are running on?
RK3399 with ubuntu20.04. The linux image is made by another guy. I'm not sure whether the image is OK or not...
I've been getting some feedback from the team. It's very likely that your image is causing the issue. I suggest you try an official image for the board if you can.
There are other issues in our github repo that also mention this board. Maybe one of them says something that can help you out.
@sunforever1990: you can try like follow:
place the libmails.so into /usr/lib
git clone -b 29mirror https://github.com/rockchip-linux/libmali
sudo cp -R libmail/include/CL/ /usr/include/
sudo cp libmail/lib/aarch64-linux-gnu/libmali-midgard-t86x-r14p0.so /usr/lib/
sudo ln -s /usr/lib/libmali-midgard-t86x-r14p0.so /usr/lib/libOpenCL.so
config udev rules:
sudo cat > /etc/udev/rules.d/50-mail400.rules << EOF
KERNEL=="mali", MODE="0666", GROUP="video"
EOF
sudo cat > /etc/udev/rules.d/50-mail.rules << EOF
KERNEL=="mali0", MODE="0666", GROUP="video"
EOF
reboot your system
you could do sample test with opencv: opencv-demo.tar.gz refer to https://www.cnblogs.com/releases/p/10308741.html
KERNEL=="mali", MODE="0666", GROUP="video" EOF sudo cat > /etc/udev/rules.d/50-mail.rules << EOF KERNEL=="mali0", MODE="0666", GROUP="video" EOF
This actually solved my problem. There was no rules file under /etc/udev/rules.d/ in my system. Thank you a lot!
I followed BuildGuideNative.md in delegate/ and successfully build armnn and delegate. When I come to this:
To ensure that the build was successful you can run the unit tests for the delegate that can be found in the build directory for the delegate. Doctest was used to create those tests. Using test filters you can filter out tests that your build is not configured for. In this case, because Arm NN was only built for Cpu acceleration (CpuAcc), we filter for all test suites that have
CpuAcc
in their name.If you have built for Gpu acceleration as well you might want to change your test-suite filter:
I build this project on an aarch64 machine. The cpu test is ok but GpuAcc did't work.
When I test with tflite another error came up.
temi@temi:~/ArmNNDelegate/benchmarking$ LD_LIBRARY_PATH=../armnn/build ./benchmark_model --graph=mobilenet_v2_1.0_224_quantized_1_default_1.tflite --external_delegate_path="../armnn/build/delegate/libarmnnDelegate.so" --external_delegate_options="backends:CpuAcc;logging-severity:info" STARTING! Log parameter values verbosely: [0] Graph: [mobilenet_v2_1.0_224_quantized_1_default_1.tflite] External delegate path: [../armnn/build/delegate/libarmnnDelegate.so] External delegate options: [backends:CpuAcc;logging-severity:info] Loaded model mobilenet_v2_1.0_224_quantized_1_default_1.tflite EXTERNAL delegate created
When I type clinfo it prints"Number of platforms 0 " Is this means my driver for Mali GPU is missing?
How to solve this? Any suggestions? Thanks!