已合并
【PR】: 更新资料 #4695
Sophia1213创建于 5 天前
【PR】: 更新资料 #4695
已合并
Sophia1213创建于 5 天前
47 个文件变更+90-89
@@ -13,14 +13,13 @@ GE 提供对 PyTorch、TensorFlow 前端的友好接入能力,并同时支持
13 13 
14![](docs/zh/figures/architecture.png)14![](docs/zh/figures/architecture.png)
15 15 
16- 
17## ⚡️ 快速入门16## ⚡️ 快速入门
18 17 
19若希望快速体验 GE 的工作方式及基本开发流程,可参考以下文档:18若希望快速体验 GE 的工作方式及基本开发流程,可参考以下文档:
20 19 
21-- [构建验证](docs/zh/build.md):介绍组件的完整构建、测试样例运行流程。20+- [构建验证](docs/zh/build.md):介绍组件的完整构建、测试样例运行流程。
22-- [快速开始](examples/acl/1_sample_resnet50_imagenet_classification/README.md):以 ResNet50 模型为例,介绍如何使用 ATC 工具进行模型转换,并在昇腾 AI 处理器上执行推理。21+- [快速开始](examples/acl/1_sample_resnet50_imagenet_classification/README.md):以 ResNet50 模型为例,介绍如何使用 ATC 工具进行模型转换,并在昇腾 AI 处理器上执行推理。
23-- [快速开始-LLM](examples/acl/3_sample_qwen_llm/README.md):以 Qwen 模型为例,介绍如何使用 ATC 工具进行LLM模型转换,并实现LLM模型的加载、执行和获取执行结果等。22+- [快速开始-LLM](examples/acl/3_sample_qwen_llm/README.md):以 Qwen 模型为例,介绍如何使用 ATC 工具进行LLM模型转换,并实现LLM模型的加载、执行和获取执行结果等。
24 23 
25## 📚 文档24## 📚 文档
26 25 
@@ -28,9 +27,9 @@ GE 提供对 PyTorch、TensorFlow 前端的友好接入能力,并同时支持
28 27 
29如果希望深入了解 GE 的内部设计、架构机制与开发流程,可参考以下文档:28如果希望深入了解 GE 的内部设计、架构机制与开发流程,可参考以下文档:
30 29 
31-* [GE 架构说明文档](docs/zh/design/architecture.md):介绍核心组件、执行流程、优化机制等内部原理。30+- [GE 架构说明文档](docs/zh/design/architecture.md):介绍核心组件、执行流程、优化机制等内部原理。
32-* [贡献指南](CONTRIBUTING.md):说明如何提交 Issue、Pull Request 以及代码规范。31+- [贡献指南](CONTRIBUTING.md):说明如何提交 Issue、Pull Request 以及代码规范。
33-* [AI Agent支持](.opencode/README.md):介绍仓内默认使用的一些skills及使用agent辅助开发流程32+- [AI Agent支持](.opencode/README.md):介绍仓内默认使用的一些skills及使用agent辅助开发流程
34 33 
35## 🌐 生态集成34## 🌐 生态集成
36 35 
@@ -46,8 +45,8 @@ GE 提供对 PyTorch、TensorFlow 前端的友好接入能力,并同时支持
46 45 
47## 📝 其他信息46## 📝 其他信息
48 47 
49-- [安全声明](SECURITY.md)48+- [安全声明](SECURITY.md)
50-- [许可证](LICENSE)49+- [许可证](LICENSE)
51 50 
52## 📝 联系我们51## 📝 联系我们
53 52 
@@ -18,7 +18,7 @@ GE provides friendly integration capabilities for PyTorch and TensorFlow fronten
18 18 
19To quickly experience GE's working methods and basic development process, refer to the following documentation:19To quickly experience GE's working methods and basic development process, refer to the following documentation:
20 20 
21-- [Build Verification](docs/zh/build.md): Introduces the complete build process of components and test case execution flow.21+- [Build Verification](docs/en/build.md): Introduces the complete build process of components and test case execution flow.
22- [Quick Start](examples/acl/1_sample_resnet50_imagenet_classification/README.md): Using ResNet50 model as an example, introduces how to use the ATC tool for model conversion and execute inference on Ascend AI processors.22- [Quick Start](examples/acl/1_sample_resnet50_imagenet_classification/README.md): Using ResNet50 model as an example, introduces how to use the ATC tool for model conversion and execute inference on Ascend AI processors.
23- [Quick Start-LLM](examples/acl/3_sample_qwen_llm/README.md): Using Qwen model as an example, introduces how to use the ATC tool for LLM model conversion and implement LLM model loading, execution, and result retrieval.23- [Quick Start-LLM](examples/acl/3_sample_qwen_llm/README.md): Using Qwen model as an example, introduces how to use the ATC tool for LLM model conversion and implement LLM model loading, execution, and result retrieval.
24 24 
@@ -28,7 +28,7 @@ To learn how to use GE for model compilation and execution, refer to the Graph M
28 28 
29To gain a deep understanding of GE's internal design, architecture mechanisms, and development processes, refer to the following documentation:29To gain a deep understanding of GE's internal design, architecture mechanisms, and development processes, refer to the following documentation:
30 30 
31-* [GE Architecture Documentation](docs/zh/design/architecture.md): Introduces core components, execution flows, optimization mechanisms, and other internal principles.31+* [GE Architecture Documentation](docs/en/design/architecture.md): Introduces core components, execution flows, optimization mechanisms, and other internal principles.
32* [Contributing Guide](CONTRIBUTING.md): Explains how to submit Issues, Pull Requests, and code standards.32* [Contributing Guide](CONTRIBUTING.md): Explains how to submit Issues, Pull Requests, and code standards.
33* [AI Agent Support](.opencode/README.md): Introduces some default skills used in the repository and using agents to assist the development process.33* [AI Agent Support](.opencode/README.md): Introduces some default skills used in the repository and using agents to assist the development process.
34 34 
@@ -95,7 +95,7 @@ Check result explanation is as follows:
95| **[ERROR]** | Critical dependency missing or version incompatible | Must fix, otherwise cannot compile |95| **[ERROR]** | Critical dependency missing or version incompatible | Must fix, otherwise cannot compile |
96 96 
97> [!NOTE] Note97> [!NOTE] Note
98-> All check items and version constraints in the environment check script strictly come from docs/build.md and requirements.txt. If documents and dependencies are updated, please synchronize modification to [script](../../scripts/check_env.sh).98+> All check items and version constraints in the environment check script strictly come from docs/en/build.md and requirements.txt. If documents and dependencies are updated, please synchronize modification to [script](../../scripts/check_env.sh).
99 99 
100### 4.3 Compilation100### 4.3 Compilation
101 101 
@@ -202,7 +202,7 @@ After compilation is complete, users can perform developer testing.
202 202 
203 > [!CAUTION] Note203 > [!CAUTION] Note
204 > * The installation path here (whether default or specified) needs to be consistent with the path where Toolkit package was installed earlier. After installation is complete, the `GE` software package compiled by the user will replace the `GE` related software in the already installed CANN development suite package.204 > * The installation path here (whether default or specified) needs to be consistent with the path where Toolkit package was installed earlier. After installation is complete, the `GE` software package compiled by the user will replace the `GE` related software in the already installed CANN development suite package.
205- > * `cann-dflow-executor_<version>_<arch>.run` software package is only needed when using [dflow feature](https://hiascend.com/document/redirect/CannCommunityDataflow). If only using GE graph compilation and execution functions, you can choose not to install. This package contains `cann-udf-compat.tar.gz` (UDF compatibility upgrade package), which will be loaded to Device side during service startup. During loading process, the driver defaults to performing security signature verification to ensure package trustworthiness. The `cann-udf-compat.tar.gz` generated by compiling from source code in this repository does not contain signature header, so you must disable the driver's security signature verification mechanism to use it.205+ > * `cann-dflow-executor_<version>_<arch>.run` software package is only needed when using [dflow feature](https://hiascend.com/en/document/redirect/CannCommunityDataflow). If only using GE graph compilation and execution functions, you can choose not to install. This package contains `cann-udf-compat.tar.gz` (UDF compatibility upgrade package), which will be loaded to Device side during service startup. During loading process, the driver defaults to performing security signature verification to ensure package trustworthiness. The `cann-udf-compat.tar.gz` generated by compiling from source code in this repository does not contain signature header, so you must disable the driver's security signature verification mechanism to use it.
206 How to disable signature verification:206 How to disable signature verification:
207 Disabling signature verification functionality depends on Ascend NPU driver software package (Ascend HDK 25.5.T2.B001 and above versions). You can query version and disable signature verification through the npu-smi tool bundled with this Ascend HDK. For details, see [Query Basic Information](https://support.huawei.com/enterprise/zh/doc/EDOC1100540362/4a8adb57?idPath=23710424|251366513|254884019|261408772|252764743), [Set Custom Signature Verification Capability Enable Status](https://support.huawei.com/enterprise/zh/doc/EDOC1100540362/3152813c?idPath=23710424|251366513|254884019|261408772|252764743), [Set Signature Verification Mode](https://support.huawei.com/enterprise/zh/doc/EDOC1100540362/a484ba7b?idPath=23710424|251366513|254884019|261408772|252764743) command documentation, need to execute as root user on physical machine (due to permission issues, WebIDE does not support this yet).207 Disabling signature verification functionality depends on Ascend NPU driver software package (Ascend HDK 25.5.T2.B001 and above versions). You can query version and disable signature verification through the npu-smi tool bundled with this Ascend HDK. For details, see [Query Basic Information](https://support.huawei.com/enterprise/zh/doc/EDOC1100540362/4a8adb57?idPath=23710424|251366513|254884019|261408772|252764743), [Set Custom Signature Verification Capability Enable Status](https://support.huawei.com/enterprise/zh/doc/EDOC1100540362/3152813c?idPath=23710424|251366513|254884019|261408772|252764743), [Set Signature Verification Mode](https://support.huawei.com/enterprise/zh/doc/EDOC1100540362/a484ba7b?idPath=23710424|251366513|254884019|261408772|252764743) command documentation, need to execute as root user on physical machine (due to permission issues, WebIDE does not support this yet).
208 Taking device 0 as example (where the parameter after -i is device id):208 Taking device 0 as example (where the parameter after -i is device id):
@@ -38,7 +38,7 @@ For developers who do not depend on Ascend devices, if you want to quickly set u
38 38 
391. **Install Drivers and Firmware (Runtime Dependencies)**391. **Install Drivers and Firmware (Runtime Dependencies)**
40 40 
41- For downloading and installing Ascend drivers and firmware on the host machine, please refer to the "Prepare Software Packages" and "Install NPU Driver and Firmware" chapters in the [Software Installation](https://www.hiascend.com/document/redirect/CannCommunityInstWizard). Drivers and firmware are runtime dependencies. If only compiling operators, you don't need to install them.41+ For downloading and installing Ascend drivers and firmware on the host machine, please refer to the "Prepare Software Packages" and "Install NPU Driver and Firmware" chapters in the [CANN Software Installation](https://www.hiascend.com/en/document/redirect/CannCommunityInstWizard). Drivers and firmware are runtime dependencies. If only compiling operators, you don't need to install them.
42 42 
432. **Download Image**432. **Download Image**
44 44 
@@ -130,11 +130,11 @@ For developers who do not depend on Ascend devices, if you want to quickly set u
130 130 
131 1. **Install Drivers and Firmware (Optional, only required for running [samples](../../examples/README.md))**131 1. **Install Drivers and Firmware (Optional, only required for running [samples](../../examples/README.md))**
132 132 
133- Drivers and firmware are runtime dependencies. If only compiling source code, you don't need to install them. Use `npu-smi info` to check if there is NPU-related information. If not, please refer to [Quick Installation](https://www.hiascend.com/cann/download) to complete driver and firmware installation.133+ Drivers and firmware are runtime dependencies. If only compiling source code, you don't need to install them. Use `npu-smi info` to check if there is NPU-related information. If not, please refer to [CANN Quick Installation](https://www.hiascend.com/cann/download) to complete driver and firmware installation.
134 134 
135 2. **Install CANN Package**135 2. **Install CANN Package**
136 136 
137- Please click [download link](https://ascend.devcloud.huaweicloud.com/artifactory/cann-run-mirror/software/master) to get the latest timestamp version, and download the corresponding package according to product model and environment architecture. Installation commands are as follows, for more guidance please refer to [Software Installation](https://www.hiascend.com/document/redirect/CannCommunityInstWizard).137+ Please click [download link](https://ascend.devcloud.huaweicloud.com/artifactory/cann-run-mirror/software/master) to get the latest timestamp version, and download the corresponding package according to product model and environment architecture. Installation commands are as follows, for more guidance please refer to [CANN Software Installation](https://www.hiascend.com/en/document/redirect/CannCommunityInstWizard).
138 138 
139 - Install CANN Toolkit development suite package.139 - Install CANN Toolkit development suite package.
140 140 
@@ -1,4 +1,4 @@
1-# GE图引擎 API1+# GE图引擎API
2 2 
3- [头文件和库文件说明](header_and_library_files_description.md)3- [头文件和库文件说明](header_and_library_files_description.md)
4- [C++语言接口](cpp/cpp_language_interface.md)4- [C++语言接口](cpp/cpp_language_interface.md)
@@ -45,7 +45,7 @@
45 - [InstanceOutputStorageFormat](cpp/ge/es/CompliantNodeBuilder/InstanceOutputStorageFormat.md)45 - [InstanceOutputStorageFormat](cpp/ge/es/CompliantNodeBuilder/InstanceOutputStorageFormat.md)
46 - [IrAttrDef](cpp/ge/es/CompliantNodeBuilder/IrAttrDef.md)46 - [IrAttrDef](cpp/ge/es/CompliantNodeBuilder/IrAttrDef.md)
47 - [IrAttrDefV2](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/IrAttrDefV2.md)47 - [IrAttrDefV2](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/IrAttrDefV2.md)
48- - [简介](cpp/ge/es/CompliantNodeBuilder/overview.md)48+ - [简介](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/overview.md)
49 - [IrAttrDefV2构造函数](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/IrAttrDefV2_constructor.md)49 - [IrAttrDefV2构造函数](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/IrAttrDefV2_constructor.md)
50 - [AttrDataType](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/AttrDataType.md)50 - [AttrDataType](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/AttrDataType.md)
51 - [AttrName](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/AttrName.md)51 - [AttrName](cpp/ge/es/CompliantNodeBuilder/IrAttrDefV2/AttrName.md)
@@ -64,7 +64,7 @@
64 - [IrDefOutputsV2](cpp/ge/es/CompliantNodeBuilder/IrDefOutputsV2.md)64 - [IrDefOutputsV2](cpp/ge/es/CompliantNodeBuilder/IrDefOutputsV2.md)
65 - [IrInputDef](cpp/ge/es/CompliantNodeBuilder/IrInputDef.md)65 - [IrInputDef](cpp/ge/es/CompliantNodeBuilder/IrInputDef.md)
66 - [IrInputDefV2](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/IrInputDefV2.md)66 - [IrInputDefV2](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/IrInputDefV2.md)
67- - [简介](cpp/ge/es/CompliantNodeBuilder/overview.md)67+ - [简介](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/overview.md)
68 - [IrInputDefV2构造函数](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/IrInputDefV2_constructor.md)68 - [IrInputDefV2构造函数](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/IrInputDefV2_constructor.md)
69 - [GetInputType](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/GetInputType.md)69 - [GetInputType](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/GetInputType.md)
70 - [GetName](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/GetName.md)70 - [GetName](cpp/ge/es/CompliantNodeBuilder/IrInputDefV2/GetName.md)
@@ -452,7 +452,7 @@
452 - [CheckNodeSupportOnAicore](cpp/ge/GeUtils/CheckNodeSupportOnAicore.md)452 - [CheckNodeSupportOnAicore](cpp/ge/GeUtils/CheckNodeSupportOnAicore.md)
453 453 
454 - [Graph](cpp/ge/Graph/Graph.md)454 - [Graph](cpp/ge/Graph/Graph.md)
455- - [简介](python/ge/graph/Graph/overview.md)455+ - [简介](cpp/ge/Graph/overview.md)
456 - [Graph构造函数和析构函数](cpp/ge/Graph/Graph_constructor_and_destructor.md)456 - [Graph构造函数和析构函数](cpp/ge/Graph/Graph_constructor_and_destructor.md)
457 - [AddControlEdge](cpp/ge/Graph/AddControlEdge.md)457 - [AddControlEdge](cpp/ge/Graph/AddControlEdge.md)
458 - [AddDataEdge](cpp/ge/Graph/AddDataEdge.md)458 - [AddDataEdge](cpp/ge/Graph/AddDataEdge.md)
@@ -920,7 +920,7 @@
920 - [div](python/ge/es/TensorHolder/div.md)920 - [div](python/ge/es/TensorHolder/div.md)
921 - [get\_owner\_builder](python/ge/es/TensorHolder/get_owner_builder.md)921 - [get\_owner\_builder](python/ge/es/TensorHolder/get_owner_builder.md)
922 - [mul](python/ge/es/TensorHolder/mul.md)922 - [mul](python/ge/es/TensorHolder/mul.md)
923- - [name](python/ge/es/GraphBuilder/name.md)923+ - [name](python/ge/es/TensorHolder/name.md)
924 - [set\_data\_type](python/ge/es/TensorHolder/set_data_type.md)924 - [set\_data\_type](python/ge/es/TensorHolder/set_data_type.md)
925 - [set\_format](python/ge/es/TensorHolder/set_format.md)925 - [set\_format](python/ge/es/TensorHolder/set_format.md)
926 - [set\_shape](python/ge/es/TensorHolder/set_shape.md)926 - [set\_shape](python/ge/es/TensorHolder/set_shape.md)
@@ -257,7 +257,7 @@ typedef enum {
257 257 
258如果设置了ACL\_OP\_DEBUG\_LEVEL编译选项,则只有编译选项值为0才会启用编译缓存功能,其它取值禁用编译缓存功能。258如果设置了ACL\_OP\_DEBUG\_LEVEL编译选项,则只有编译选项值为0才会启用编译缓存功能,其它取值禁用编译缓存功能。
259 259 
260-关于配置算子编译文件的缓存目录,除此处设置枚举值的方式,还可以配置环境变量ASCEND\_CACHE\_PATH,几种方式的优先级为:本节设置枚举值的方式 \> 设置环境变量 \> 默认路径。环境变量的详细配置说明请参见《[环境变量参考](https://hiascend.com/document/redirect/CannCommunityEnvRef)》。260+关于配置算子编译文件的缓存目录,除此处设置枚举值的方式,还可以配置环境变量ASCEND\_CACHE\_PATH,几种方式的优先级为:本节设置枚举值的方式 \> 设置环境变量 \> 默认路径。环境变量的详细配置说明请参见《[环境变量参考](https://gitcode.com/cann/docs/blob/master/docs/zh/env-vars/README.md)》。
261 261 
262## ACL\_OP\_PERFORMANCE\_MODE取值说明262## ACL\_OP\_PERFORMANCE\_MODE取值说明
263 263 
@@ -304,7 +304,7 @@ Atlas 推理系列产品,该选项默认值为enable。
304<!-- end id13 -->304<!-- end id13 -->
305 305 
306<!-- npu="950,A3,910b,910,310p,310b" id17 -->306<!-- npu="950,A3,910b,910,310p,310b" id17 -->
307-若本参数的取值为disable,则需要安装算子二进制文件包,请参见《[软件安装](https://hiascend.com/document/redirect/CannCommunityInstSoftware)》。307+若本参数的取值为disable,则需要安装算子二进制文件包,请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。
308<!-- end id17 -->308<!-- end id17 -->
309 309 
310<!-- @ref: ge/res/docs/zh/api/graph_engine_api/c/acl/aclCompileOpt_res.md#id2 -->310<!-- @ref: ge/res/docs/zh/api/graph_engine_api/c/acl/aclCompileOpt_res.md#id2 -->
@@ -60,3 +60,5 @@ Ascend RC形态下,model参数处需申请Device上的内存。
60<!-- npu="310p" id3 -->60<!-- npu="310p" id3 -->
61Control CPU开放形态下,model参数处需申请Device上的内存。61Control CPU开放形态下,model参数处需申请Device上的内存。
62<!-- end id3 -->62<!-- end id3 -->
63+ 
64+<!-- @ref: ge/res/docs/zh/api/graph_engine_api/c/acl/aclmdlBundleQueryInfoFromMem_res.md#id2 -->
@@ -61,7 +61,7 @@ const char *aclmdlGetOutputNameByIndex(const aclmdlDesc *modelDesc, size_t index
61 61 
62 output_网络输出下标_输出算子名称_算子输出边下标62 output_网络输出下标_输出算子名称_算子输出边下标
63 63 
64- 构图接口的详细说明请参见《[图开发](https://hiascend.com/document/redirect/CannCommunityGraphguide)》。64+ 构图接口的详细说明请参见《[图开发](../../../../user_guides/graph_dev/compile_and_run_graph/compile_graph_to_offline_model.md)》。
65 65 
66- ONNX网络66- ONNX网络
67 - 在构建模型时,不指定输出节点名称(node\_name)或输出名称(output的name),或者仅指定输出名称,返回值格式如下,各项之间以冒号分割:67 - 在构建模型时,不指定输出节点名称(node\_name)或输出名称(output的name),或者仅指定输出名称,返回值格式如下,各项之间以冒号分割:
@@ -80,6 +80,6 @@ const char *aclmdlGetOutputNameByIndex(const aclmdlDesc *modelDesc, size_t index
80 80 
81 output_网络输出下标_输出算子名称_算子输出边下标81 output_网络输出下标_输出算子名称_算子输出边下标
82 82 
83- 构图接口的详细说明请参见《[图开发](https://hiascend.com/document/redirect/CannCommunityGraphguide)》。83+ 构图接口的详细说明请参见《[图开发](../../../../user_guides/graph_dev/compile_and_run_graph/compile_graph_to_offline_model.md)》。
84 84 
85 - 同时指定输出节点名称(node\_name)和输出名称(output的name),接口返回报错。85 - 同时指定输出节点名称(node\_name)和输出名称(output的name),接口返回报错。
@@ -4,7 +4,7 @@
4 4 
5- **[执行固定Shape算子示例代码](static_shape_op_exec_sample_code.md)**5- **[执行固定Shape算子示例代码](static_shape_op_exec_sample_code.md)**
6本节介绍基于单算子模型执行的方式调用固定Shape算子的关键接口、示例代码。6本节介绍基于单算子模型执行的方式调用固定Shape算子的关键接口、示例代码。
7-- **[执行动态Shape算子示例代码](dynamic _shape_op_exec_sample_code.md)**7+- **[执行动态Shape算子示例代码](dynamic_shape_op_exec_sample_code.md)**
8本节介绍基于单算子模型执行的方式调用动态Shape算子的关键接口、示例代码。8本节介绍基于单算子模型执行的方式调用动态Shape算子的关键接口、示例代码。
9- **[aclopSetModelDir](aclopSetModelDir.md)**9- **[aclopSetModelDir](aclopSetModelDir.md)**
10 10 
@@ -47,4 +47,4 @@ ge::Status GeSessionExecuteGraphWithStreamAsync(ge::Session &session, uint32_t g
47- 调用该接口前,需要通过acl提供的**aclrtCreateStream**接口创建Stream。47- 调用该接口前,需要通过acl提供的**aclrtCreateStream**接口创建Stream。
48- 得到输出运行结果前,需要通过**aclrtSynchronizeStream**接口保证Stream上的任务已经执行完。48- 得到输出运行结果前,需要通过**aclrtSynchronizeStream**接口保证Stream上的任务已经执行完。
49 49 
50-接口详细说明请参见《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“Stream管理”。50+接口详细说明请参见《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“Stream管理”。
@@ -23,7 +23,7 @@ Status LoadGraph(const uint32_t graph_id, const std::map<AscendString, AscendStr
23| --- | --- | --- |23| --- | --- | --- |
24| graph_id | 输入 | 要执行Graph对应的ID。 |24| graph_id | 输入 | 要执行Graph对应的ID。 |
25| options | 输入 | 执行阶段可能用到的options。map表,key为参数类型,value为参数值,描述Graph配置信息。<br>一般情况下可不填,与[GEInitializeV2](GEInitializeV2.md)传入的全局options保持一致。<br>key和value类型为AscendString,如需单独配置当前Graph的配置信息时,可以通过此参数配置,支持的配置项请参见[options参数说明](../options_params/basic_functions.md)>基础功能>ge.exec.frozenInputIndexes和ge.exec.hostInputIndexes,当前只支持配置上述两个参数。 |25| options | 输入 | 执行阶段可能用到的options。map表,key为参数类型,value为参数值,描述Graph配置信息。<br>一般情况下可不填,与[GEInitializeV2](GEInitializeV2.md)传入的全局options保持一致。<br>key和value类型为AscendString,如需单独配置当前Graph的配置信息时,可以通过此参数配置,支持的配置项请参见[options参数说明](../options_params/basic_functions.md)>基础功能>ge.exec.frozenInputIndexes和ge.exec.hostInputIndexes,当前只支持配置上述两个参数。 |
26-| stream | 输入 | 接口“aclrtCreateStream”创建的流,也可以设置为nullptr。当传入有效值时,若在加载过程中需要向流中下发任务,会下发到指定流上。<br><br> - 若与[RunGraphWithStreamAsync](./RunGraphWithStreamAsync.md)接口配合使用,建议传入有效值。此时,通过LoadGraph加载的Stream与RunGraphWithStreamAsync运行时使用的Stream推荐为同一条流。若非同一条流,则需在LoadGraph后,对加载使用的Stream调用流同步接口“aclrtSynchronizeStream”完成同步。<br> - 若与[RunGraph](./RunGraph.md)或[RunGraphAsync](./RunGraphAsync.md)接口配合使用,建议传入nullptr以简化流程。若传入有效值,则需在LoadGraph后、RunGraph/RunGraphAsync前调用“aclrtSynchronizeStream”完成流同步,以确保加载任务完成。<br><br>接口详细说明请参见《Runtime运行时 API》中的“Stream管理”。 |26+| stream | 输入 | 接口“aclrtCreateStream”创建的流,也可以设置为nullptr。当传入有效值时,若在加载过程中需要向流中下发任务,会下发到指定流上。<br><br> - 若与[RunGraphWithStreamAsync](./RunGraphWithStreamAsync.md)接口配合使用,建议传入有效值。此时,通过LoadGraph加载的Stream与RunGraphWithStreamAsync运行时使用的Stream推荐为同一条流。若非同一条流,则需在LoadGraph后,对加载使用的Stream调用流同步接口“aclrtSynchronizeStream”完成同步。<br> - 若与[RunGraph](./RunGraph.md)或[RunGraphAsync](./RunGraphAsync.md)接口配合使用,建议传入nullptr以简化流程。若传入有效值,则需在LoadGraph后、RunGraph/RunGraphAsync前调用“aclrtSynchronizeStream”完成流同步,以确保加载任务完成。<br><br>接口详细说明请参见《Runtime运行时API》中的“Stream管理”。 |
27 27 
28## 返回值说明28## 返回值说明
29 29 
@@ -36,4 +36,4 @@ Status RegisterExternalAllocator(const void *const stream, AllocatorPtr allocato
36- 对于不同流,如果用户使用同一个Allocator,不可以多条流并发执行,在执行下一条Stream前,需要对上一Stream做流同步。36- 对于不同流,如果用户使用同一个Allocator,不可以多条流并发执行,在执行下一条Stream前,需要对上一Stream做流同步。
37- 将Allocator中的内存释放给操作系统前,需要先调用接口“aclrtSynchronizeStream”执行流同步,确保Stream中的任务已执行完成。37- 将Allocator中的内存释放给操作系统前,需要先调用接口“aclrtSynchronizeStream”执行流同步,确保Stream中的任务已执行完成。
38 38 
39- 接口详细介绍请参见《Runtime运行时 API》中的“Stream管理”。39+ 接口详细介绍请参见《Runtime运行时API》中的“Stream管理”。
@@ -43,7 +43,7 @@ Status RunGraphWithStreamAsync(uint32_t graph_id, void *stream,const std::vector
43- Tensor在Device侧的存储地址,必须32字节对齐,否则可能会出现未定义错误。43- Tensor在Device侧的存储地址,必须32字节对齐,否则可能会出现未定义错误。
44- 调用该接口前,需要通过“aclrtCreateStream”接口创建Stream;得到输出运行结果前,需要通过“aclrtSynchronizeStream”接口保证Stream上的任务已经执行完。44- 调用该接口前,需要通过“aclrtCreateStream”接口创建Stream;得到输出运行结果前,需要通过“aclrtSynchronizeStream”接口保证Stream上的任务已经执行完。
45 45 
46- 接口详细说明请参见《Runtime运行时 API》中的“Stream管理”。46+ 接口详细说明请参见《Runtime运行时API》中的“Stream管理”。
47 47 
48## 调用示例48## 调用示例
49 49 
@@ -22,4 +22,4 @@ enum class MemoryType : std::int64_t {
22- MEMORY\_TYPE\_DEFAULT:默认Device内存类型,可以通过调用“aclrtMalloc”接口申请得到,申请内存时传入“aclrtMemMallocPolicy”中的3种枚举值之一,ACL\_MEM\_MALLOC\_HUGE\_FIRST、ACL\_MEM\_MALLOC\_HUGE\_ONLY、 ACL\_MEM\_MALLOC\_NORMAL\_ONLY22- MEMORY\_TYPE\_DEFAULT:默认Device内存类型,可以通过调用“aclrtMalloc”接口申请得到,申请内存时传入“aclrtMemMallocPolicy”中的3种枚举值之一,ACL\_MEM\_MALLOC\_HUGE\_FIRST、ACL\_MEM\_MALLOC\_HUGE\_ONLY、 ACL\_MEM\_MALLOC\_NORMAL\_ONLY
23- MEMORY\_TYPE\_P2P:仅Device之间内存复制场景下的内存类型,可以通过调用aclrtMalloc接口申请得到,申请内存时传入aclrtMemMallocPolicy中的3种枚举值之一,ACL\_MEM\_MALLOC\_HUGE\_FIRST\_P2P、ACL\_MEM\_MALLOC\_HUGE\_ONLY\_P2P、ACL\_MEM\_MALLOC\_NORMAL\_ONLY\_P2P23- MEMORY\_TYPE\_P2P:仅Device之间内存复制场景下的内存类型,可以通过调用aclrtMalloc接口申请得到,申请内存时传入aclrtMemMallocPolicy中的3种枚举值之一,ACL\_MEM\_MALLOC\_HUGE\_FIRST\_P2P、ACL\_MEM\_MALLOC\_HUGE\_ONLY\_P2P、ACL\_MEM\_MALLOC\_NORMAL\_ONLY\_P2P
24 24 
25-aclrtMalloc、aclrtMemMallocPolicy接口说明请参见《Runtime运行时 API》。25+aclrtMalloc、aclrtMemMallocPolicy接口说明请参见《Runtime运行时API》。
@@ -47,7 +47,7 @@ Status ExecuteGraphWithStreamAsync(uint32_t graph_id, void *stream,const std::ve
47- 调用该接口前,需要通过acl提供的**aclrtCreateStream**接口创建Stream。47- 调用该接口前,需要通过acl提供的**aclrtCreateStream**接口创建Stream。
48- 得到输出运行结果前,需要通过acl提供的**aclrtSynchronizeStream**接口保证Stream上的任务已经执行完。48- 得到输出运行结果前,需要通过acl提供的**aclrtSynchronizeStream**接口保证Stream上的任务已经执行完。
49 49 
50- 接口详细说明请参见《Runtime运行时 API》中的“Stream管理”。50+ 接口详细说明请参见《Runtime运行时API》中的“Stream管理”。
51 51 
52## 调用示例52## 调用示例
53 53 
@@ -35,4 +35,4 @@ Status LoadGraph(const uint32_t graph_id, const std::map<AscendString, AscendStr
35 35 
36通过LoadGraph加载的Stream,和通过[ExecuteGraphWithStreamAsync](ExecuteGraphWithStreamAsync.md)接口运行时使用的Stream,推荐是同一条Stream,如果不是同一条Stream,需要在LoadGraph后,对加载使用的Stream调用流同步接口“aclrtSynchronizeStream”完成同步。36通过LoadGraph加载的Stream,和通过[ExecuteGraphWithStreamAsync](ExecuteGraphWithStreamAsync.md)接口运行时使用的Stream,推荐是同一条Stream,如果不是同一条Stream,需要在LoadGraph后,对加载使用的Stream调用流同步接口“aclrtSynchronizeStream”完成同步。
37 37 
38-接口详细说明请参见《Runtime运行时 API》中的“Stream管理” 。38+接口详细说明请参见《Runtime运行时API》中的“Stream管理” 。
@@ -36,4 +36,4 @@ Status RegisterExternalAllocator(const void *const stream, AllocatorPtr allocato
36- 对于不同流,如果用户使用同一个Allocator,不可以多条流并发执行,在执行下一条Stream前,需要对上一Stream做流同步。36- 对于不同流,如果用户使用同一个Allocator,不可以多条流并发执行,在执行下一条Stream前,需要对上一Stream做流同步。
37- 将Allocator中的内存释放给操作系统前,需要先调用“aclrtSynchronizeStream”接口执行流同步,确保Stream中的任务已执行完成。37- 将Allocator中的内存释放给操作系统前,需要先调用“aclrtSynchronizeStream”接口执行流同步,确保Stream中的任务已执行完成。
38 38 
39- 接口详细介绍请参见《Runtime运行时 API》中的“Stream管理”。39+ 接口详细介绍请参见《Runtime运行时API》中的“Stream管理”。
@@ -44,7 +44,7 @@ Status RunGraphWithStreamAsync(uint32_t graph_id, void *stream, const std::vecto
44- 调用该接口前,需要通过acl提供的**aclrtCreateStream**接口创建Stream,且只支持Stream为默认Context的场景。44- 调用该接口前,需要通过acl提供的**aclrtCreateStream**接口创建Stream,且只支持Stream为默认Context的场景。
45- 得到输出运行结果前,需要通过**aclrtSynchronizeStream**接口保证Stream上的任务已经执行完。45- 得到输出运行结果前,需要通过**aclrtSynchronizeStream**接口保证Stream上的任务已经执行完。
46 46 
47- 接口详细说明请参见《Runtime运行时 API》中的“Stream管理”。47+ 接口详细说明请参见《Runtime运行时API》中的“Stream管理”。
48 48 
49## 调用示例49## 调用示例
50 50 
@@ -86,7 +86,7 @@ vector_core_cnt=48
86- true:算子执行不受超时时间限制,永不超时。86- true:算子执行不受超时时间限制,永不超时。
87- false:算子执行受超时时间限制。87- false:算子执行受超时时间限制。
88 88 
89-用户可以通过《Runtime运行时 API》中的“执行控制 \> aclrtSetOpExecuteTimeOutV2”接口设置算子执行的超时时间。89+用户可以通过《Runtime运行时API》中的“执行控制 \> aclrtSetOpExecuteTimeOutV2”接口设置算子执行的超时时间。
90 90 
91**使用约束:**91**使用约束:**
92 92 
@@ -95,7 +95,7 @@ bash scripts/check_env.sh
95| **[ERROR]** | 关键依赖缺失或版本不兼容 | 必须修复,否则无法编译 |95| **[ERROR]** | 关键依赖缺失或版本不兼容 | 必须修复,否则无法编译 |
96 96 
97> [!NOTE] 注意97> [!NOTE] 注意
98-> 环境检查脚本中所有的检查项和版本约束严格来源于 docs/zh/build.md requirements.txt,如文档和依赖更新,请同步修改[脚本](../../scripts/check_env.sh)。98+> 环境检查脚本中所有的检查项和版本约束严格来源于docs/zh/build.md和requirements.txt,如文档和依赖更新,请同步修改[脚本](../../scripts/check_env.sh)。
99 99 
100### 4.3 编译100### 4.3 编译
101 101 
@@ -146,11 +146,11 @@ bash scripts/check_env.sh
146 146 
147- 统计代码覆盖率:147- 统计代码覆盖率:
148 148 
149- 使用 `tests/run_test.sh` 脚本的 `-c` 参数可以在测试用例运行过程中生成代码覆盖率统计文件。149+ 使用`tests/run_test.sh`脚本的`-c`参数可以在测试用例运行过程中生成代码覆盖率统计文件。
150 150 
151 **前置条件**151 **前置条件**
152- - 确保 `lcov` 工具已正确安装152+ - 确保`lcov`工具已正确安装
153- - 编译运行环境上的 `gcc` `gcov` 必须是配套版本153+ - 编译运行环境上的`gcc`和`gcov`必须是配套版本
154 154 
155 **使用方法**155 **使用方法**
156 156 
@@ -158,7 +158,7 @@ bash scripts/check_env.sh
158 bash tests/run_test.sh -c [其他参数]158 bash tests/run_test.sh -c [其他参数]
159 ```159 ```
160 160 
161- **输出位置**:生成的覆盖率文件位于代码根目录下的 `cov/` 目录中。161+ **输出位置**:生成的覆盖率文件位于代码根目录下的`cov/`目录中。
162 162 
163- 执行指定用例:163- 执行指定用例:
164 164 
@@ -168,7 +168,7 @@ bash scripts/check_env.sh
168 - 已经执行了UT/ST对应的测试命令,并正确生成了测试可执行文件。168 - 已经执行了UT/ST对应的测试命令,并正确生成了测试可执行文件。
169 169 
170 **使用方法**170 **使用方法**
171- - 示例:已经执行了 `bash tests/run_test.sh --ut=ge_common` ,并希望单独执行验证 `ut_libge_multiparts_utest` 171+ - 示例:已经执行了`bash tests/run_test.sh --ut=ge_common` ,并希望单独执行验证`ut_libge_multiparts_utest`:
172 172 
173 ```bash173 ```bash
174 # 测试UT/ST会对部分依赖so进行打桩处理,需要清除LD_LIBRARY_PATH和ASCEND_OPP_PATH环境变量,避免宿主机已安装的 CANN/Ascend 环境干扰测试174 # 测试UT/ST会对部分依赖so进行打桩处理,需要清除LD_LIBRARY_PATH和ASCEND_OPP_PATH环境变量,避免宿主机已安装的 CANN/Ascend 环境干扰测试
@@ -38,7 +38,7 @@
38 38 
391.**安装驱动与固件(运行态依赖)**391.**安装驱动与固件(运行态依赖)**
40 40 
41-宿主机上昇腾驱动与固件的下载和安装操作请参考《[软件安装](https://www.hiascend.com/document/redirect/CannCommunityInstWizard)》中“准备软件包”和“安装NPU驱动和固件”章节。驱动与固件是运行态依赖,若仅编译算子,可以不安装。41+宿主机上昇腾驱动与固件的下载和安装操作请参考《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》中“准备软件包”和“安装NPU驱动和固件”章节。驱动与固件是运行态依赖,若仅编译算子,可以不安装。
42 42 
432.**下载镜像**432.**下载镜像**
44 44 
@@ -126,11 +126,11 @@ docker run --name cann_container \
126 126 
127 1. **安装驱动与固件(可选,仅运行[样例](../../examples/README.md)依赖)**127 1. **安装驱动与固件(可选,仅运行[样例](../../examples/README.md)依赖)**
128 128 
129- 驱动与固件是运行态依赖,若仅编译源码,可以不安装。使用`npu-smi info`检查是否有NPU相关信息,若没有,请参考《[快速安装](https://www.hiascend.com/cann/download)》完成驱动与固件安装。129+ 驱动与固件是运行态依赖,若仅编译源码,可以不安装。使用`npu-smi info`检查是否有NPU相关信息,若没有,请参考《[CANN快速安装](https://www.hiascend.com/cann/download)》完成驱动与固件安装。
130 130 
131 2. **安装CANN包**131 2. **安装CANN包**
132 132 
133- 请单击[下载链接](https://ascend.devcloud.huaweicloud.com/artifactory/cann-run-mirror/software/master)获取最新时间版本,并根据产品型号和环境架构下载对应包。安装命令如下,更多指导请参考《[软件安装](https://www.hiascend.com/document/redirect/CannCommunityInstWizard)》。133+ 请单击[下载链接](https://ascend.devcloud.huaweicloud.com/artifactory/cann-run-mirror/software/master)获取最新时间版本,并根据产品型号和环境架构下载对应包。安装命令如下,更多指导请参考《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。
134 134 
135 - 安装CANN Toolkit开发套件包。135 - 安装CANN Toolkit开发套件包。
136 136 
@@ -170,7 +170,7 @@ atc --compression_optimize_conf=$HOME/module/compression_optimize.cfg ...
170- 使用该参数的压缩特性时,需要单独安装AMCT(acl)软件包,该包的获取以及安装方法请参见《[AMCT模型压缩工具](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/devaids/amct/atlasamct_16_0001.html)》中的“准备环境 \> 获取软件包、上传软件包、安装工具”章节。170- 使用该参数的压缩特性时,需要单独安装AMCT(acl)软件包,该包的获取以及安装方法请参见《[AMCT模型压缩工具](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/devaids/amct/atlasamct_16_0001.html)》中的“准备环境 \> 获取软件包、上传软件包、安装工具”章节。
171- 使用该参数中的**enable\_first\_layer\_quantization**特性时,请确保使用的模型是由AMCT进行量化操作后输出的部署模型。171- 使用该参数中的**enable\_first\_layer\_quantization**特性时,请确保使用的模型是由AMCT进行量化操作后输出的部署模型。
172<!-- npu="A3,910b,910,310p,310b" id13 -->172<!-- npu="A3,910b,910,310p,310b" id13 -->
173-- 使用配置文件中的**calibration**训练后量化功能时,只支持**带NPU设备**的安装场景,详细介绍请参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》手册搭建对应产品环境。173+- 使用配置文件中的**calibration**训练后量化功能时,只支持**带NPU设备**的安装场景,详细介绍请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》手册搭建对应产品环境。
174<!-- end id13 -->174<!-- end id13 -->
175<!-- npu="310b" id12 -->175<!-- npu="310b" id12 -->
176- Atlas 200I/500 A2 推理产品Ascend RC场景,还需要在运行环境上安装NCS软件,并配置密钥证书,请参见《[AOE调优工具](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/devaids/aoe/auxiliarydevtool_aoe_0001.html)》>AOE工具(Ascend RC)>环境准备。176- Atlas 200I/500 A2 推理产品Ascend RC场景,还需要在运行环境上安装NCS软件,并配置密钥证书,请参见《[AOE调优工具](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/devaids/aoe/auxiliarydevtool_aoe_0001.html)》>AOE工具(Ascend RC)>环境准备。
@@ -52,7 +52,7 @@
52 OpType::TypeName2:InputDtype:dtype1,dtype2,...,OutputDtype:dtype1,...52 OpType::TypeName2:InputDtype:dtype1,dtype2,...,OutputDtype:dtype1,...
53 ```53 ```
54 54 
55-算子具体支持的计算精度可以从《[算子库](https://hiascend.com/document/redirect/CannCommunityOplist)》\> “Ascend IR算子规格说明”中查看。55+算子具体支持的计算精度可以从《[算子库](https://gitcode.com/cann/docs/blob/master/docs/zh/ops-lib/0_README.md)》\> “Ascend IR算子规格说明”中查看。
56 56 
57以TensorFlow ResNet50网络模型中的Relu算子为例,其对应的Ascend IR定义的算子类型为Relu,该算子输入和输出只有一个,该配置样例如下:57以TensorFlow ResNet50网络模型中的Relu算子为例,其对应的Ascend IR定义的算子类型为Relu,该算子输入和输出只有一个,该配置样例如下:
58 58 
@@ -182,7 +182,7 @@ IPV350:不支持
182单算子描述文件(JSON格式)格式以及参数配置请参见[单算子模型转换](../sinlgeop_model_convert/sinlgeop_model_convert.md)。182单算子描述文件(JSON格式)格式以及参数配置请参见[单算子模型转换](../sinlgeop_model_convert/sinlgeop_model_convert.md)。
183 183 
184**参数值约束:**184**参数值约束:**
185-该参数指定的单算子都是基于Ascend IR定义的,关于单算子的详细定义请参见《[算子库](https://hiascend.com/document/redirect/CannCommunityOplist)》中的“Ascend IR算子规格说明”章节。185+该参数指定的单算子都是基于Ascend IR定义的,关于单算子的详细定义请参见《[算子库](https://gitcode.com/cann/docs/blob/master/docs/zh/ops-lib/0_README.md)》中的“Ascend IR算子规格说明”章节。
186 186 
187## 推荐配置及收益187## 推荐配置及收益
188 188 
@@ -61,4 +61,4 @@ atc --status_check=1 ...
61 61 
62## 使用约束62## 使用约束
63 63 
64-使用[--status\_check](--status_check.md)参数只是在模型编译后生成的算子\*.cce文件中加入了溢出检测逻辑,如果想查看具体哪些算子有溢出,则需要配合模型推理过程中提供的**aclInit**接口,在该接口入参的JSON配置文件中打开“dump\_debug”开关,接口详细说明请参见《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“初始化和去初始化 \> aclInit”章节。64+使用[--status\_check](--status_check.md)参数只是在模型编译后生成的算子\*.cce文件中加入了溢出检测逻辑,如果想查看具体哪些算子有溢出,则需要配合模型推理过程中提供的**aclInit**接口,在该接口入参的JSON配置文件中打开“dump\_debug”开关,接口详细说明请参见《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“初始化和去初始化 \> aclInit”章节。
@@ -1,4 +1,4 @@
1-# ATC离线模型编译工具用户指南1+# ATC离线模型编译工具
2 2 
3- [学习向导](overview/learning_guide.md)3- [学习向导](overview/learning_guide.md)
4- [ATC概述](overview/atc_overview.md)4- [ATC概述](overview/atc_overview.md)
@@ -2,7 +2,7 @@
2 2 
3## 获取ATC工具3## 获取ATC工具
4 4 
5-进行模型转换前,请参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》完成环境搭建,并确保已安装CANN Toolkit开发套件包和ops算子包(针对8.5.0及之后版本,必须安装与目标AI处理器相匹配的ops算子包,否则会导致编译失败)。以root用户的默认安装路径为例,ATC工具安装在“/usr/local/Ascend/cann/bin”目录中。5+进行模型转换前,请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》完成环境搭建,并确保已安装CANN Toolkit开发套件包和ops算子包(针对8.5.0及之后版本,必须安装与目标AI处理器相匹配的ops算子包,否则会导致编译失败)。以root用户的默认安装路径为例,ATC工具安装在“/usr/local/Ascend/cann/bin”目录中。
6 6 
7支持在同一开发环境中部署多个芯片的算子包,实现多芯片场景下的模型转换,可通过在不同路径下分别安装CANN Toolkit开发套件及对应芯片(如芯片A、芯片B)的算子包,例如:7支持在同一开发环境中部署多个芯片的算子包,实现多芯片场景下的模型转换,可通过在不同路径下分别安装CANN Toolkit开发套件及对应芯片(如芯片A、芯片B)的算子包,例如:
8 8 
@@ -17,8 +17,8 @@
17>17>
18>- 使用export方式设置环境变量后,环境变量只在当前窗口有效,用户可以按需将以上命令写入环境变量配置文件(如.bashrc文件)。18>- 使用export方式设置环境变量后,环境变量只在当前窗口有效,用户可以按需将以上命令写入环境变量配置文件(如.bashrc文件)。
19>- 使用ATC工具进行模型转换的过程中,会自动将ATC工具所在位置“../python/site-packages”目录下算子编译依赖的Python库写入PYTHONPATH环境变量。19>- 使用ATC工具进行模型转换的过程中,会自动将ATC工具所在位置“../python/site-packages”目录下算子编译依赖的Python库写入PYTHONPATH环境变量。
20-> 若算子实现时用户引入了上述依赖外的其他Python依赖,请自行添加PYTHONPATH的环境变量,配置引入的Python依赖所在路径,如下所示:20+> 若算子实现时用户引入了上述依赖外的其他Python依赖,请自行添加PYTHONPATH的环境变量,配置引入的Python依赖所在路径,示例为
21-> export PYTHONPATH=_xxxx_:$PYTHONPATH21+> `export PYTHONPATH=_xxxx_:$PYTHONPATH`
22 22 
231. **必选环境变量**231. **必选环境变量**
24 24 
@@ -4,7 +4,7 @@
4 4 
5不同输入或者不同Format场景,单算子描述文件配置不同,本章节给出各场景的配置示例。5不同输入或者不同Format场景,单算子描述文件配置不同,本章节给出各场景的配置示例。
6 6 
7-本章节中的单算子是基于Ascend IR定义的,描述文件为JSON格式。关于JSON描述文件中各参数的解释请参见[表1](singleop_desc_intro.md#table1),关于单算子的Ascend IR定义请参见《[算子库](https://hiascend.com/document/redirect/CannCommunityOplist)》\> “Ascend IR算子规格说明” 。7+本章节中的单算子是基于Ascend IR定义的,描述文件为JSON格式。关于JSON描述文件中各参数的解释请参见[表1](singleop_desc_intro.md#table1),关于单算子的Ascend IR定义请参见《[算子库](https://gitcode.com/cann/docs/blob/master/docs/zh/ops-lib/0_README.md)》\> “Ascend IR算子规格说明” 。
8 8 
9- **Format为ND:**9- **Format为ND:**
10 10 
@@ -13,7 +13,7 @@
135. 调用"GEFinalize"接口,释放系统资源。135. 调用"GEFinalize"接口,释放系统资源。
14 14 
15> [!NOTE]说明15> [!NOTE]说明
16->如上步骤中的“GEInitialize”、“Session构造函数”、“AddGraph”、“RunGraph”、“GEFinalize”详细信息请参考《[GE图引擎 API](../../../../api/graph_engine_api/README.md)》。16+>如上步骤中的“GEInitialize”、“Session构造函数”、“AddGraph”、“RunGraph”、“GEFinalize”详细信息请参考《[GE图引擎API](../../../../api/graph_engine_api/README.md)》。
17>使用DataFlow开发框架时,NN模型执行使用的是饱和模式。该模式下计算精度可能存在误差,该模式仅为兼容旧版本,后续不演进。17>使用DataFlow开发框架时,NN模型执行使用的是饱和模式。该模式下计算精度可能存在误差,该模式仅为兼容旧版本,后续不演进。
18 18 
19## 开发示例19## 开发示例
@@ -4,7 +4,7 @@
4 4 
5支持的产品型号:Atlas A2 训练系列产品/Atlas A2 推理系列产品和Atlas A3 训练系列产品/Atlas A3 推理系列产品。5支持的产品型号:Atlas A2 训练系列产品/Atlas A2 推理系列产品和Atlas A3 训练系列产品/Atlas A3 推理系列产品。
6 6 
7-已经安装CANN软件,详细操作请参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。7+已经安装CANN软件,详细操作请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。
8 8 
9> [!NOTE]说明9> [!NOTE]说明
10>AI Server场景下,安装节点应采用容器/虚拟机隔离,容器/虚拟机的生命周期与业务进程/租户保持一致。容器/虚拟机生命周期结束时要清理持久化数据,避免对下一个业务进程/租户的影响。10>AI Server场景下,安装节点应采用容器/虚拟机隔离,容器/虚拟机的生命周期与业务进程/租户保持一致。容器/虚拟机生命周期结束时要清理持久化数据,避免对下一个业务进程/租户的影响。
@@ -26,7 +26,7 @@
26 26 
27#### 环境准备27#### 环境准备
28 28 
29-- 进行UDF开发前,需要完成驱动固件及开发套件包Ascend-cann-toolkit的安装,详细操作请参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。29+- 进行UDF开发前,需要完成驱动固件及开发套件包Ascend-cann-toolkit的安装,详细操作请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。
30- 配置环境变量CANN软件包安装路径ASCEND\_INSTALL\_PATH,UDF编译时根据该环境变量寻找依赖的头文件和so,如果不设置,默认该环境变量取值为“/usr/local/Ascend”。配置示例如下。30- 配置环境变量CANN软件包安装路径ASCEND\_INSTALL\_PATH,UDF编译时根据该环境变量寻找依赖的头文件和so,如果不设置,默认该环境变量取值为“/usr/local/Ascend”。配置示例如下。
31 31 
32 ```shell32 ```shell
@@ -10,7 +10,7 @@
10 10 
11- 当前仅支持Python3.11。安装方法请参考Python官网[https://www.python.org/](https://www.python.org/)。11- 当前仅支持Python3.11。安装方法请参考Python官网[https://www.python.org/](https://www.python.org/)。
12 12 
13-- 已经安装好开发套件包Ascend-cann-toolkit,详细操作请参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。13+- 已经安装好开发套件包Ascend-cann-toolkit,详细操作请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。
14 14 
15 > [!NOTE]说明15 > [!NOTE]说明
16 >AI Server场景下,安装节点应采用容器/虚拟机隔离,容器/虚拟机的生命周期与业务进程/租户保持一致。容器/虚拟机生命周期结束时要清理持久化数据,避免对下一个业务进程/租户的影响。16 >AI Server场景下,安装节点应采用容器/虚拟机隔离,容器/虚拟机的生命周期与业务进程/租户保持一致。容器/虚拟机生命周期结束时要清理持久化数据,避免对下一个业务进程/租户的影响。
@@ -17,7 +17,7 @@
17 17 
18### 环境准备18### 环境准备
19 19 
20-- 进行UDF开发前,需要完成驱动固件及开发套件包Ascend-cann-toolkit的安装,详细操作请参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。20+- 进行UDF开发前,需要完成驱动固件及开发套件包Ascend-cann-toolkit的安装,详细操作请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。
21- 进行Python UDF开发前需要安装Python依赖包:pybind11及jinja2。pybind11用于C++和Python之间对象的转换。jinja2用于快速生成工程模板。21- 进行Python UDF开发前需要安装Python依赖包:pybind11及jinja2。pybind11用于C++和Python之间对象的转换。jinja2用于快速生成工程模板。
22- 配置环境变量CANN软件包安装路径ASCEND\_INSTALL\_PATH,UDF编译时根据该环境变量寻找依赖的头文件和so,如果不设置,默认该环境变量取值为“/usr/local/Ascend”。配置示例如下。22- 配置环境变量CANN软件包安装路径ASCEND\_INSTALL\_PATH,UDF编译时根据该环境变量寻找依赖的头文件和so,如果不设置,默认该环境变量取值为“/usr/local/Ascend”。配置示例如下。
23 23 
@@ -1,4 +1,4 @@
1-# 图开发指南1+# 图开发
2 2 
3- [入门教程](overview/getting_started.md)3- [入门教程](overview/getting_started.md)
4 - [什么是GE图引擎](overview/GE_definition.md)4 - [什么是GE图引擎](overview/GE_definition.md)
@@ -232,7 +232,7 @@
232 }232 }
233 ```233 ```
234 234 
235-aclrtMallocHost、aclrtMalloc、aclrtFreeHost、aclrtFree等接口详细说明请参见《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“内存管理”。235+aclrtMallocHost、aclrtMalloc、aclrtFreeHost、aclrtFree等接口详细说明请参见《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“内存管理”。
236 236 
237## 编译和运行接口变化237## 编译和运行接口变化
238 238 
@@ -4,7 +4,7 @@
4 4 
5### 前提条件5### 前提条件
6 6 
7-- 安装软件包:准备带有AI处理器的硬件环境,并安装驱动固件和CANN软件包,具体安装步骤请参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。7+- 安装软件包:准备带有AI处理器的硬件环境,并安装驱动固件和CANN软件包,具体安装步骤请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》。
8- GCC版本:要求9.5.0及以上,建议使用9.5.0版本。8- GCC版本:要求9.5.0及以上,建议使用9.5.0版本。
9- CMake:要求3.20.0版本及以上,建议使用3.20.0版本。9- CMake:要求3.20.0版本及以上,建议使用3.20.0版本。
10- 安装mspti,mspti有两种获取方式(开启PGO特性时需要安装该依赖):10- 安装mspti,mspti有两种获取方式(开启PGO特性时需要安装该依赖):
@@ -1,6 +1,6 @@
1# 样例代码解析1# 样例代码解析
2 2 
3-本实践采用模块化设计,基于C++语言结合GE图引擎 API与acl(Ascend Computing Language)API实现,完整代码请单击[推荐网络高性能示例](../../../../../examples/recommendation)获取,核心组件构成如下:3+本实践采用模块化设计,基于C++语言结合GE图引擎API与acl(Ascend Computing Language)API实现,完整代码请单击[推荐网络高性能示例](../../../../../examples/recommendation)获取,核心组件构成如下:
4 4 
51. **ModelInference::Builder**:构建器,配置模型参数;封装ModelInference对象的构建过程,提供链式配置接口。51. **ModelInference::Builder**:构建器,配置模型参数;封装ModelInference对象的构建过程,提供链式配置接口。
62. **ModelInference**:核心类,提供模型初始化、资源管理、任务调度等核心能力。62. **ModelInference**:核心类,提供模型初始化、资源管理、任务调度等核心能力。
@@ -18,7 +18,7 @@
18 18 
19![图2示例](../figures/single_thread_14.png)19![图2示例](../figures/single_thread_14.png)
20 20 
21-1. 调用《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“初始化和去初始化 \> aclInit”接口,初始化acl,调用《Runtime运行时 API》中的“Device管理 \> aclrtSetDevice”指定运行的Device。21+1. 调用《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“初始化和去初始化 \> aclInit”接口,初始化acl,调用《Runtime运行时API》中的“Device管理 \> aclrtSetDevice”指定运行的Device。
222. 构建ModelInference实例并初始化特性开关:开启批量H2D功能、配置AICore控核策略、使用多实例并行。222. 构建ModelInference实例并初始化特性开关:开启批量H2D功能、配置AICore控核策略、使用多实例并行。
233. ModelInference初始化:233. ModelInference初始化:
24 1. 调用[Session构造函数](../../../api/graph_engine_api/cpp/ge/Session/Session.md)创建Session类对象,申请Session资源,Session中的options中配置ge.aicoreNum参数。24 1. 调用[Session构造函数](../../../api/graph_engine_api/cpp/ge/Session/Session.md)创建Session类对象,申请Session资源,Session中的options中配置ge.aicoreNum参数。
@@ -26,20 +26,20 @@
26 3. 调用[aclgrphParseTensorFlow](../../../api/graph_engine_api/cpp/ge/aclgrphParseTensorFlow.md)解析模型,获取Graph。26 3. 调用[aclgrphParseTensorFlow](../../../api/graph_engine_api/cpp/ge/aclgrphParseTensorFlow.md)解析模型,获取Graph。
27 4. 调用[AddGraph](../../../api/graph_engine_api/cpp/ge/Session/AddGraph.md)在Session类对象中添加定义好的图。27 4. 调用[AddGraph](../../../api/graph_engine_api/cpp/ge/Session/AddGraph.md)在Session类对象中添加定义好的图。
28 5. 调用[CompileGraph](../../../api/graph_engine_api/cpp/ge/Session/CompileGraph.md)完成图编译。28 5. 调用[CompileGraph](../../../api/graph_engine_api/cpp/ge/Session/CompileGraph.md)完成图编译。
29- 6. 调用《Runtime运行时 API》中的“Device管理 \> aclrtGetDevice”获取运行的Device。29+ 6. 调用《Runtime运行时API》中的“Device管理 \> aclrtGetDevice”获取运行的Device。
30 7. 创建多个线程,每个线程传入相同的Session,Graph ID,Device ID。30 7. 创建多个线程,每个线程传入相同的Session,Graph ID,Device ID。
31 31 
324. 提交推理任务到工作线程。下面以一个线程为例,描述工作线程的执行流程:324. 提交推理任务到工作线程。下面以一个线程为例,描述工作线程的执行流程:
33- 1. 调用《Runtime运行时 API》中的“Device管理 \> aclrtSetDevice”指定运行的Device,调用“aclrtCreateStream”创建Stream。33+ 1. 调用《Runtime运行时API》中的“Device管理 \> aclrtSetDevice”指定运行的Device,调用“aclrtCreateStream”创建Stream。
34 2. 调用[LoadGraph](../../../api/graph_engine_api/cpp/ge/Session/LoadGraph.md)(异步执行Graph场景),将图模型加载到上一步骤创建的Stream上。监听任务队列接收并执行任务:34 2. 调用[LoadGraph](../../../api/graph_engine_api/cpp/ge/Session/LoadGraph.md)(异步执行Graph场景),将图模型加载到上一步骤创建的Stream上。监听任务队列接收并执行任务:
35- 1. 调用《Runtime运行时 API》中的“内存管理 \> aclrtMalloc”申请Device内存,调用《Runtime运行时 API》中的“内存管理 \> aclrtMemcpyBatch”将数据从Host批量传输到Device。(如果开启批量H2D功能,使用aclrtMemcpyBatch接口,不开启该功能,则使用aclrtMemcpy接口)。35+ 1. 调用《Runtime运行时API》中的“内存管理 \> aclrtMalloc”申请Device内存,调用《Runtime运行时API》中的“内存管理 \> aclrtMemcpyBatch”将数据从Host批量传输到Device。(如果开启批量H2D功能,使用aclrtMemcpyBatch接口,不开启该功能,则使用aclrtMemcpy接口)。
36 2. 调用[ExecuteGraphWithStreamAsync](../../../api/graph_engine_api/cpp/ge/Session/ExecuteGraphWithStreamAsync.md)异步执行接口,运行Graph。36 2. 调用[ExecuteGraphWithStreamAsync](../../../api/graph_engine_api/cpp/ge/Session/ExecuteGraphWithStreamAsync.md)异步执行接口,运行Graph。
37 3. 调用“aclrtSynchronizeStream”阻塞程序运行,直到指定Stream中的所有任务都完成。37 3. 调用“aclrtSynchronizeStream”阻塞程序运行,直到指定Stream中的所有任务都完成。
38 4. 调用aclrtMemcpyBatch将数据从Device批量回传到Host。38 4. 调用aclrtMemcpyBatch将数据从Device批量回传到Host。
39- 5. 调用《Runtime运行时 API》中的“内存管理 \> aclrtFree”释放内存。39+ 5. 调用《Runtime运行时API》中的“内存管理 \> aclrtFree”释放内存。
40 6. 执行自定义的回调函数。40 6. 执行自定义的回调函数。
41 41 
42-5. 调用[GEFinalize](../../../api/graph_engine_api/cpp/ge/Session/GEFinalize.md),释放系统资源;调用《Runtime运行时 API》中的“初始化和去初始化 \> aclFinalize”释放相关资源。42+5. 调用[GEFinalize](../../../api/graph_engine_api/cpp/ge/Session/GEFinalize.md),释放系统资源;调用《Runtime运行时API》中的“初始化和去初始化 \> aclFinalize”释放相关资源。
43 43 
44## 开发示例44## 开发示例
45 45 
@@ -11,9 +11,9 @@
11![图示](../figures/feature_intro_4.png)11![图示](../figures/feature_intro_4.png)
12 12 
131. 调用[GEInitializeV2](../../../api/graph_engine_api/cpp/ge/GeSession/GEInitializeV2.md)进行系统初始化(也可在Graph构建前调用),申请系统资源。131. 调用[GEInitializeV2](../../../api/graph_engine_api/cpp/ge/GeSession/GEInitializeV2.md)进行系统初始化(也可在Graph构建前调用),申请系统资源。
14-2. 调用《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“初始化和去初始化 \> aclInit”接口,初始化acl。14+2. 调用《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“初始化和去初始化 \> aclInit”接口,初始化acl。
153. 调用[Session构造函数](../../../api/graph_engine_api/cpp/ge/GeSession/GESession.md)创建Session类对象,申请Session资源。153. 调用[Session构造函数](../../../api/graph_engine_api/cpp/ge/GeSession/GESession.md)创建Session类对象,申请Session资源。
16-4. 调用《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“Device管理 \> aclrtSetDevice”指定运行的Device,调用“aclrtCreateStream”创建Stream,然后调用《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“内存管理 \> aclrtMallocHost/aclrtMalloc”分别申请Host和Device内存。16+4. 调用《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“Device管理 \> aclrtSetDevice”指定运行的Device,调用“aclrtCreateStream”创建Stream,然后调用《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“内存管理 \> aclrtMallocHost/aclrtMalloc”分别申请Host和Device内存。
175. 调用[AddGraph](../../../api/graph_engine_api/cpp/ge/GeSession/AddGraph.md)在Session类对象中添加定义好的图。175. 调用[AddGraph](../../../api/graph_engine_api/cpp/ge/GeSession/AddGraph.md)在Session类对象中添加定义好的图。
186. (可选)调用[CompileGraph](../../../api/graph_engine_api/cpp/ge/GeSession/CompileGraph.md)完成图编译。186. (可选)调用[CompileGraph](../../../api/graph_engine_api/cpp/ge/GeSession/CompileGraph.md)完成图编译。
197. (可选)调用[LoadGraph](../../../api/graph_engine_api/cpp/ge/GeSession/LoadGraph.md)(异步执行Graph场景),加载图模型到上面步骤创建的Stream上。197. (可选)调用[LoadGraph](../../../api/graph_engine_api/cpp/ge/GeSession/LoadGraph.md)(异步执行Graph场景),加载图模型到上面步骤创建的Stream上。
@@ -22,7 +22,7 @@
22 若在调用本接口前未执行LoadGraph完成图加载,则本接口将自动调用LoadGraph以完成加载;若在调用LoadGraph接口前未执行CompileGraph完成图编译,则LoadGraph将自动调用CompileGraph以完成编译。22 若在调用本接口前未执行LoadGraph完成图加载,则本接口将自动调用LoadGraph以完成加载;若在调用LoadGraph接口前未执行CompileGraph完成图编译,则LoadGraph将自动调用CompileGraph以完成编译。
23 23 
249. 调用“aclrtSynchronizeStream”阻塞程序运行,直到指定Stream中的所有任务都完成。249. 调用“aclrtSynchronizeStream”阻塞程序运行,直到指定Stream中的所有任务都完成。
25-10. 调用《Runtime运行时 API》中的“内存管理 \> aclrtFree/aclrtFreeHost”释放内存;调用[GEFinalizeV2](../../../api/graph_engine_api/cpp/ge/GeSession/GEFinalizeV2.md),释放系统资源;调用《Runtime运行时 API》中的“初始化和去初始化 \> aclFinalize”释放相关资源。25+10. 调用《Runtime运行时API》中的“内存管理 \> aclrtFree/aclrtFreeHost”释放内存;调用[GEFinalizeV2](../../../api/graph_engine_api/cpp/ge/GeSession/GEFinalizeV2.md),释放系统资源;调用《Runtime运行时API》中的“初始化和去初始化 \> aclFinalize”释放相关资源。
26 26 
27### 开发示例27### 开发示例
28 28 
@@ -210,20 +210,20 @@
210![图示](../figures/single_thread.png)210![图示](../figures/single_thread.png)
211 211 
2121. 调用[GEInitializeV2](../../../api/graph_engine_api/cpp/ge/GeSession/GEInitializeV2.md)进行系统初始化(也可在Graph构建前调用),申请系统资源。2121. 调用[GEInitializeV2](../../../api/graph_engine_api/cpp/ge/GeSession/GEInitializeV2.md)进行系统初始化(也可在Graph构建前调用),申请系统资源。
213-2. 调用《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“初始化和去初始化 \> aclInit”接口,初始化acl。213+2. 调用《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“初始化和去初始化 \> aclInit”接口,初始化acl。
2143. 调用[Session构造函数](../../../api/graph_engine_api/cpp/ge/GeSession/GESession.md)创建多个Session类对象,申请Session资源,每个Session传入不同的ge.session\_device\_id,将模型运行在不同的Device。2143. 调用[Session构造函数](../../../api/graph_engine_api/cpp/ge/GeSession/GESession.md)创建多个Session类对象,申请Session资源,每个Session传入不同的ge.session\_device\_id,将模型运行在不同的Device。
2154. 创建多个线程,每个线程传入不同的Session,下面以一个线程为例,描述简单的流程:2154. 创建多个线程,每个线程传入不同的Session,下面以一个线程为例,描述简单的流程:
216- 1. 调用《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“Device管理 \> aclrtSetDevice”指定运行的Device,调用“aclrtCreateStream”创建Stream,然后调用《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“内存管理 \> aclrtMalloc”申请Device内存。216+ 1. 调用《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“Device管理 \> aclrtSetDevice”指定运行的Device,调用“aclrtCreateStream”创建Stream,然后调用《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“内存管理 \> aclrtMalloc”申请Device内存。
217 2. 调用[AddGraph](../../../api/graph_engine_api/cpp/ge/GeSession/AddGraph.md)在Session类对象中添加定义好的图。217 2. 调用[AddGraph](../../../api/graph_engine_api/cpp/ge/GeSession/AddGraph.md)在Session类对象中添加定义好的图。
218 3. 调用[CompileGraph](../../../api/graph_engine_api/cpp/ge/GeSession/CompileGraph.md)完成图编译。218 3. 调用[CompileGraph](../../../api/graph_engine_api/cpp/ge/GeSession/CompileGraph.md)完成图编译。
219 4. 调用[LoadGraph](../../../api/graph_engine_api/cpp/ge/GeSession/LoadGraph.md)(异步执行Graph场景),将图模型加载到前面创建的Stream上。219 4. 调用[LoadGraph](../../../api/graph_engine_api/cpp/ge/GeSession/LoadGraph.md)(异步执行Graph场景),将图模型加载到前面创建的Stream上。
220- 5. 调用《Runtime运行时 API》中的“内存管理 \> aclrtMemcpy”将数据从Host传输到Device。220+ 5. 调用《Runtime运行时API》中的“内存管理 \> aclrtMemcpy”将数据从Host传输到Device。
221 6. 调用[RunGraphWithStreamAsync](../../../api/graph_engine_api/cpp/ge/GeSession/RunGraphWithStreamAsync.md)异步执行接口,运行Graph。221 6. 调用[RunGraphWithStreamAsync](../../../api/graph_engine_api/cpp/ge/GeSession/RunGraphWithStreamAsync.md)异步执行接口,运行Graph。
222 7. 调用“aclrtSynchronizeStream”阻塞程序运行,直到指定Stream中的所有任务都完成。222 7. 调用“aclrtSynchronizeStream”阻塞程序运行,直到指定Stream中的所有任务都完成。
223- 8. 调用《Runtime运行时 API》中的“内存管理 \> aclrtMemcpy”将数据从Device回传到Host。223+ 8. 调用《Runtime运行时API》中的“内存管理 \> aclrtMemcpy”将数据从Device回传到Host。
224- 9. 调用《Runtime运行时 API》中的“内存管理 \> aclrtFree”释放内存。224+ 9. 调用《Runtime运行时API》中的“内存管理 \> aclrtFree”释放内存。
225 225 
226-5. 调用[GEFinalizeV2](../../../api/graph_engine_api/cpp/ge/GeSession/GEFinalizeV2.md),释放系统资源;调用《Runtime运行时 API》中的“初始化和去初始化 \> aclFinalize”释放相关资源。226+5. 调用[GEFinalizeV2](../../../api/graph_engine_api/cpp/ge/GeSession/GEFinalizeV2.md),释放系统资源;调用《Runtime运行时API》中的“初始化和去初始化 \> aclFinalize”释放相关资源。
227 227 
228### 开发示例228### 开发示例
229 229 
@@ -105,7 +105,7 @@ namespace ge{
105 105 
106- 对于内置算子,用户可以通过如下两种方式获取算子原型:106- 对于内置算子,用户可以通过如下两种方式获取算子原型:
107 107 
108- - 从《[算子库](https://hiascend.com/document/redirect/CannCommunityOplist)》中的“Ascend IR算子规格说明”获取,如下图所示。108+ - 从《[算子库](https://gitcode.com/cann/docs/blob/master/docs/zh/ops-lib/0_README.md)》中的“Ascend IR算子规格说明”获取,如下图所示。
109 109 
110 **图 1** 查看算子原型信息110 **图 1** 查看算子原型信息
111 ![算子原型信](../figures/view_op_prototype_info.png "查看算子原型信息")111 ![算子原型信](../figures/view_op_prototype_info.png "查看算子原型信息")
@@ -302,7 +302,7 @@ g++ -std=c++14 -shared $SOURCE_FILES -o outputs/libcustom_ops.so -fPIC ${TF_CFLA
302 ```302 ```
303 <!-- end id1 -->303 <!-- end id1 -->
304 304 
305- 其中,aclrtBinaryLoadFromFile、aclrtBinaryGetFunction、aclrtLaunchKernelWithHostArgs接口详细说明请参见《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“Kernel加载与执行”。305+ 其中,aclrtBinaryLoadFromFile、aclrtBinaryGetFunction、aclrtLaunchKernelWithHostArgs接口详细说明请参见《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》中的“Kernel加载与执行”。
306 306 
307 GetAddr、GetShape、GetSize、GetDataType、GetFormat、GetShapeSize接口详细说明请参见《[基础数据结构和接口](https://gitcode.com/cann/metadef/blob/master/docs/zh/api/README.md)》。307 GetAddr、GetShape、GetSize、GetDataType、GetFormat、GetShapeSize接口详细说明请参见《[基础数据结构和接口](https://gitcode.com/cann/metadef/blob/master/docs/zh/api/README.md)》。
308 308 
@@ -98,7 +98,7 @@ REGISTER_CUSTOM_PASS("pass_name").CustomAllocateStreamPassFn(CustomStreamPassFun
98 98 
99- **前提条件**99- **前提条件**
100 100 
101- 请参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》安装CANN软件包。101+ 请参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》安装CANN软件包。
102 102 
103- **程序编译:**103- **程序编译:**
104 1. 参见[样例使用指导](https://gitee.com/ascend/samples/tree/master/cplusplus/level1_single_api/3_ir/2_fuse_matmul_add_pass),获取其中的CMakeLists.txt编辑脚本,并按照Sample中的目录结构,将用户自定义逻辑流分配函数**_AllocateStreamPass.cpp_**文件放在src目录下。104 1. 参见[样例使用指导](https://gitee.com/ascend/samples/tree/master/cplusplus/level1_single_api/3_ir/2_fuse_matmul_add_pass),获取其中的CMakeLists.txt编辑脚本,并按照Sample中的目录结构,将用户自定义逻辑流分配函数**_AllocateStreamPass.cpp_**文件放在src目录下。
@@ -4,7 +4,7 @@
4 4 
5## 安装驱动固件与CANN软件包5## 安装驱动固件与CANN软件包
6 6 
7-准备带有AI处理器的硬件环境,参见《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》完成环境搭建,并确保已安装CANN Toolkit开发套件包和ops算子包(**针对8.5.0及之后版本**,编译Graph为离线模型时,必须安装与目标AI处理器相匹配的ops算子包,否则会导致编译失败),安装完成后:7+准备带有AI处理器的硬件环境,参见《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》完成环境搭建,并确保已安装CANN Toolkit开发套件包和ops算子包(**针对8.5.0及之后版本**,编译Graph为离线模型时,必须安装与目标AI处理器相匹配的ops算子包,否则会导致编译失败),安装完成后:
8 8 
9- “$\{INSTALL\_DIR\}/**opp/built-in/op\_graph/inc**”下提供了CANN算子原型定义,用于通过算子原型构建Graph。9- “$\{INSTALL\_DIR\}/**opp/built-in/op\_graph/inc**”下提供了CANN算子原型定义,用于通过算子原型构建Graph。
10- “$\{INSTALL\_DIR\}/**include/graph**”下提供了Graph构建接口。10- “$\{INSTALL\_DIR\}/**include/graph**”下提供了Graph构建接口。
@@ -97,9 +97,9 @@ GE的C++图引擎接口提供了两种构图方式:
97 1. 如果**使用图引擎接口全新构建Graph**,需要根据原始网络,明确如下信息:97 1. 如果**使用图引擎接口全新构建Graph**,需要根据原始网络,明确如下信息:
98 1. 网络中包含哪些算子,以及这些算子的输入、输出、属性等信息。98 1. 网络中包含哪些算子,以及这些算子的输入、输出、属性等信息。
99 2. 网络中算子之间的关联关系。99 2. 网络中算子之间的关联关系。
100- 3. 确认原始网络中的算子在AI处理器是否支持,当前支持的算子请参见《[算子库](https://hiascend.com/document/redirect/CannCommunityOplist)》中的“Ascend IR算子规格说明”章节。如果不支持或不满足实际需要,开发者可以《[Ascend C算子开发](https://gitcode.com/cann/asc-devkit/blob/master/docs/zh/guide/index.md)》自定义Ascend C算子,或者参见《[TBE&AI CPU算子开发](https://hiascend.com/document/redirect/CannCommunityOpdevWizard)》自定义TBE算子,选定一种方式后,将算子部署到硬件环境即可。100+ 3. 确认原始网络中的算子在AI处理器是否支持,当前支持的算子请参见《[算子库](https://gitcode.com/cann/docs/blob/master/docs/zh/ops-lib/0_README.md)》中的“Ascend IR算子规格说明”章节。如果不支持或不满足实际需要,开发者可以《[Ascend C算子开发](https://gitcode.com/cann/asc-devkit/blob/master/docs/zh/guide/index.md)》自定义Ascend C算子,或者参见《[TBE&AI CPU算子开发](https://hiascend.com/document/redirect/CannCommunityOpdevWizard)》自定义TBE算子,选定一种方式后,将算子部署到硬件环境即可。
101 101 
102- 2. 如果**使用Parser接口将原始模型解析为Graph**,需要确认原始网络中的算子在AI处理器是否支持,当前支持的算子请参见《[算子库](https://hiascend.com/document/redirect/CannCommunityOplist)》中的“Ascend IR算子规格说明”章节。如果不支持或不满足实际需要,可参见《[Ascend C算子开发](https://gitcode.com/cann/asc-devkit/blob/master/docs/zh/guide/index.md)》自定义Ascend C算子,或者参见《[TBE&AI CPU算子开发](https://hiascend.com/document/redirect/CannCommunityOpdevWizard)》自定义TBE算子,选定一种方式后,将算子部署至硬件环境即可。102+ 2. 如果**使用Parser接口将原始模型解析为Graph**,需要确认原始网络中的算子在AI处理器是否支持,当前支持的算子请参见《[算子库](https://gitcode.com/cann/docs/blob/master/docs/zh/ops-lib/0_README.md)》中的“Ascend IR算子规格说明”章节。如果不支持或不满足实际需要,可参见《[Ascend C算子开发](https://gitcode.com/cann/asc-devkit/blob/master/docs/zh/guide/index.md)》自定义Ascend C算子,或者参见《[TBE&AI CPU算子开发](https://hiascend.com/document/redirect/CannCommunityOpdevWizard)》自定义TBE算子,选定一种方式后,将算子部署至硬件环境即可。
103 103 
1042. 构建Graph,开发者可以使用图引擎接口全新构建Graph,也可以使用Parser接口将原始模型解析为Graph。1042. 构建Graph,开发者可以使用图引擎接口全新构建Graph,也可以使用Parser接口将原始模型解析为Graph。
1053. 修改Graph,如果开发者想要优化Graph结构,则可以基于构建好的Graph直接将Graph修改为期望的结构。1053. 修改Graph,如果开发者想要优化Graph结构,则可以基于构建好的Graph直接将Graph修改为期望的结构。
@@ -160,7 +160,7 @@ SuperKernel是一种基于二进制层面的算子融合技术,区别于传统
160 }160 }
161 ```161 ```
162 162 
163- 上述acl接口详细说明请参见《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》。163+ 上述acl接口详细说明请参见《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》。
164 164 
165- **标定算子不融合到SuperKernel的关键步骤示例**165- **标定算子不融合到SuperKernel的关键步骤示例**
166 166 
@@ -204,4 +204,4 @@ SuperKernel是一种基于二进制层面的算子融合技术,区别于传统
204 }204 }
205 ```205 ```
206 206 
207- 上述acl接口详细说明请参见《[Runtime运行时 API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》。207+ 上述acl接口详细说明请参见《[Runtime运行时API](https://gitcode.com/cann/runtime/blob/master/docs/zh/api_ref/README.md)》。
@@ -5,5 +5,5 @@
5 - [dtype](dtype.md)5 - [dtype](dtype.md)
6 - [shape](shape.md)6 - [shape](shape.md)
7- [Tensor](Tensor.md)7- [Tensor](Tensor.md)
8- - [Tensor-constructor](/Tensor-constructor.md)8+ - [Tensor-constructor](Tensor-constructor.md)
9 - [numpy](numpy.md)9 - [numpy](numpy.md)
@@ -33,7 +33,7 @@
33- Atlas A3 训练系列产品/Atlas A3 推理系列产品33- Atlas A3 训练系列产品/Atlas A3 推理系列产品
34<!-- end id2 -->34<!-- end id2 -->
35 35 
36-请参考《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》安装好驱动固件以及CANN软件。36+请参考《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》安装好驱动固件以及CANN软件。
37 37 
38使用hccn\_tool查询Device IP,并且进行卡间网络检测,要求各个集群上的卡间有RDMA链路连接,否则无法使能LLM-DataDist能力。hccn\_tool详细介绍请参考《[HCCN Tool 接口参考](https://support.huawei.com/enterprise/zh/ascend-computing/ascend-hdk-pid-252764743?category=developer-documents&subcategory=interface-reference)》。以下是常用命令参考。38使用hccn\_tool查询Device IP,并且进行卡间网络检测,要求各个集群上的卡间有RDMA链路连接,否则无法使能LLM-DataDist能力。hccn\_tool详细介绍请参考《[HCCN Tool 接口参考](https://support.huawei.com/enterprise/zh/ascend-computing/ascend-hdk-pid-252764743?category=developer-documents&subcategory=interface-reference)》。以下是常用命令参考。
39 39 
@@ -34,7 +34,7 @@
34- Atlas A3 训练系列产品/Atlas A3 推理系列产品34- Atlas A3 训练系列产品/Atlas A3 推理系列产品
35<!-- end id2 -->35<!-- end id2 -->
36 36 
37-请参考《[软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》安装好驱动固件以及CANN软件。37+请参考《[CANN软件安装](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/latest/softwareinst/instg/instg_0000.html?OS=openEuler&InstallType=netyum)》安装好驱动固件以及CANN软件。
38 38 
39使用hccn\_tool查询Device IP,并且进行卡间网络检测,要求各个集群上的卡间有RDMA链路连接,否则无法使能LLM-DataDist能力。hccn\_tool详细介绍请参考《[HCCN Tool 接口参考](https://support.huawei.com/enterprise/zh/ascend-computing/ascend-hdk-pid-252764743?category=developer-documents&subcategory=interface-reference)》。以下是常用命令参考。39使用hccn\_tool查询Device IP,并且进行卡间网络检测,要求各个集群上的卡间有RDMA链路连接,否则无法使能LLM-DataDist能力。hccn\_tool详细介绍请参考《[HCCN Tool 接口参考](https://support.huawei.com/enterprise/zh/ascend-computing/ascend-hdk-pid-252764743?category=developer-documents&subcategory=interface-reference)》。以下是常用命令参考。
40 40