From 4a7eb3bf367b780a932d2f073d2a630cc7704153 Mon Sep 17 00:00:00 2001 From: qiuleilei Date: Sat, 19 Jul 2025 16:16:32 +0800 Subject: [PATCH] bugfix --- docs/lite/docs/source_en/advanced/micro.md | 12 ++++++ .../reference/environment_variable_support.md | 37 +++++++++++++++++++ .../docs/source_en/tools/benchmark_tool.md | 24 ++++++++++++ docs/lite/docs/source_zh_cn/advanced/micro.md | 12 ++++++ .../reference/environment_variable_support.md | 37 +++++++++++++++++++ .../docs/source_zh_cn/tools/benchmark_tool.md | 24 ++++++++++++ 6 files changed, 146 insertions(+) create mode 100644 docs/lite/docs/source_en/reference/environment_variable_support.md create mode 100644 docs/lite/docs/source_zh_cn/reference/environment_variable_support.md diff --git a/docs/lite/docs/source_en/advanced/micro.md b/docs/lite/docs/source_en/advanced/micro.md index 6f44de57ad..f27bfcb032 100644 --- a/docs/lite/docs/source_en/advanced/micro.md +++ b/docs/lite/docs/source_en/advanced/micro.md @@ -1135,6 +1135,18 @@ The manner that the model generates code is consistent with that of the non-cust where target sets to be ARM32. +> For recurrent or LSTM networks, users need to configure the TIME_STEP environment variable based on the step value. The configuration method is as follows: + +```bash +export TIME_STEP=3 +``` + +> If the user model contains the proposal operator, the MAX_ROI_NUM environment variable needs to be configured based on the implementation of the proposal operator. If it is not configured, the default value of 300 will be used. The configuration method is as follows: + +```bash +export MAX_ROI_NUM=300 +``` + ### Implementing Custom Kernel by Users The previous step generates the source code directory under the specified path with a header file called `src/registered_kernel.h` that specifies the function declarations for the custom operator. diff --git a/docs/lite/docs/source_en/reference/environment_variable_support.md b/docs/lite/docs/source_en/reference/environment_variable_support.md new file mode 100644 index 0000000000..55241c672b --- /dev/null +++ b/docs/lite/docs/source_en/reference/environment_variable_support.md @@ -0,0 +1,37 @@ +# Description of Environment Variable Support + +[![View Source On Gitee](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/resource/_static/logo_source_en.svg)](https://gitee.com/mindspore/docs/blob/master/docs\lite\docs\source_zh_cn\reference\environment_variable_support.md) + +This document lists the environment variables supported by MindSpore Lite along with their meanings, and provides the available values and default settings for each environment variable. + +| **Environment Variable** | **Description** | **Allowed Values** | **Default Value** | +| :------------------------------------: | :-------------------------------------------------: | :-------------------------: | :---------------: | +| GLOG_v | Log level setting | 0,1,2,3 | 2 | +| KEEP_ORIGIN_DTYPE | Switch to preserve original data type | 1, "" | "" | +| MSLITE_API_TYPE | API type selection for benchmark | NEW, C | NEW | +| MINDSPORE_DUMP_CONFIG | Configuration file for on-device training data dump | Configuration file path | "" | +| ASCEND_BACK_POLICY | Ascend backend policy selection | "ge", "" | "" | +| RANK_ID | Device card sequence number | 0-N | "" | +| ASCEND_DEVICE_ID | Ascend hardware device ID | 0-7, "" | "" | +| GPU_DEVICE_ID | GPU hardware device ID | 0-7, "" | "" | +| BENCHMARK_UPDATE_CONFIG_ENV | Benchmark tool configuration settings | "0", "" | "" | +| MSLITE_PACKAGE_PATH | Test case packaging path | File path | "" | +| MS_ASCEND_CHECK_OVERFLOW_MODE | Precision mode selection | SATURATION_MODE/INFNAN_MODE | INFNAN_MODE | +| DISABLE_REUSE_MEMORY | Ascend GE backend memory reuse switch | "0", "1" | 0 | +| ENABLE_MULTI_BACKEND_RUNTIME | Multi-backend heterogeneous computing switch | "on", "off" | off | +| ASCEND_CUSTOM_OPP_PATH | Installation path for custom Ascend operators | File path | "" | +| ASCEND_OPP_PATH | Path to Ascend operator library | File path | "" | +| MSLITE_ENABLE_CLOUD_INFERENCE | Enable cloud-side inference | "on", "" | "" | +| ENABLE_AKG | Enable AKG optimization | "on", "" | "" | +| MS_INDEPENDENT_DATASET | Use external dataset | "true", "" | "" | +| OPTIMIZE | Enable optimization for MindData scenarios | "true", "" | "" | +| MS_CACHE_HOST | Host address for MindData caching | Host address | 127.0.0.1 | +| MS_CACHE_PORT | Port number for MindData caching | Port number | 50052 | +| DEVICE_ID | Hardware device ID for on-device MindData | 0-7, "" | "" | +| MS_CPU_FEATURE | CPU instruction set architecture | avx512 | "" | +| MS_DEV_GRAPH_KERNEL_SPLIT_DEBUG_TUNING | Graph kernel splitting debug switch | on, "" | "" | +| MS_DEV_DUMP_GRAPH_KERNEL_IR | Dump graph kernel IR | on, "" | "" | +| TIME_STEP | Number of iterations | Integer | "" | +| MAX_ROI_NUM | Maximum number of ROIs for proposal operators | Integer | 300 | +| PARA_GROUP_FILE | Communication domain configuration file | Configuration file path | "" | +| MS_ENABLE_HCCL | Enable HCCL communication library | 0 (empty), non-zero | 0 (empty) | \ No newline at end of file diff --git a/docs/lite/docs/source_en/tools/benchmark_tool.md b/docs/lite/docs/source_en/tools/benchmark_tool.md index 047ceb28b3..aeafd881da 100644 --- a/docs/lite/docs/source_en/tools/benchmark_tool.md +++ b/docs/lite/docs/source_en/tools/benchmark_tool.md @@ -30,6 +30,30 @@ To use the Benchmark tool, you need to prepare the environment as follows: export ASCEND_DEVICE_ID=$RANK_ID ``` +- If you need to configure the Ascend GE backend for benchmark testing, use the following command to switch: + + ```bash + export ASCEND_BACK_POLICY="ge" + ``` + +- If it is necessary to set the Cache through configuration items, it can be configured by the following command: + + ```bash + export BENCHMARK_UPDATE_CONFIG_ENV="0" + ``` + +- If you're running this benchmark based on GPU, use the following command to switch: + + ```bash + export GPU_DEVICE_ID=$RANK_ID + ``` + +- If you need to switch between different versions of the API (optional parameters: NEW or C, default value: NEW), use the following command to switch: + + ```bash + export MSLITE_API_TYPE="NEW" + ``` + ### Parameter Description The command used for benchmark testing based on the compiled Benchmark tool is as follows: diff --git a/docs/lite/docs/source_zh_cn/advanced/micro.md b/docs/lite/docs/source_zh_cn/advanced/micro.md index c12decb663..9d95ee269c 100644 --- a/docs/lite/docs/source_zh_cn/advanced/micro.md +++ b/docs/lite/docs/source_zh_cn/advanced/micro.md @@ -1132,6 +1132,18 @@ name: int8toft32_Softmax-7_post0/output-0, DataType: 43, Elements: 10, Shape: [1 其中config配置文件设置target = ARM32。 +> 对于循环或lstm网络,用户需根据step值,配置TIME_STEP环境变量,配置方式如下: + +```bash +export TIME_STEP=3 +``` + +> 若用户模型含有proposal算子,需根据proposal算子实现情况,配置MAX_ROI_NUM环境变量,若未配置,则采用默认值300,配置方式如下: + +```bash +export MAX_ROI_NUM=300 +``` + ### 用户实现自定义算子 上一步会在用户指定路径下生成源码目录,其有一个名为`src/registered_kernel.h`的头文件指定了custom算子的函数声明: diff --git a/docs/lite/docs/source_zh_cn/reference/environment_variable_support.md b/docs/lite/docs/source_zh_cn/reference/environment_variable_support.md new file mode 100644 index 0000000000..fad1d25f86 --- /dev/null +++ b/docs/lite/docs/source_zh_cn/reference/environment_variable_support.md @@ -0,0 +1,37 @@ +# 环境变量支持说明 + +[![查看源文件](https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/master/resource/_static/logo_source.svg)](https://gitee.com/mindspore/docs/blob/master/docs\lite\docs\source_zh_cn\reference\environment_variable_support.md) + +本文列举MindSpore Lite所支持的环境变量及其含义说明,并相应地给出了每个环境变量的可选取值和默认取值。 + +| **环境变量** | **含义** | **可选值** | **默认值** | +| :------------------------------------: | :---------------------------------------------------------------------: | :-------------------------: | :---------: | +| GLOG_v | 日志等级设置 | 0,1,2,3 | 2 | +| KEEP_ORIGIN_DTYPE | 保持原始数据类型开关 | 1、"" | "" | +| MSLITE_API_TYPE | benchmark选择API类型 | NEW、C | NEW | +| MINDSPORE_DUMP_CONFIG | 端上训练dump数据配置文件 | 配置文件路径 | "" | +| ASCEND_BACK_POLICY | Ascend后端策略选择 | "ge","" | "" | +| RANK_ID | 卡序号 | 0-N | "" | +| ASCEND_DEVICE_ID | Ascend硬件ID | 0到7,"" | "" | +| GPU_DEVICE_ID | GPU硬件ID | 0到7,"" | "" | +| BENCHMARK_UPDATE_CONFIG_ENV | Benchmark工具配置项设置 | "0","" | "" | +| MSLITE_PACKAGE_PATH | 测试用例打包路径 | 文件路径 | "" | +| MS_ASCEND_CHECK_OVERFLOW_MODE | 精度模式选择 | SATURATION_MODE/INFNAN_MODE | INFNAN_MODE | +| disable_REUSE_MEMORY | Ascend ge后端显存复用开关 | "0","1" | 0 | +| ENABLE_MULTI_BACKEND_RUNTIME | 多后端异构能力开关 | "on","off" | off | +| ASCEND_CUSTOM_OPP_PATH | ascendc自定义算子安装路径 | 文件路径 | "" | +| ASCEND_OPP_PATH | Ascend算子路径 | 文件路径 | "" | +| MSLITE_ENABLE_CLOUD_INFERENCE | 是否使能云侧推理 | "on"、"" | "" | +| ENABLE_AKG | 是否使能AKG | "on"、"" | "" | +| MS_INDEPENDENT_DATASET | 是否使用外部数据集 | "true"、"" | "" | +| OPTIMIZE | MindData业务场景下是否使能优化 | "true"、"" | "" | +| MS_CACHE_HOST | MindData业务场景下的主机地址 | 主机地址 | 127.0.0.1 | +| MS_CACHE_PORT | MindData业务场景下的主机端口 | 端口号 | 50052 | +| DEVICE_ID | 端上MindData使用场景下设置硬件ID | 0到7,"" | "" | +| MS_CPU_FEATURE | CPU指令架构 | avx512 | "" | +| MS_DEV_GRAPH_KERNEL_SPLIT_DEBUG_TUNING | 切图调试开关 | on、"" | "" | +| MS_DEV_DUMP_GRAPH_KERNEL_IR | Dump IR | on、"" | "" | +| TIME_STEP | 迭代次数 | 整数类型数据 | "" | +| MAX_ROI_NUM | 若用户模型含有proposal算子,需根据proposal算子实现情况,配置MAX_ROI_NUM | 整数类型数据 | 300 | +| PARA_GROUP_FILE | 通信域配置文件 | 配置文件路径 | "" | +| MS_ENABLE_HCCL | 是否使能HCCL | 0(空)、非0 | 0(空) | \ No newline at end of file diff --git a/docs/lite/docs/source_zh_cn/tools/benchmark_tool.md b/docs/lite/docs/source_zh_cn/tools/benchmark_tool.md index aebad2f1d6..5a57bcd737 100644 --- a/docs/lite/docs/source_zh_cn/tools/benchmark_tool.md +++ b/docs/lite/docs/source_zh_cn/tools/benchmark_tool.md @@ -30,6 +30,30 @@ export ASCEND_DEVICE_ID=$RANK_ID ``` +- 如果需要配置Ascend GE后端进行基准测试,使用如下命令切换: + + ```bash + export ASCEND_BACK_POLICY="ge" + ``` + +- 如果需要通过配置项设置Cache,则可以通过如下命令进行配置: + + ```bash + export BENCHMARK_UPDATE_CONFIG_ENV="0" + ``` + +- 如果基于GPU进行基准测试,使用如下命令切换: + + ```bash + export GPU_DEVICE_ID=$RANK_ID + ``` + +- 如果需要切换不同版本的API(可选参数NEW或者C,默认值:NEW),则使用如下命令切换: + + ```bash + export MSLITE_API_TYPE="NEW" + ``` + ### 参数说明 使用编译好的Benchmark工具进行模型的基准测试时,其命令格式如下所示。 -- Gitee