| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
【PR】: 修正系统信息及 Profiling 样例中的接口、环境变量和文档不一致问题。 Co-authored-by: LiuPeiling<1245275864@qq.com> # message auto-generated for no-merge-commit merge: !3929 merge fix/system-info-version-query into master 【PR】: 修正系统信息及 Profiling 样例中的接口、环境变量和文档不一致问题。 Created-by: freedom178 Commit-by: LiuPeiling Merged-by: cann-robot Description: # Pull Request ## 描述 1. System info 样例 - example/0_quickstart/2_system_info/main.cpp - 删除 aclrtGetVersion 调用、版本号变量及对应日志输出(aclrtGetVersion为废弃接口) - 保留通过 aclsysGetVersionStr 和 aclsysGetVersionNum 查询 CANN 软件包版本的逻辑。 - example/0_quickstart/2_system_info/README.md - 删除 aclrtGetVersion 接口说明及过期的版本号示例输出。 - example/0_quickstart/2_system_info/README_en.md - 同步更新英文接口说明和示例输出。 2. Profiling 0_create_config 样例 - example/5_performance/profiling/0_create_config/run.sh - 增加 set -euo pipefail,确保命令或管道执行失败时脚本及时退出。 - 将 _ASCEND_INSTALL_PATH 替换为 _ASCEND_CANN_PATH。 - 将 ASCEND_INSTALL_PATH 替换为 ASCEND_HOME_PATH。 - 增加 ASCEND_HOME_PATH 空值检查和错误提示。 - 为环境路径、CMake 参数及输出文件变量增加安全引用。 - example/5_performance/profiling/0_create_config/README.md - 将运行说明中的 ASCEND_INSTALL_PATH 更新为 ASCEND_HOME_PATH。 - example/5_performance/profiling/0_create_config/README_en.md - 同步更新英文运行说明中的环境变量。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在当前页面的右侧'关联Issue'部分添加相应Issue链接,并勾选'合并后关闭已关联的 Issue'选项。 --> ## 如何测试 描述测试此变更的步骤和前提条件: 1. 2. ## 核对清单 <!-- [x] 表示选中 --> - [ ] 我的代码遵循了项目的代码风格 - [ ] 我已对代码进行了自测 - [ ] 我已更新了相关的文档 - [ ] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [ ] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 在此添加任何其他关于本次 PR 的说明。 See merge request: cann/runtime!3929 | 5 天前 | |
【PR】: fix: 修正example中的几处处文本错误和内存未释放 Co-authored-by: G0rogoa<15357573068@163.com> # message auto-generated for no-merge-commit merge: !3963 merge master into master 【PR】: fix: 修正example中的几处处文本错误和内存未释放 Created-by: moritaka1 Commit-by: G0rogoa Merged-by: cann-robot Description: # Pull Request ## 描述 | # | 位置 | 修改 | | --- | --- | --- | | 1 | 1_basic_features\\event\\0_event_status\\main.cpp:48 + 同目录 README.md:68 | "beging assigning task" → "begin assigning task" | | 2 | 1_basic_features\\device\\0_device_normal\\main.cpp:107 | 注释 "syschronously" → "synchronously" | | 3 | 1_basic_features\\device\\1_device_multi_thread\\main.cpp:117 + 同目录 README.md:77 | "Thr results" → "The results" | | 4 | 2_advanced_features\\model_ri\\0_simple_model\\README.md:51 | "异步执行执行模型推理" → "异步执行模型推理"(重复词) | | 5 | 2_advanced_features\\model_ri\\1_model_update\\README.md:52 | 同上,"执行执行" 重复 | 6 | 1_basic_features\\device\\1_device_multi_thread\\main.cpp:94,127-128 | hostDst 经 aclrtMallocHost 分配(:94),但释放阶段(:127-128)只 aclrtFreeHost(hostSrcA/hostSrcB),hostDst 从未释放 | | 7 | 1_basic_features\\event\\1_event_timestamp\\main.cpp:46,67,87 | numDevice 在 :46 首次 aclrtMalloc,:67 再次 aclrtMalloc 覆盖指针,:87 仅 free 一次 —— 第一次分配的 Device 内存泄漏 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [x] 🐛 Bug 修复 - [ ] ✨ 新功能 - [x] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在当前页面的右侧'关联Issue'部分添加相应Issue链接,并勾选'合并后关闭已关联的 Issue'选项。 --> ## 如何测试 仅文本修改 ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如: feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 无 See merge request: cann/runtime!3963 | 4 天前 | |
fix: 修正异常回调样例中的英文语法错误 Co-authored-by: likeA_star<huyongfei171@foxmail.com> # message auto-generated for no-merge-commit merge: !3933 merge fix/callback-exception-grammar into master fix: 修正异常回调样例中的英文语法错误 Created-by: likeA_star Commit-by: likeA_star Merged-by: cann-robot Description: # Pull Request ## 描述 修正异常回调示例日志中的英文冠词和动词搭配错误,并同步更新英文 README 中的示例输出。 ## 变更类型 - [x] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue 无。 ## 如何测试 1. 运行 git diff --check,检查无空白错误。 2. 核对源码日志与 README 英文示例输出保持一致。 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 本次仅修改英文日志文本及其对应文档,不涉及运行时行为变更。 See merge request: cann/runtime!3933 | 4 天前 | |
【PR】: 增加UVM内存申请相关用例 Co-authored-by: hnn___36<haoyijun1@huawei.com> # message auto-generated for no-merge-commit merge: !3131 merge master into master 【PR】: 增加UVM内存申请相关用例 Created-by: hnn___36 Commit-by: hnn___36 Merged-by: cann-robot Description: # Pull Request ## 描述 增加UVM用例,通过UVM内存申请接口为算子输入、输出分配内存,消除了算子参数追加和结果写回过程中的显式数据搬运。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue NA ## 如何测试 描述测试此变更的步骤和前提条件: 1. 下载样例代码至安装 CANN 软件的环境,切换到样例目录。 bash cd ${git_clone_path}/example/3_memory_advanced/managed_memory/0_uvm_allocate 2. 设置环境变量。 bash # ${install_root} 替换为 CANN 安装根目录,默认安装在 /usr/local/Ascend 目录 source ${install_root}/cann/set_env.sh export ASCEND_INSTALL_PATH=${install_root}/cann # ${ascend_name} 替换为昇腾 AI 处理器型号,可通过 npu-smi info 查看 Name 字段并去掉空格获得 export SOC_VERSION=${ascend_name} # ${cmake_path} 替换为 ascendc.cmake 所在目录,例如 ${install_root}/cann/aarch64-linux/tikcpp/ascendc_kernel_cmake export ASCENDC_CMAKE_DIR=${cmake_path} 如果未提前设置环境变量,run.sh 会自动尝试探测 ASCEND_INSTALL_PATH、ASCEND_HOME_PATH、$HOME/Ascend/cann、/usr/local/Ascend/cann、/opt/Ascend/cann、SOC_VERSION 和 ASCENDC_CMAKE_DIR;如果自动探测失败,请按上述命令手动设置。 本样例的数据生成与结果校验依赖 numpy,执行 run.sh 前请确保 Python 环境已安装 numpy。 3. 执行以下命令运行样例。 bash bash run.sh 预期结果: text Configuring CMake... Building... ... [INFO] Run the uvm_allocate sample successfully. ... output/output_z.bin ... output/golden.bin error ratio: 0.0000, tolerance: 0.0010 [SUCCESS] result correct ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 在此添加任何其他关于本次 PR 的说明。 See merge request: cann/runtime!3131 | 1 个月前 | |
【PR】:优化 Runtime 样例可执行性与文档一致性 Co-authored-by: shi-qiong<shiqiong3@huawei.com> # message auto-generated for no-merge-commit merge: !3236 merge feature/runtime-example-usability-fixes into master 【PR】:优化 Runtime 样例可执行性与文档一致性 Created-by: shi-qiong Commit-by: shi-qiong Merged-by: cann-robot Description: # Pull Request ## 描述 本次 PR 主要优化 Runtime example 的文档一致性、运行步骤完整性和自动化执行友好性,降低样例运行和评估过程中的误判风险。 | 编号 | 级别 | 描述 | 建议 | |------|------|------|------| | 1 | 严重 | 5_performance/profiling/3_mstx_with_domain/README.md 疑似从 toolkit 仓错误搬运:引用 sample_run.sh(实际为 run.sh)、安装路径指向 /usr/local/Ascend/ascend-toolkit/8.x.x/tools/mstx/samples、表格链接 ./mstx_with_domain 子目录不存在(实际为同级 cpp 文件),与 CMakeLists.txt+run.sh 工程结构不符 | 按本仓实际工程结构重写该 README,对齐全仓统一的"编译运行"小节格式 | | 2 | 一般 | 4 处失败链接:4_reliability/README.md→snapshot/(目录缺失)、4_reliability/fault_tolerant/README.md→../snapshot/、2_advanced_features/notify/README.md→2_cntnotify(目录缺失)、3_mstx_with_domain 表格链接 | 删除失效链接,或补齐对应目录/用例 | | 3 | 一般 | 31 个用例 README 环境配置步骤不完整:2/3/4/5 模块普遍改用手动 export SOC_VERSION,未提及 set_sample_env.sh,与 1_basic_features(全部使用 set_sample_env.sh)方案并存,文档体系不统一 | 全仓统一环境配置方式,推荐统一采用 source set_sample_env.sh 并在所有用例 README 写全 4 步骤 | | 4 | 一般 | 设备复位接口不一致:ipcevent/0_ipcevent、ipcevent/1_ipcevent_multi_device 使用 aclrtResetDevice,其余 50 个用例统一使用 aclrtResetDeviceForce | 统一为 aclrtResetDeviceForce 或在 README 注明差异原因 | | 5 | 一般 | 10 个 memory 用例的示例输出夹带伪版本号 CANN Version: 1.0.0, TimeStamp: ...,与真实 CANN 版本(9.1.0)不符,且位置不统一 | 清理示例输出中的占位版本号 | | 6 | 提示 | ipcevent/1_ipcevent_multi_device 在设备数不足时 exit 1,易被自动化框架误判为 FAIL | 启动前调用 aclrtGetDeviceCount 预检,不满足时优雅退出(exit 0 + SKIP 提示) | | 7 | 提示 | 22 个 advanced/performance 用例缺少「示例输出」小节 | 补充各用例的预期运行输出 | | 8 | 提示 | 0_quickstart/0_hello_cann README 文字"快速入门示示例"("示例"重复);stream/0_simple_stream 输出"beging assigning task"拼写错误 | 修正文字笔误 | | 9 | 提示 | 产品支持表口径不一致:quickstart/1_basic_features 含"Ascend 950PR/950DT",2/3/4/5 仅列 Atlas A3/A2,差异未说明 | 统一产品支持表口径或补注差异原因 | 主要变更包括: - 修正部分 README 中错误链接、错误脚本名、错误路径和示例表格链接。 - 统一部分 advanced/performance 样例的环境配置说明,补充 set_sample_env.sh 使用方式。 - 为缺少示例输出的样例补充「示例输出」小节。 - 移除 memory 样例输出中的伪 CANN 版本号。 - 修复 quickstart/stream 文档与输出中的文字拼写问题。 - 为 ipcevent/1_ipcevent_multi_device 增加设备数预检,设备不足时以 SKIP 方式优雅退出,避免自动化框架误判为 FAIL。 - 补充产品支持表说明和 Device 复位接口使用约定。 - 调整 3_mstx_with_domain 样例 README、run.sh 和代码,使其与实际工程结构一致。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [x] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [x] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue 无。 ## 如何测试 描述测试此变更的步骤和前提条件: 1. 执行 git diff --check,确认无空白格式问题。 2. 执行修改后的样例验证,确认 3_mstx_with_domain 可正常编译运行。 3. 执行 ipcevent/1_ipcevent_multi_device,在设备数不足场景下确认输出 SKIP 提示并返回 0。 ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 本次修改聚焦 Runtime example 易用性整改,未包含本地评估报告目录和辅助 skill 目录。 See merge request: cann/runtime!3236 | 1 个月前 | |
fix: 修复性能样例脚本构建失败退出码 Co-authored-by: Eternal-z<jialuze@huawei.com> # message auto-generated for no-merge-commit merge: !3958 merge fix/example-script-exit-code into master fix: 修复性能样例脚本构建失败退出码 Created-by: Eternal-z Commit-by: Eternal-z Merged-by: cann-robot Description: # Pull Request ## 描述 规范:G.SCRIPT.08构建脚本成功返回0,构建失败应该以非0的退出码退出 缺陷描述: lost "set -e" at shell scripts head ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [x] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 关联的Issue 无。 ## 如何测试 1. 使用 bash -n 检查四个脚本,检查通过。 2. 分别模拟必需环境变量缺失,四个脚本均以退出码 1 退出。 3. 使用 git diff --check 检查改动,无空白错误。 ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 本次仅修改四个性能样例的构建运行脚本,无需更新使用文档。 See merge request: cann/runtime!3958 | 5 天前 | |
fix(example): 修复 README 失效链接(#667) Co-authored-by: nevermore_t<tianjingxuan2@huawei.com> # message auto-generated for no-merge-commit merge: !3220 merge fix/issue-667-broken-links into master fix(example): 修复 README 失效链接(#667) Created-by: nevermore_t Commit-by: nevermore_t Merged-by: cann-robot Description: ## 描述 修复 issue #667 报告的 README 失效链接。 PR !1608 删除了 2_cntnotify 和 snapshot 两个样例目录(A2/A3 不支持 cntnotify 接口,snapshot 为试验接口后续 950 已不支持),但未同步清理父目录 README 中的引用链接,导致死链。 本次变更: - 删除 notify/README.md 中指向已删除的 2_cntnotify 的链接 - 删除 fault_tolerant/README.md 中指向已删除的 snapshot 的链接 - 统一 11 个 README 的 section title:"可先参考"→"可选参考"(更符合作为标题的语义,英文版对应 References) ## 变更类型 - [x] 📝 文档内容更新 ## 关联的Issue #667 ## 如何测试 1. 确认 example/2_advanced_features/notify/ 下不再有 2_cntnotify 目录引用 2. 确认 example/4_reliability/ 下不再有 snapshot 目录引用 3. 确认所有保留的链接指向的目录存在 4. grep -r "可先参考" example/ 返回空(已全部替换为"可选参考") ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定 See merge request: cann/runtime!3220 | 1 个月前 | |
feat: 完善 0_quickstart 示例的 CANN 环境自动探测 Co-authored-by: weixin_51634168<2082464740@qq.com> Co-authored-by: gitcode-bot<noreply@gitcode.com> # message auto-generated for no-merge-commit merge: !3672 merge master into master feat: 完善 0_quickstart 示例的 CANN 环境自动探测 Created-by: weixin_51634168 Commit-by: chenyang;gitcode-bot;weixin_51634168 Merged-by: cann-robot Description: ## 完善 0_quickstart 示例的 CANN 环境自动探测 ### 概述 在 example/0_quickstart 下继续补齐 CANN 环境自动探测能力,覆盖此前未改造的剩余示例。根据各示例对环境变量的实际需求,分别采用轻量的 example/common/resolve_cann_env.sh 或功能完整的 example/set_sample_env.sh,避免用户手动配置 ASCEND_INSTALL_PATH/SOC_VERSION/ASCENDC_CMAKE_DIR。 同时增强公共脚本 example/common/resolve_cann_env.sh 的安装路径覆盖范围,使其与 example/set_sample_env.sh 保持一致的候选目录。 ### 变更内容 #### 1. 增强 example/common/resolve_cann_env.sh 在候选路径列表中新增 ascend-toolkit/latest 布局,覆盖更多昇腾开发板与容器安装场景: - $HOME/Ascend/ascend-toolkit/latest - /usr/local/Ascend/ascend-toolkit/latest #### 2. 改造 example/0_quickstart/3_cross_version/0_runtime_compatibility/run.sh - 移除对 ASCEND_HOME_PATH 必须手动设置的硬性要求 - 复用 example/common/resolve_cann_env.sh 自动探测 ASCEND_INSTALL_PATH - 探测失败时给出清晰错误提示 #### 3. 改造 example/0_quickstart/4_custom_kernel_launch/run.sh - 该示例编译 AscendC 自定义算子,需要 ASCEND_INSTALL_PATH、SOC_VERSION、ASCENDC_CMAKE_DIR 三个变量 - 直接 source example/set_sample_env.sh 一次性完成全部环境检测 - 保留对 SOC_VERSION、ASCENDC_CMAKE_DIR 及 ascendc.cmake 存在性的校验 ### 设计思路 | 示例 | 所需环境变量 | 采用方案 | 思路 | |---|---|---|---| | 0_hello_cann | ASCEND_INSTALL_PATH | resolve_cann_env.sh | 仅需 CANN 路径,避免 set_sample_env.sh 编译 helper 的开销 | | 1_error_handling | ASCEND_INSTALL_PATH | resolve_cann_env.sh | 同上 | | 2_system_info | ASCEND_INSTALL_PATH | resolve_cann_env.sh | 同上 | | 3_cross_version/0_runtime_compatibility | ASCEND_INSTALL_PATH | resolve_cann_env.sh | 同上 | | 4_custom_kernel_launch | ASCEND_INSTALL_PATH + SOC_VERSION + ASCENDC_CMAKE_DIR | 直接 source set_sample_env.sh | 一次性完成三项检测 | ### 使用场景 - **昇腾开发板** - **容器/云服务器** - **多环境切换** --- ## 变更类型 - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 如何测试 ```bash cd example/0_quickstart/3_cross_version/0_runtime_compatibility ./run.sh cd example/0_quickstart/4_custom_kernel_launch ./run.sh See merge request: cann/runtime!3672 | 12 天前 | |
优化example目录结构易用性及补充用例 Co-authored-by: qiang_zq<qiang.zhangqiang@huawei.com> # message auto-generated for no-merge-commit merge: !1163 merge sample into master 优化example目录结构易用性及补充用例 Created-by: qiang_zq Commit-by: qiang_zq Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 1、example 目录结构优化,按学习阶段重新组织目录结构(0_quickstart ~ 6_scenarios) 2、补充部分API的example用例 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> https://gitcode.com/cann/runtime/issues/284 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 部分用例执行过程 source /home/developer/Ascend/cann/set_env.sh && export SOC_VERSION=ascend910b3 && export ASCENDC_CMAKE_DIR=/home/developer/Ascend/cann/aarch64-linux/tikcpp/ascendc_kernel_cmake && export ASCEND_INSTALL_PATH=/home/developer/Ascend/cann && cd /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator && rm -rf build && dos2unix run.sh 2>/dev/null || sed -i 's/\\r$//' run.sh && bash run.sh Configuring CMake... -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator/build Building... [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main Build completed successfully! Executable location: /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator/build/main Run the sample: ./build/main ./build/main [INFO] CustomAlloc size=256 [INFO] CustomAllocAdvise size=128 [INFO] CustomAlloc size=128 [INFO] CustomFree invoked [INFO] CustomFree invoked [INFO] Allocator desc queried: descOut=0xaaaabd6a3780 allocCount=2 freeCount=2 用例执行报告 0_quickstart (3/3) ✅ ✅ 0_hello_cann ✅ 1_error_handling ✅ 2_system_info 1_basic_features (23/23) ✅ ✅ device/0_device_normal ✅ device/1_device_multi_thread ✅ device/2_device_P2P ✅ event/0_event_status ✅ event/1_event_timestamp ✅ memory/0_h2h_memory_copy ✅ memory/10_ipc_memory_withpid ✅ memory/11_ipc_memory_withoutpid ✅ memory/1_h2d_sync_memory_copy ✅ memory/2_h2d_async_memory_copy ✅ memory/3_d2h_sync_memory_copy ✅ memory/4_d2h_async_memory_copy ✅ memory/5_d2d_sync_memory_copy ✅ memory/6_d2d_async_memory_copy ✅ memory/7_physical_memory_sharing_withpid ✅ memory/8_physical_memory_sharing_withoutpid ✅ memory/9_multistream_sync_memory ✅ stream/0_simple_stream ✅ stream/1_stream_with_failure_mode ✅ stream/2_multi_stream 2_advanced_features (17/17) ✅ ✅ built_in_task/0_reduce_task ✅ built_in_task/1_random_num_task ✅ callback/0_simple_callback ✅ callback/1_callback_hostfunc ✅ callback/2_callback_exception ✅ group/0_compute_group ✅ kernel/0_launch_kernel ✅ kernel/1_launch_kernel_with_reslimit ✅ label/0_simple_label ✅ model_ri/0_simple_model ✅ model_ri/1_model_update ✅ model_ri/2_model_switch ✅ notify/0_ipc_notify_withpid ✅ notify/1_ipc_notify_withoutpid ✅ notify/2_cntnotify ✅ tdt_buffer/0_shared_buffer ✅ tdt_channel/0_simple_channel ✅ tdt_channel/1_channel_capacity ✅ tdt_queue/0_simple_queue ✅ tdt_queue/1_queue_route ✅ tdt_queue/2_queue_grant_attach 3_memory_advanced (1/1) ✅ ✅ allocator/0_custom_allocator 4_reliability (2/2) ✅ ✅ overflow_detection/0_overflow_detection ✅ snapshot/0_snapshot_management 5_performance (6/6) ✅ ✅ adump/0_adump_args ✅ adump/1_adump_callback ✅ adump/2_model_dump_config ✅ profiling/0_create_config ✅ profiling/1_msproftx ✅ profiling/2_subscribe_model ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> docs/02_dev_guide/初始化.md example/*.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/runtime!1163 | 4 个月前 | |
【PR】: fix: sample 易用性规范性优化 Co-authored-by: qiang_zq<qiang.zhangqiang@huawei.com> # message auto-generated for no-merge-commit merge: !2067 merge master into master 【PR】: fix: sample 易用性规范性优化 Created-by: qiang_zq Commit-by: qiang_zq Merged-by: cann-robot Description: # Pull Request ## 描述 1、sample样例 readme规范化 整改 2、sample样例 补充优化注释 3、sample样例 cmakelist 连接包优化,libascendcl.so -> libacl_rt.so 4、新增一键导入 SOC_VERSION和ASCENDC_CMAKE_DIR变量的工具 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [x] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在当前页面的右侧'关联Issue'部分添加相应Issue链接,并勾选'合并后关闭已关联的 Issue'选项。 --> ## 如何测试 描述测试此变更的步骤和前提条件: 1. example/0_quickstart/4_custom_kernel_launch Vector addition result: result[0] = 1.5 (expected: 1.5) result[1] = 3.0 (expected: 3.0) result[2] = 4.5 (expected: 4.5) result[3] = 6.0 (expected: 6.0) result[4] = 7.5 (expected: 7.5) result[5] = 9.0 (expected: 9.0) result[6] = 10.5 (expected: 10.5) result[7] = 12.0 (expected: 12.0) Free device memory successfully Destroy stream successfully Reset device successfully ACL finalize successfully Sample run successfully with <<<>>> kernel call! 2. 样例执行验证 ===== START 0_quickstart/0_hello_cann ===== RESULT 0_quickstart/0_hello_cann rc=0 -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/0_hello_cann/build Building... [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main Build completed successfully! Executable location: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/0_hello_cann/build/main Run the sample: ./build/main ACL init successfully Set device 0 successfully Create stream successfully Input vectors: self: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] other: [0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0] alpha: 1.0 Create output aclDataBuffer successfully, buffer addr = 0x12e0c0016000 Get workspace size successfully, workspace size = 0 Launch aclnnAdd successfully Synchronize stream successfully Vector addition result: result[0] = 1.5 (expected: 1.5) result[1] = 3.0 (expected: 3.0) result[2] = 4.5 (expected: 4.5) result[3] = 6.0 (expected: 6.0) result[4] = 7.5 (expected: 7.5) result[5] = 9.0 (expected: 9.0) result[6] = 10.5 (expected: 10.5) result[7] = 12.0 (expected: 12.0) Free device memory successfully Destroy stream successfully Reset device successfully ACL finalize successfully Sample run successfully! ===== END 0_quickstart/0_hello_cann ===== ===== START 0_quickstart/1_error_handling ===== RESULT 0_quickstart/1_error_handling rc=0 Configuring CMake... -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/1_error_handling/build Building... [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main Build completed successfully! Executable location: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/1_error_handling/build/main Run the sample: ./build/main [INFO] ACL init and set device successfully [INFO] Current run mode: ACL_HOST [INFO] Triggering an expected invalid-parameter error with aclrtGetRunMode(nullptr) [ERROR] Diagnostics: ret=100000, peekErr=0, lastErr=0, recentErrMsg=[PID: 334883] 2026-05-12-16:34:08.984.159 Invalid_Argument_Null_Pointer(EH0002): Argument [runMode] must not be null. Solution: Try again with a correct pointer argument. [WARN] aclrtGetErrorVerbose(0) returned error code 207000 [INFO] After diagnostics are consumed once: peekErr=207000, lastErr=207000, recentErrMsg=<null> [INFO] ACL finalize successfully ===== END 0_quickstart/1_error_handling ===== ===== START 0_quickstart/2_system_info ===== RESULT 0_quickstart/2_system_info rc=0 Configuring CMake... -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/2_system_info/build Building... [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main Build completed successfully! Executable location: /mnt/workspace/gitCode/qiang_zq/runtime/example/0_quickstart/2_system_info/build/main Run the sample: ./build/main [INFO] ACL init successfully [INFO] ACL Runtime API version: 1.16.0 [INFO] CANN package [runtime] version string: 9.0.0 [INFO] CANN package [runtime] version number: 90000000 [INFO] Current run mode: ACL_HOST [INFO] Float conversion: 1.625000 -> 0x3e80 -> 1.625000 [INFO] Data type size: ACL_FLOAT=4, ACL_FLOAT16=2, ACL_INT64=8 [INFO] ACL finalize successfully ===== END 0_quickstart/2_system_info ===== ===== START 1_basic_features/device/0_device_normal ===== RESULT 1_basic_features/device/0_device_normal rc=0 [INFO]: Current compile soc version is ascend910_9362 -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/1_basic_features/device/0_device_normal/build [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main -- Install configuration: \"Debug\" [INFO] Start to run device_normal sample. [INFO] result[0] is: 1.200000 [INFO] result[1] is: 2.200000 [INFO] result[2] is: 3.200000 [INFO] result[3] is: 5.400000 [INFO] result[4] is: 6.400000 [INFO] result[5] is: 7.400000 [INFO] result[6] is: 9.600000 [INFO] result[7] is: 10.600000 [INFO] Run the device_normal sample successfully. ===== END 1_basic_features/device/0_device_normal ===== ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 在此添加任何其他关于本次 PR 的说明。 See merge request: cann/runtime!2067 | 2 个月前 | |
Initial commit | 7 个月前 | |
【PR】:优化 Runtime 样例可执行性与文档一致性 Co-authored-by: shi-qiong<shiqiong3@huawei.com> # message auto-generated for no-merge-commit merge: !3236 merge feature/runtime-example-usability-fixes into master 【PR】:优化 Runtime 样例可执行性与文档一致性 Created-by: shi-qiong Commit-by: shi-qiong Merged-by: cann-robot Description: # Pull Request ## 描述 本次 PR 主要优化 Runtime example 的文档一致性、运行步骤完整性和自动化执行友好性,降低样例运行和评估过程中的误判风险。 | 编号 | 级别 | 描述 | 建议 | |------|------|------|------| | 1 | 严重 | 5_performance/profiling/3_mstx_with_domain/README.md 疑似从 toolkit 仓错误搬运:引用 sample_run.sh(实际为 run.sh)、安装路径指向 /usr/local/Ascend/ascend-toolkit/8.x.x/tools/mstx/samples、表格链接 ./mstx_with_domain 子目录不存在(实际为同级 cpp 文件),与 CMakeLists.txt+run.sh 工程结构不符 | 按本仓实际工程结构重写该 README,对齐全仓统一的"编译运行"小节格式 | | 2 | 一般 | 4 处失败链接:4_reliability/README.md→snapshot/(目录缺失)、4_reliability/fault_tolerant/README.md→../snapshot/、2_advanced_features/notify/README.md→2_cntnotify(目录缺失)、3_mstx_with_domain 表格链接 | 删除失效链接,或补齐对应目录/用例 | | 3 | 一般 | 31 个用例 README 环境配置步骤不完整:2/3/4/5 模块普遍改用手动 export SOC_VERSION,未提及 set_sample_env.sh,与 1_basic_features(全部使用 set_sample_env.sh)方案并存,文档体系不统一 | 全仓统一环境配置方式,推荐统一采用 source set_sample_env.sh 并在所有用例 README 写全 4 步骤 | | 4 | 一般 | 设备复位接口不一致:ipcevent/0_ipcevent、ipcevent/1_ipcevent_multi_device 使用 aclrtResetDevice,其余 50 个用例统一使用 aclrtResetDeviceForce | 统一为 aclrtResetDeviceForce 或在 README 注明差异原因 | | 5 | 一般 | 10 个 memory 用例的示例输出夹带伪版本号 CANN Version: 1.0.0, TimeStamp: ...,与真实 CANN 版本(9.1.0)不符,且位置不统一 | 清理示例输出中的占位版本号 | | 6 | 提示 | ipcevent/1_ipcevent_multi_device 在设备数不足时 exit 1,易被自动化框架误判为 FAIL | 启动前调用 aclrtGetDeviceCount 预检,不满足时优雅退出(exit 0 + SKIP 提示) | | 7 | 提示 | 22 个 advanced/performance 用例缺少「示例输出」小节 | 补充各用例的预期运行输出 | | 8 | 提示 | 0_quickstart/0_hello_cann README 文字"快速入门示示例"("示例"重复);stream/0_simple_stream 输出"beging assigning task"拼写错误 | 修正文字笔误 | | 9 | 提示 | 产品支持表口径不一致:quickstart/1_basic_features 含"Ascend 950PR/950DT",2/3/4/5 仅列 Atlas A3/A2,差异未说明 | 统一产品支持表口径或补注差异原因 | 主要变更包括: - 修正部分 README 中错误链接、错误脚本名、错误路径和示例表格链接。 - 统一部分 advanced/performance 样例的环境配置说明,补充 set_sample_env.sh 使用方式。 - 为缺少示例输出的样例补充「示例输出」小节。 - 移除 memory 样例输出中的伪 CANN 版本号。 - 修复 quickstart/stream 文档与输出中的文字拼写问题。 - 为 ipcevent/1_ipcevent_multi_device 增加设备数预检,设备不足时以 SKIP 方式优雅退出,避免自动化框架误判为 FAIL。 - 补充产品支持表说明和 Device 复位接口使用约定。 - 调整 3_mstx_with_domain 样例 README、run.sh 和代码,使其与实际工程结构一致。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [x] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [x] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue 无。 ## 如何测试 描述测试此变更的步骤和前提条件: 1. 执行 git diff --check,确认无空白格式问题。 2. 执行修改后的样例验证,确认 3_mstx_with_domain 可正常编译运行。 3. 执行 ipcevent/1_ipcevent_multi_device,在设备数不足场景下确认输出 SKIP 提示并返回 0。 ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 本次修改聚焦 Runtime example 易用性整改,未包含本地评估报告目录和辅助 skill 目录。 See merge request: cann/runtime!3236 | 1 个月前 | |
【PR】:优化 Runtime 样例可执行性与文档一致性 Co-authored-by: shi-qiong<shiqiong3@huawei.com> # message auto-generated for no-merge-commit merge: !3236 merge feature/runtime-example-usability-fixes into master 【PR】:优化 Runtime 样例可执行性与文档一致性 Created-by: shi-qiong Commit-by: shi-qiong Merged-by: cann-robot Description: # Pull Request ## 描述 本次 PR 主要优化 Runtime example 的文档一致性、运行步骤完整性和自动化执行友好性,降低样例运行和评估过程中的误判风险。 | 编号 | 级别 | 描述 | 建议 | |------|------|------|------| | 1 | 严重 | 5_performance/profiling/3_mstx_with_domain/README.md 疑似从 toolkit 仓错误搬运:引用 sample_run.sh(实际为 run.sh)、安装路径指向 /usr/local/Ascend/ascend-toolkit/8.x.x/tools/mstx/samples、表格链接 ./mstx_with_domain 子目录不存在(实际为同级 cpp 文件),与 CMakeLists.txt+run.sh 工程结构不符 | 按本仓实际工程结构重写该 README,对齐全仓统一的"编译运行"小节格式 | | 2 | 一般 | 4 处失败链接:4_reliability/README.md→snapshot/(目录缺失)、4_reliability/fault_tolerant/README.md→../snapshot/、2_advanced_features/notify/README.md→2_cntnotify(目录缺失)、3_mstx_with_domain 表格链接 | 删除失效链接,或补齐对应目录/用例 | | 3 | 一般 | 31 个用例 README 环境配置步骤不完整:2/3/4/5 模块普遍改用手动 export SOC_VERSION,未提及 set_sample_env.sh,与 1_basic_features(全部使用 set_sample_env.sh)方案并存,文档体系不统一 | 全仓统一环境配置方式,推荐统一采用 source set_sample_env.sh 并在所有用例 README 写全 4 步骤 | | 4 | 一般 | 设备复位接口不一致:ipcevent/0_ipcevent、ipcevent/1_ipcevent_multi_device 使用 aclrtResetDevice,其余 50 个用例统一使用 aclrtResetDeviceForce | 统一为 aclrtResetDeviceForce 或在 README 注明差异原因 | | 5 | 一般 | 10 个 memory 用例的示例输出夹带伪版本号 CANN Version: 1.0.0, TimeStamp: ...,与真实 CANN 版本(9.1.0)不符,且位置不统一 | 清理示例输出中的占位版本号 | | 6 | 提示 | ipcevent/1_ipcevent_multi_device 在设备数不足时 exit 1,易被自动化框架误判为 FAIL | 启动前调用 aclrtGetDeviceCount 预检,不满足时优雅退出(exit 0 + SKIP 提示) | | 7 | 提示 | 22 个 advanced/performance 用例缺少「示例输出」小节 | 补充各用例的预期运行输出 | | 8 | 提示 | 0_quickstart/0_hello_cann README 文字"快速入门示示例"("示例"重复);stream/0_simple_stream 输出"beging assigning task"拼写错误 | 修正文字笔误 | | 9 | 提示 | 产品支持表口径不一致:quickstart/1_basic_features 含"Ascend 950PR/950DT",2/3/4/5 仅列 Atlas A3/A2,差异未说明 | 统一产品支持表口径或补注差异原因 | 主要变更包括: - 修正部分 README 中错误链接、错误脚本名、错误路径和示例表格链接。 - 统一部分 advanced/performance 样例的环境配置说明,补充 set_sample_env.sh 使用方式。 - 为缺少示例输出的样例补充「示例输出」小节。 - 移除 memory 样例输出中的伪 CANN 版本号。 - 修复 quickstart/stream 文档与输出中的文字拼写问题。 - 为 ipcevent/1_ipcevent_multi_device 增加设备数预检,设备不足时以 SKIP 方式优雅退出,避免自动化框架误判为 FAIL。 - 补充产品支持表说明和 Device 复位接口使用约定。 - 调整 3_mstx_with_domain 样例 README、run.sh 和代码,使其与实际工程结构一致。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [x] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [x] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue 无。 ## 如何测试 描述测试此变更的步骤和前提条件: 1. 执行 git diff --check,确认无空白格式问题。 2. 执行修改后的样例验证,确认 3_mstx_with_domain 可正常编译运行。 3. 执行 ipcevent/1_ipcevent_multi_device,在设备数不足场景下确认输出 SKIP 提示并返回 0。 ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 本次修改聚焦 Runtime example 易用性整改,未包含本地评估报告目录和辅助 skill 目录。 See merge request: cann/runtime!3236 | 1 个月前 | |
优化example目录结构易用性及补充用例 Co-authored-by: qiang_zq<qiang.zhangqiang@huawei.com> # message auto-generated for no-merge-commit merge: !1163 merge sample into master 优化example目录结构易用性及补充用例 Created-by: qiang_zq Commit-by: qiang_zq Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 1、example 目录结构优化,按学习阶段重新组织目录结构(0_quickstart ~ 6_scenarios) 2、补充部分API的example用例 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> https://gitcode.com/cann/runtime/issues/284 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 部分用例执行过程 source /home/developer/Ascend/cann/set_env.sh && export SOC_VERSION=ascend910b3 && export ASCENDC_CMAKE_DIR=/home/developer/Ascend/cann/aarch64-linux/tikcpp/ascendc_kernel_cmake && export ASCEND_INSTALL_PATH=/home/developer/Ascend/cann && cd /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator && rm -rf build && dos2unix run.sh 2>/dev/null || sed -i 's/\\r$//' run.sh && bash run.sh Configuring CMake... -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator/build Building... [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main Build completed successfully! Executable location: /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator/build/main Run the sample: ./build/main ./build/main [INFO] CustomAlloc size=256 [INFO] CustomAllocAdvise size=128 [INFO] CustomAlloc size=128 [INFO] CustomFree invoked [INFO] CustomFree invoked [INFO] Allocator desc queried: descOut=0xaaaabd6a3780 allocCount=2 freeCount=2 用例执行报告 0_quickstart (3/3) ✅ ✅ 0_hello_cann ✅ 1_error_handling ✅ 2_system_info 1_basic_features (23/23) ✅ ✅ device/0_device_normal ✅ device/1_device_multi_thread ✅ device/2_device_P2P ✅ event/0_event_status ✅ event/1_event_timestamp ✅ memory/0_h2h_memory_copy ✅ memory/10_ipc_memory_withpid ✅ memory/11_ipc_memory_withoutpid ✅ memory/1_h2d_sync_memory_copy ✅ memory/2_h2d_async_memory_copy ✅ memory/3_d2h_sync_memory_copy ✅ memory/4_d2h_async_memory_copy ✅ memory/5_d2d_sync_memory_copy ✅ memory/6_d2d_async_memory_copy ✅ memory/7_physical_memory_sharing_withpid ✅ memory/8_physical_memory_sharing_withoutpid ✅ memory/9_multistream_sync_memory ✅ stream/0_simple_stream ✅ stream/1_stream_with_failure_mode ✅ stream/2_multi_stream 2_advanced_features (17/17) ✅ ✅ built_in_task/0_reduce_task ✅ built_in_task/1_random_num_task ✅ callback/0_simple_callback ✅ callback/1_callback_hostfunc ✅ callback/2_callback_exception ✅ group/0_compute_group ✅ kernel/0_launch_kernel ✅ kernel/1_launch_kernel_with_reslimit ✅ label/0_simple_label ✅ model_ri/0_simple_model ✅ model_ri/1_model_update ✅ model_ri/2_model_switch ✅ notify/0_ipc_notify_withpid ✅ notify/1_ipc_notify_withoutpid ✅ notify/2_cntnotify ✅ tdt_buffer/0_shared_buffer ✅ tdt_channel/0_simple_channel ✅ tdt_channel/1_channel_capacity ✅ tdt_queue/0_simple_queue ✅ tdt_queue/1_queue_route ✅ tdt_queue/2_queue_grant_attach 3_memory_advanced (1/1) ✅ ✅ allocator/0_custom_allocator 4_reliability (2/2) ✅ ✅ overflow_detection/0_overflow_detection ✅ snapshot/0_snapshot_management 5_performance (6/6) ✅ ✅ adump/0_adump_args ✅ adump/1_adump_callback ✅ adump/2_model_dump_config ✅ profiling/0_create_config ✅ profiling/1_msproftx ✅ profiling/2_subscribe_model ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> docs/02_dev_guide/初始化.md example/*.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/runtime!1163 | 4 个月前 | |
fix: 修复set_sample_env.sh中SOC_VERSION正则匹配不支持含连字符形态 Co-authored-by: good_luck_to_me<qiaoruimin@huawei.com> # message auto-generated for no-merge-commit merge: !4018 merge fix/sample-env-soc-version-regex into master fix: 修复set_sample_env.sh中SOC_VERSION正则匹配不支持含连字符形态 Created-by: good_luck_to_me Commit-by: good_luck_to_me Merged-by: cann-robot Description: ## 描述 修复 example/set_sample_env.sh 中 SOC_VERSION 正则匹配不支持含连字符形态的问题。 aclrtGetSocName() 返回的多 die 形态(如 Ascend910B4-1、Ascend910C4-1)含连字符 -,而脚本中两处正则 ^[A-Za-z0-9_]+$ 字符类不含 -,导致: - awk 提取 SOC_VERSION 失败,变量为空 - _set_soc_is_valid 校验不通过 - 脚本报错退出,所有样例无法获取 SOC_VERSION 环境变量 ## 变更类型 - [x] 🐛 Bug 修复 ## 关联的Issue ## 如何测试 1. 在 Ascend910B4-1 等 NPU 环境上执行 source example/set_sample_env.sh 2. 验证 SOC_VERSION 正确导出为 Ascend910B4-1 3. 模拟 helper 输出各形态字符串,验证正则匹配: - Ascend910B4-1 / Ascend910C4-1(含连字符)✅ 匹配 - Ascend910B3 / Ascend310P3(无连字符)✅ 兼容 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定 ## 其他信息 改动仅涉及 example/set_sample_env.sh 两处正则字符类,在 [A-Za-z0-9_] 基础上加入 -(置于末尾避免被解释为范围符)。 See merge request: cann/runtime!4018 | 12 小时前 | |
优化example目录结构易用性及补充用例 Co-authored-by: qiang_zq<qiang.zhangqiang@huawei.com> # message auto-generated for no-merge-commit merge: !1163 merge sample into master 优化example目录结构易用性及补充用例 Created-by: qiang_zq Commit-by: qiang_zq Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 1、example 目录结构优化,按学习阶段重新组织目录结构(0_quickstart ~ 6_scenarios) 2、补充部分API的example用例 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> https://gitcode.com/cann/runtime/issues/284 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> 部分用例执行过程 source /home/developer/Ascend/cann/set_env.sh && export SOC_VERSION=ascend910b3 && export ASCENDC_CMAKE_DIR=/home/developer/Ascend/cann/aarch64-linux/tikcpp/ascendc_kernel_cmake && export ASCEND_INSTALL_PATH=/home/developer/Ascend/cann && cd /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator && rm -rf build && dos2unix run.sh 2>/dev/null || sed -i 's/\\r$//' run.sh && bash run.sh Configuring CMake... -- The C compiler identification is GNU 13.3.0 -- The CXX compiler identification is GNU 13.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator/build Building... [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main Build completed successfully! Executable location: /mnt/workspace/gitCode/qiang_zq/runtime/example/3_memory_advanced/allocator/0_custom_allocator/build/main Run the sample: ./build/main ./build/main [INFO] CustomAlloc size=256 [INFO] CustomAllocAdvise size=128 [INFO] CustomAlloc size=128 [INFO] CustomFree invoked [INFO] CustomFree invoked [INFO] Allocator desc queried: descOut=0xaaaabd6a3780 allocCount=2 freeCount=2 用例执行报告 0_quickstart (3/3) ✅ ✅ 0_hello_cann ✅ 1_error_handling ✅ 2_system_info 1_basic_features (23/23) ✅ ✅ device/0_device_normal ✅ device/1_device_multi_thread ✅ device/2_device_P2P ✅ event/0_event_status ✅ event/1_event_timestamp ✅ memory/0_h2h_memory_copy ✅ memory/10_ipc_memory_withpid ✅ memory/11_ipc_memory_withoutpid ✅ memory/1_h2d_sync_memory_copy ✅ memory/2_h2d_async_memory_copy ✅ memory/3_d2h_sync_memory_copy ✅ memory/4_d2h_async_memory_copy ✅ memory/5_d2d_sync_memory_copy ✅ memory/6_d2d_async_memory_copy ✅ memory/7_physical_memory_sharing_withpid ✅ memory/8_physical_memory_sharing_withoutpid ✅ memory/9_multistream_sync_memory ✅ stream/0_simple_stream ✅ stream/1_stream_with_failure_mode ✅ stream/2_multi_stream 2_advanced_features (17/17) ✅ ✅ built_in_task/0_reduce_task ✅ built_in_task/1_random_num_task ✅ callback/0_simple_callback ✅ callback/1_callback_hostfunc ✅ callback/2_callback_exception ✅ group/0_compute_group ✅ kernel/0_launch_kernel ✅ kernel/1_launch_kernel_with_reslimit ✅ label/0_simple_label ✅ model_ri/0_simple_model ✅ model_ri/1_model_update ✅ model_ri/2_model_switch ✅ notify/0_ipc_notify_withpid ✅ notify/1_ipc_notify_withoutpid ✅ notify/2_cntnotify ✅ tdt_buffer/0_shared_buffer ✅ tdt_channel/0_simple_channel ✅ tdt_channel/1_channel_capacity ✅ tdt_queue/0_simple_queue ✅ tdt_queue/1_queue_route ✅ tdt_queue/2_queue_grant_attach 3_memory_advanced (1/1) ✅ ✅ allocator/0_custom_allocator 4_reliability (2/2) ✅ ✅ overflow_detection/0_overflow_detection ✅ snapshot/0_snapshot_management 5_performance (6/6) ✅ ✅ adump/0_adump_args ✅ adump/1_adump_callback ✅ adump/2_model_dump_config ✅ profiling/0_create_config ✅ profiling/1_msproftx ✅ profiling/2_subscribe_model ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> docs/02_dev_guide/初始化.md example/*.md ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/runtime!1163 | 4 个月前 |
样例使用指导
example目录下提供了一系列Runtime接口样例,包括Device管理、Stream管理、Event管理、内存管理、Kernel执行等,供开发者参考,帮助开发者快速入门,进而掌握Runtime关键特性。
目录总览
- 0_quickstart:快速入门样例,以
aclnnAdd向量加法为入口,展示 初始化配置、Device/Stream 创建、Tensor 与 DataBuffer 管理、workspace 分配、算子执行、同步等待和资源释放流程。 - 1_basic_features:基础特性样例,包含设备管理(包括单线程、多线程)、 内存管理(包括内存复制、进程间内存共享、虚拟内存管理等)、Stream管理(包括单流任务下发、多流任务下发等)等样例。
- 2_advanced_features:高级特性样例,包括算子Kernel加载与执行、ACL Graph、Reduce和随机数生成的内置系统任务执行、Host侧回调函数下发等样例。
- 3_memory_advanced:高级内存管理样例,包括自定义内存分配器、Host内存注册、统一寻址、Stream内存操作、Stream有序内存分配等样例。
- 4_reliability:可靠性样例,包括溢出检测、错误恢复等样例。
- 5_performance:性能分析与精度调试样例。
- 6_scenarios:场景化样例,面向训练流水线、多设备推理和容错执行等典型场景。
产品支持表说明
各样例 README 中的产品支持表仅列出当前样例已完成验证或已明确声明支持情况的产品。Ascend 950PR/Ascend 950DT 为新增产品,部分历史样例尚未完成该产品验证;未在表格中列出的产品不代表不支持。若某产品明确不支持,样例 README 会在表格中以 × 标识,并根据需要补充说明。
环境准备
编译运行样例前,需获取固件、驱动及CANN软件包并安装,详细步骤请参见《CANN软件安装指南》。
若对本仓src目录下的源码有定制,那么在安装CANN软件之后,还需编译源码并部署到环境上,具体操作请参见README。
运行样例
1.下载样例代码并上传至安装CANN软件的环境,切换到样例目录。
# 此处以基础内存样例为例
cd ${git_clone_path}/example/1_basic_features/memory/0_h2h_memory_copy
2.设置环境变量。
# ${install_root} 替换为 CANN 安装根目录,默认安装在`/usr/local/Ascend`目录
source ${install_root}/cann/set_env.sh
export ASCEND_INSTALL_PATH=${install_root}/cann
3.执行以下命令运行样例。
# 请注意部分用例的运行命令不同,具体以各用例目录下的README.md中的编译运行命令为准
bash run.sh
样例代码说明
所有样例演示了CANN Runtime API 的典型使用方式。
- 样例代码用于学习和接口理解。
- 为了突出核心流程,部分示例会简化工程化处理。
- 用于生产环境前,请补充完整的错误处理、资源管理和边界检查。
Device 复位接口使用约定
单机单进程样例通常使用 aclrtResetDeviceForce 清理当前样例占用的 Device 资源;单机多进程 IPC 样例使用 aclrtResetDevice 释放当前进程的 Device 资源,避免强制复位影响同机其他进程。