XiaoMi / mobile-ai-bench

Benchmarking Neural Network Inference on Mobile Devices
Apache License 2.0
353 stars 57 forks source link

Build failed with Mi Note 3 #10

Closed ysh329 closed 6 years ago

ysh329 commented 6 years ago

Thanks in advance. 🙇

1. My Installation Step

  1. cloned mobile-ai-bench in docker image registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev on my cross-compile machine using commands below:
    docker pull registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev
    docker run -it --privileged -d --name mace-dev \
           -v /dev/bus/usb:/dev/bus/usb --net=host \
           -v /local/path:/container/path \
           -v /usr/bin/docker:/usr/bin/docker \
           -v /var/run/docker.sock:/var/run/docker.sock \
           registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev
  2. downloaded snpe-1.8.0 and unzip to /opt as below:
    root@cross-compile:/opt# ls
    android-ndk-r12b  android-ndk-r16   mobile-ai-bench  snpe-1.18.0
    android-ndk-r15c  android-ndk-r17b  sdk              snpe-1.18.0.zip
  3. edit snpe in WORKSPACE as below:
    # You need to comment following new_http_archive and uncomment following           
    # new_local_repository to benchmark SNPE                                           
    #new_http_archive(                                                                 
    #    name = "snpe",                                                                
    #    build_file = "third_party/snpe/snpe.BUILD",                                   
    #    sha256 = "b11780e5e7f591e916c69bdface4a1ef75b0c19f7b43c868bd62c0f3747d3fbb",
    #    strip_prefix = "snpe-1.15.0",                                                 
    #    urls = [                                                                      
    #        "https://cnbj1-fds.api.xiaomi.net/aibench/third_party/snpe-1.15.0.zip",
    #    ],                                                                            
    #)                                                                                 
    # You need to uncomment following new_local_repository and comment foregoing       
    # new_http_archive to benchmark SNPE                                               
    new_local_repository(                                                              
    name = "snpe",                                                                 
    build_file = "third_party/snpe/snpe.BUILD",                                    
    path = "/opt/snpe-1.18.0",                                                     
    )

2. Issues

But build failed with 3 issues:

  1. Does mobile devices need to be root?
    adbd cannot run as root in production builds
    Not running as root. Try "adb root" first.
    stop: must be root
    /system/bin/sh: can't create /sys/devices/system/cpu/cpu7/online: Permission denied
    /system/bin/sh: can't create /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied
    ......
    ......
  2. No such file or directory
    /system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cdsp/governor: No such file or directory
  3. unused DT entry: type 0xf arg 0xf81
    WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
    ('snpe', 'CPU', 'MobileNetV2')

    3. Error Logs

I execute python ./tools/benchmark.py --frameworks=snpe in mace-dev container as below:

root@cross-compile:/opt/mobile-ai-bench# python ./tools/benchmark.py --frameworks=snpe
Prepare to run models on armeabi-v7a
* Build //aibench/benchmark:model_benchmark with ABI armeabi-v7a
/system/lib/libcdsprpc.so does not exists! Skip DSP.
INFO: Analysed target //aibench/benchmark:model_benchmark (17 packages loaded).
INFO: Found 1 target...
[6 / 10] no action

Target //aibench/benchmark:model_benchmark up-to-date:
  bazel-bin/aibench/benchmark/model_benchmark
INFO: Elapsed time: 55.689s, Critical Path: 0.86s
INFO: 3 processes, local.
INFO: Build completed successfully, 5 total actions
Build done!

