高通SNPE - 基准测试概述(1)

基准测试概述

SNPE SDK附带的基准测试由一组python脚本组成,这些python脚本在目标Android / Linux嵌入式设备上运行一个网络并收集性能指标。它使用SDK包中的可执行文件和库,使用网络的一组输入和指向该输入组的文件在目标上运行DLC文件。

基准脚本的输入是JSON格式的配置文件。该SDK附带有一个配置文件,用于运行SNPE SDK中创建的AlexNet模型。鼓励SDK用户创建自己的配置文件,并使用基准脚本在目标上运行以收集计时和内存消耗度量。

该配置文件允许用户指定:

  • 基准测试的名称(即AlexNet)
  • 用于存储结果的主机路径
  • 要使用的设备路径(在何处推送运行基准测试所需的文件)
  • 用于运行基准测试的设备(每次运行仅支持一台设备)
  • 设备连接到的远程计算机的主机名/ IP
  • 重复运行的次数
  • 模型细节(名称,dlc的位置,输入的位置)
  • 要使用的SNPE运行时配置(CPU,GPU,GPU_FP16和DSP的组合)
  • 进行哪些测量(“内存”和/或“定时”)
  • 测量的概要分析级别(“关闭”,“基本”,“中等”或“详细”)

命令行参数

要查看所有命令行参数,请在运行snpe_bench.py​​时使用“ -h”选项。

usage: snpe_bench.py [-h] -c CONFIG_FILE [-o OUTPUT_BASE_DIR_OVERRIDE]
                     [-v DEVICE_ID_OVERRIDE] [-r HOST_NAME] [-a]
                     [-t DEVICE_OS_TYPE_OVERRIDE] [-d] [-s SLEEP]
                     [-b USERBUFFER_MODE] [-p PERFPROFILE] [-l PROFILINGLEVEL]
                     [-json] [-cache]

Run the snpe_bench

required arguments:
  -c CONFIG_FILE, --config_file CONFIG_FILE
                        Path to a valid config file
                        Refer to sample config file config_help.json for more
                        detail on how to fill params in config file

optional arguments:
  -o OUTPUT_BASE_DIR_OVERRIDE, --output_base_dir_override OUTPUT_BASE_DIR_OVERRIDE
                        Sets the output base directory.
  -v DEVICE_ID_OVERRIDE, --device_id_override DEVICE_ID_OVERRIDE
                        Use this device ID instead of the one supplied in config
                        file. Cannot be used with -a
  -r HOST_NAME, --host_name HOST_NAME
                        Hostname/IP of remote machine to which devices are
                        connected.
  -a, --run_on_all_connected_devices_override
                        Runs on all connected devices, currently only support 1.
                        Cannot be used with -v
  -t DEVICE_OS_TYPE_OVERRIDE, --device_os_type_override DEVICE_OS_TYPE_OVERRIDE
                        Specify the target OS type, valid options are
                        ['android', 'android-aarch64', 'le', 'le64_gcc4.9',
                        'le_oe_gcc6.4', 'le64_oe_gcc6.4']
  -d, --debug           Set to turn on debug log
  -s SLEEP, --sleep SLEEP
                        Set number of seconds to sleep between runs e.g. 20
                        seconds
  -b USERBUFFER_MODE, --userbuffer_mode USERBUFFER_MODE
                        [EXPERIMENTAL] Enable user buffer mode, default to
                        float, can be tf8exact0
  -p PERFPROFILE, --perfprofile PERFPROFILE
                        Set the benchmark operating mode (balanced, default,
                        sustained_high_performance, high_performance,
                        power_saver, system_settings)
  -l PROFILINGLEVEL, --profilinglevel PROFILINGLEVEL
                        Set the profiling level mode (off, basic, moderate, detailed).
                        Default is basic.
  -json, --generate_json
                        Set to produce json output.
  -cache, --enable_init_cache
                        Enable init caching mode to accelerate the network
                        building process. Defaults to disable.

运行基准

先决条件

SNPE SDK按照“ SNPE设置”一章设置。
教程设置已完成。

可选:如果设备连接到远程计算机,则用户需要完成远程adb服务器设置。

运行SDK附带的AlexNet

snpe_bench.py​​是用于测量和报告性能统计信息的主要基准脚本。这是将其与在SDK中创建的AlexNet模型和数据一起使用的方法。

cd $SNPE_ROOT/benchmarks
python3 snpe_bench.py -c alexnet_sample.json -a

    where
        -a benchmarks on the device connected

查看结果(csv文件或json文件)

所有结果都存储在配置json文件中指定的“ HostResultDir”中。基准为每次基准运行创建带时间戳的目录。所有计时结果均以微秒为单位存储。

为了方便起见,创建了一个“ latest_results”链接,该链接始终指向最新的运行。

# In alexnet_sample.json, "HostResultDir" is set to "alexnet/results"
cd $SNPE_ROOT/benchmarks/alexnet/results
# Notice the time stamped directories and the "latest_results" link.
cd $SNPE_ROOT/benchmarks/alexnet/results/latest_results
# Notice the .csv file, open this file in a csv viewer (Excel, LibreOffice Calc)
# Notice the .json file, open the file with any text editor

CSV基准结果文件

CSV文件包含与以下示例类似的结果。某些测量结果可能在CSV文件中不明显。要获取所有时序信息,需要将分析级别设置为详细。默认情况下,配置级别是基本的。请注意,为清楚起见,添加了彩色标题。

在这里插入图片描述

高通SNPE - 基准测试概述(1)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值