已合并
【bugfix】修复QUICKSTART文档易用性问题 #1233
majiajian_hw创建于 8月5日
【bugfix】修复QUICKSTART文档易用性问题 #1233
已合并
共 2 个文件变更+32-7
| @@ -20,6 +20,8 @@ | |||
| 20 | 20 | ||
| 21 | 本阶段目的是**快速体验项目标准流程**,验证环境能否成功进行算子源码编译、打包、安装和运行。 | 21 | 本阶段目的是**快速体验项目标准流程**,验证环境能否成功进行算子源码编译、打包、安装和运行。 |
| 22 | 22 | ||
| 23 | +> 本指南以单算子编译过程为例,也支持编译整个算子库算子、离线编译等多种场景,编译过程中的常见问题均可参考[《源码构建指南》](zh/install/compile.md)。 | ||
| 24 | + | ||
| 23 | ### 1. 进入项目源码 | 25 | ### 1. 进入项目源码 |
| 24 | 26 | ||
| 25 | - CANNLab云开发环境: | 27 | - CANNLab云开发环境: |
| @@ -41,9 +43,7 @@ | |||
| 41 | 43 | ||
| 42 | ### 2. 编译AddExample算子 | 44 | ### 2. 编译AddExample算子 |
| 43 | 45 | ||
| 44 | -本指南默认采用**单算子编译**:仅构建目标算子,编译时间短,适合快速入门与日常开发。通用命令格式:`bash build.sh --pkg --soc=<芯片版本> --ops=<算子名>`。 | 46 | +通用命令格式:`bash build.sh --pkg --soc=<芯片版本> --ops=<算子名>`。 |
| 45 | - | ||
| 46 | -> 若需编译整个算子库(省略`--ops`),请参阅[源码构建指南 · 全量编译(ops-cv包)](zh/install/compile.md#ops-cv包)。 | ||
| 47 | 47 | ||
| 48 | 以AddExample算子为例,编译命令如下: | 48 | 以AddExample算子为例,编译命令如下: |
| 49 | 49 | ||
| @@ -88,9 +88,11 @@ export LD_LIBRARY_PATH=${ASCEND_HOME_PATH}/opp/vendors/custom_cv/op_api/lib:${LD | |||
| 88 | 以AddExample为例,其提供了简单算子样例`add_example/examples/test_aclnn_add_example.cpp`,运行该样例验证算子功能是否正常。 | 88 | 以AddExample为例,其提供了简单算子样例`add_example/examples/test_aclnn_add_example.cpp`,运行该样例验证算子功能是否正常。 |
| 89 | 89 | ||
| 90 | ```bash | 90 | ```bash |
| 91 | -bash build.sh --run_example add_example eager cust --vendor_name=custom | 91 | +bash build.sh --run_example add_example eager cust --vendor_name=custom --soc=${soc_version} |
| 92 | ``` | 92 | ``` |
| 93 | 93 | ||
| 94 | +> **注意**:运行样例时需确保`--soc`参数与编译算子包时使用的`--soc`取值一致,否则可能报`error 161001`(如`aclnnXxxGetWorkspaceSize failed`)。如遇此错误,请回到[第2节](#2-编译addexample算子)核对`--soc`取值后重新编译安装。 | ||
| 95 | + | ||
| 94 | 预期输出:打印算子`AddExample`的加法计算结果,表明算子已成功部署并正确执行。 | 96 | 预期输出:打印算子`AddExample`的加法计算结果,表明算子已成功部署并正确执行。 |
| 95 | 97 | ||
| 96 | ```bash | 98 | ```bash |
| @@ -149,7 +151,7 @@ __aicore__ inline void AddExample<T>::Compute(int64_t currentNum) | |||
| 149 | 3. **重新验证**: | 151 | 3. **重新验证**: |
| 150 | 152 | ||
| 151 | ```bash | 153 | ```bash |
| 152 | - bash build.sh --run_example add_example eager cust --vendor_name=custom | 154 | + bash build.sh --run_example add_example eager cust --vendor_name=custom --soc=${soc_version} |
| 153 | ``` | 155 | ``` |
| 154 | 156 | ||
| 155 | 4. **成功标志**:输出结果变成乘法结果。 | 157 | 4. **成功标志**:输出结果变成乘法结果。 |
| @@ -209,7 +211,7 @@ __aicore__ inline void AddExample<T>::Compute(int64_t currentNum) | |||
| 209 | 调用AddExample算子的example样例,生成可执行文件(test_aclnn_add_example),该文件位于项目`ops-cv/build`目录。 | 211 | 调用AddExample算子的example样例,生成可执行文件(test_aclnn_add_example),该文件位于项目`ops-cv/build`目录。 |
| 210 | 212 | ||
| 211 | ```bash | 213 | ```bash |
| 212 | - bash build.sh --run_example add_example eager cust --vendor_name=custom | 214 | + bash build.sh --run_example add_example eager cust --vendor_name=custom --soc=${soc_version} |
| 213 | ``` | 215 | ``` |
| 214 | 216 | ||
| 215 | - **采集性能数据** | 217 | - **采集性能数据** |
| @@ -259,7 +261,7 @@ int main() { | |||
| 259 | 2. 重新执行验证命令: | 261 | 2. 重新执行验证命令: |
| 260 | 262 | ||
| 261 | ```bash | 263 | ```bash |
| 262 | - bash build.sh --run_example add_example eager cust --vendor_name=custom | 264 | + bash build.sh --run_example add_example eager cust --vendor_name=custom --soc=${soc_version} |
| 263 | ``` | 265 | ``` |
| 264 | 266 | ||
| 265 | 3. 观察算子输出结果是否符合预期。 | 267 | 3. 观察算子输出结果是否符合预期。 |
| @@ -269,3 +269,26 @@ Global Environment TearDown | |||
| 269 | ``` | 269 | ``` |
| 270 | 270 | ||
| 271 | \$\{n\}表示执行了n个用例,\$\{m\}表示m项测试,\$\{x\}表示执行用例消耗的时间,单位为毫秒。 | 271 | \$\{n\}表示执行了n个用例,\$\{m\}表示m项测试,\$\{x\}表示执行用例消耗的时间,单位为毫秒。 |
| 272 | + | ||
| 273 | +## FAQ | ||
| 274 | + | ||
| 275 | +### 安装自定义run包报错权限不足 | ||
| 276 | + | ||
| 277 | +默认安装目录需要当前用户具备读、写和执行权限。若提示权限不足,可选择以下一种方式: | ||
| 278 | + | ||
| 279 | +- 推荐安装到当前用户可写的绝对路径,并加载安装包生成的环境变量脚本: | ||
| 280 | + | ||
| 281 | + ```bash | ||
| 282 | + ./build_out/cann-ops-cv-*linux*.run --install-path=/absolute/path/to/opp | ||
| 283 | + source /absolute/path/to/opp/vendors/custom_cv/bin/set_env.bash | ||
| 284 | + ``` | ||
| 285 | + | ||
| 286 | +- 确需安装到系统CANN目录时,使用`sudo -E`保留当前已配置的CANN环境变量: | ||
| 287 | + | ||
| 288 | + ```bash | ||
| 289 | + sudo -E ./build_out/cann-ops-cv-*linux*.run | ||
| 290 | + ``` | ||
| 291 | + | ||
| 292 | +### 安装自定义run包会校验依赖库 `libnnopbase.so`,当该库不在默认搜索路径时校验失败导致安装中断 | ||
| 293 | + | ||
| 294 | +若安装包仅因共享库依赖检查失败而退出,请先确认当前CANN版本与构建环境兼容。确认兼容后可追加`--force`跳过共享库依赖检查;错误使用该参数可能导致算子在运行时加载失败,因此不建议默认使用。 | ||