=====================================================================
Trying to lock device ac516aca
Run on device: ac516aca, sdm660, Mi Note 3
Adjust power to performance mode on ac516aca, sdm660
adbd cannot run as root in production builds
Not running as root. Try "adb root" first.
stop: must be root
stop: must be root
stop: must be root
stop: must be root
/system/bin/sh: can't create /sys/devices/system/cpu/cpu0/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu1/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu2/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu3/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu4/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu5/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu6/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu7/online: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/1d84000.ufshc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/5000000.qcom,kgsl-3d0/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:arm9_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:bus_cnoc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_ddr/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/aa00000.qcom,vidc:venus_bus_llcc/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,cpubw/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,gpubw/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,kgsl-busmon/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cdsp/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cpu0/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,l3-cpu4/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,llccbw/governor: No such file or directory
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,memlat-cpu0/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,memlat-cpu4/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,mincpubw/governor: Permission denied
/system/bin/sh: can't create /sys/class/devfreq/soc:qcom,snoc_cnoc_keepalive/governor: No such file or directory
/system/bin/sh: can't create /sys/class/kgsl/kgsl-3d0/min_pwrlevel: Permission denied
/system/bin/sh: can't create /sys/class/kgsl/kgsl-3d0/max_pwrlevel: Permission denied
/system/bin/sh: can't create /sys/class/kgsl/kgsl-3d0/devfreq/governor: Permission denied
266000000
/system/bin/sh: can't create /sys/class/kgsl/kgsl-3d0/idle_timer: Permission denied
/system/bin/sh: can't create /d/dri/0/debug/core_perf/perf_mode: No such file or directory
/system/bin/sh: can't create /sys/devices/system/cpu/cpu0/core_ctl/min_cpus: Permission denied
/system/bin/sh: can't create /sys/devices/system/cpu/cpu4/core_ctl/min_cpus: Permission denied
/system/bin/sh: can't create /proc/sys/kernel/sched_downmigrate: Permission denied
/system/bin/sh: can't create /sys/block/sda/queue/nr_requests: No such file or directory
/system/bin/sh: can't create /dev/stune/top-app/schedtune.boost: Permission denied
/system/bin/sh: can't create /dev/stune/top-app/schedtune.prefer_idle: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/parameters/sleep_disabled: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu0/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu0/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu1/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu1/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu2/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu2/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu3/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu3/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu4/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu4/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu5/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu5/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu6/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu6/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu7/pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/cpu7/rail-pc/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/l3-wfi/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/L3/llcc-off/idle_enabled: No such file or directory
/system/bin/sh: can't create /sys/module/lpm_levels/system/perf/cpu4/pc/idle_enabled: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/system/perf/cpu5/pc/idle_enabled: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/system/perf/cpu6/pc/idle_enabled: Permission denied
/system/bin/sh: can't create /sys/module/lpm_levels/system/perf/cpu7/pc/idle_enabled: Permission denied
/system/bin/sh: can't create /proc/sys/kernel/sched_initial_task_util: No such file or directory
/system/bin/sh: can't create /proc/sys/kernel/sched_init_task_load: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/mas: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/slv: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/ab: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/ib: Permission denied
/system/bin/sh: can't create /sys/kernel/debug/msm-bus-dbg/shell-client/update_request: Permission denied
Push bazel-bin/aibench/benchmark/model_benchmark to /data/local/tmp/aibench
Run /data/local/tmp/aibench/model_benchmark
('snpe', 'CPU', 'MobileNetV1')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'MobileNetV2')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'SqueezeNetV11')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'InceptionV3')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'CPU', 'VGG16')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'MobileNetV1')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'MobileNetV2')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'SqueezeNetV11')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'InceptionV3')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'GPU', 'VGG16')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'MobileNetV1')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'MobileNetV2')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'SqueezeNetV11')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'InceptionV3')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
('snpe', 'DSP', 'VGG16')
WARNING: linker: /data/local/tmp/aibench/model_benchmark: unused DT entry: type 0xf arg 0xf81
ysh329 commented 6 years ago

image Same result logs, after I turn USB调试模式(安全设置) ON.

ysh329 commented 6 years ago
root@cross-compile:/opt/mobile-ai-bench# adb devices -l
List of devices attached 
ac516aca               device usb:1-1 product:jason model:Mi_Note_3 device:jason

root@cross-compile:/opt/mobile-ai-bench# root@cross-compile:/opt/mobile-ai-bench# adb root
bash: root@cross-compile:/opt/mobile-ai-bench#: No such file or directory
root@cross-compile:/opt/mobile-ai-bench# adb -s ac516aca root
adbd cannot run as root in production builds
root@cross-compile:/opt/mobile-ai-bench# adb -s ac516aca shell
jason:/ $ 
jason:/ $ 
jason:/ $ su root
ysh329 commented 6 years ago

申请解锁小米手机 http://www.miui.com/unlock/done.html

Thanks