news 2026/7/4 9:48:11

CANN/ge ES生成器工具指南

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
CANN/ge ES生成器工具指南

ES (Eager Style) Generator

【免费下载链接】geGE(Graph Engine)是面向昇腾的图编译器和执行器,提供了计算图优化、多流并行、内存复用和模型下沉等技术手段,加速模型执行效率,减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力,并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge

Prerequisites

  1. Properly installtoolkitpackage through Installation Guide, andcorrectly configure environment variablesaccording to the guide
  2. Properly install operatoropspackage through Installation Guide (ES depends on operator prototypes for API generation), andcorrectly configure environment variablesaccording to the guide

Environment Variable Requirements

List of environment variables required by gen_esb:

  • ASCEND_OPP_PATH: Points to the opp path under installation directory
  • LD_LIBRARY_PATH: Environment variable specifying dynamic library search path

Note: The above environment variables don't need and are not recommended to be configured separately, the environment variables already configured in Prerequisites by default meet the requirements

Functionality Explanation

This program supports two generation modes

  1. Code Generation Mode Generate ES graph builder C, C++, Python code, including:
  • C interfaces for all supported operators (ops)
  • C++ interfaces for all supported operators
  • Python interfaces for all supported operators
  • Aggregation header files for convenient one-time inclusion of all operators
  • Aggregation Python files for convenient one-time import of all operators
  1. Historical Prototype Library Generation Mode Generate historical prototype structured data, including:
  • Version index
  • Version metadata
  • Operator prototype data for that version

Usage Methods

Code Generation Mode

gen_esb [--output_dir=DIR] [--module_name=NAME] [--h_guard_prefix=PREFIX] [--exclude_ops=OP_TYPE1,OP_TYPE2] [--history_registry=PKG_DIR] [--release_version=VER]

Historical Prototype Library Generation Mode

gen_esb --es_mode=extract_history --release_version=VER [--output_dir=DIR] [--release_date=YYYY-MM-DD] [--branch_name=BRANCH]

Note: Because environment variables have already been configured in Prerequisites,gen_esbhas been added toPATHenvironment variable, so can be executed directly

Parameter Explanation

  • --es_mode: Optional parameter, specify generation mode, supportscodegenandextract_historyIf not specified, defaults to codegen
  • --output_dir: Optional parameter, specify target directory for generation If not specified, defaults to output to current directory
  • --module_name: Optional parameter, control aggregation header file naming
    • "math" -> es_math_ops_c.h, es_math_ops.h, es_math_ops.py
    • "all" -> es_all_ops_c.h, es_all_ops.h, es_all_ops.py
    • Not passed -> defaults to "all"
  • --h_guard_prefix: Optional parameter, control generated header file guard macro prefix, used for possible internal/external operator same-name situation distinction
    • If not specified, use default prefix
    • When specified, concatenate with default prefix
    • python files don't recognize this parameter, same-name scenarios avoid conflict through different paths
  • --exclude_ops: Optional parameter, control operators to exclude from code generation
    • Separate operator names by,
  • --history_registry: Optional parameter, specify historical prototype library directory for code generation
    • If not specified, historical prototype library is not enabled by default
    • When specified, generated C++ interface will include compatible version information in historical prototype library
  • --release_version:
    • Code generation mode: Optional parameter, used with--history_registry, specify current version number, generated C++ interface includes compatible version information for this version; if not specified, generate compatible historical versions based on current date
    • Historical prototype library generation mode: Required parameter, specify version number corresponding to current historical prototype data
  • --release_date: Optional parameter, control release date of historical prototype structured data, formatYYYY-MM-DD
    • If not specified, use current date
  • --branch_name: Optional parameter, control release branch name of historical prototype structured data

Output File Explanation

Code Generation Mode Output
  • es_ _ops_c.h: C interface aggregation header file
  • es_ _ops.h: C++ interface aggregation header file
  • es_ _ops.py: Python interface aggregation file
  • es_<op_type>_c.h: Single operator C interface header file
  • es_<op_type>.cpp: Single operator C interface implementation file
  • es_<op_type>.h: Single operator C++ interface header file
  • es_<op_type>.py: Single operator Python interface file
Historical Prototype Library Generation Mode Output
  • index.json: Version index
  • registry/ /metadata.json: Version metadata
  • registry/ /operators.json: Operator prototype data for that version

Usage Examples

Generate code to current directory, use default module name "all", default guard macro prefix

gen_esb

Generate code to specified directory, use default module name "all", default guard macro prefix

gen_esb --output_dir=./output

Generate code to specified directory, use "math" module name, default guard macro prefix

gen_esb --output_dir=./output --module_name=math

Generate code to specified directory, use "all" module name, default guard macro prefix

gen_esb --output_dir=./output --module_name=all

Generate code to specified directory, use "math" module name, custom guard macro prefix "MY_CUSTOM"

gen_esb --output_dir=./output --module_name=math --h_guard_prefix=MY_CUSTOM

Generate code to specified directory, use "math" module name, custom guard macro prefix "MY_CUSTOM", and exclude Add operator generation

gen_esb --output_dir=./output --module_name=math --h_guard_prefix=MY_CUSTOM --exclude_ops=Add

Generate code to specified directory, use "math" module name, default guard macro prefix, generated C++ interface will include compatible version information filtered based on current date in math historical prototype directory

./gen_esb --output_dir=./output --module_name=math --history_registry=/${CANN_INSTALL_PATH}/cann/opp/history_registry/math

Generate code to specified directory, use "math" module name, default guard macro prefix, generated C++ interface will include historical version information compatible with "8.0.RC2" version in math historical prototype directory

【免费下载链接】geGE(Graph Engine)是面向昇腾的图编译器和执行器,提供了计算图优化、多流并行、内存复用和模型下沉等技术手段,加速模型执行效率,减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力,并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/4 9:47:49

CANN/asc-devkit对齐解压缩加载API

asc_loadalign_unpack_postupdate 【免费下载链接】asc-devkit 本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言&#xff0c;原生支持C和C标准规范&#xff0c;主要由类库和语言扩展层构成&#xff0c;提供多层级API&#xff0c;满足多维场景算子开发诉求。 项目地址…

作者头像 李华
网站建设 2026/7/4 9:47:35

WHAT - AI 资源清单

文章目录AI newsletterAI 工具门户图片1. 常用2. Midjourney3. Stable Diffusion3.1 stable diffusion & controlnet3.2 ComfyUIPPT语音动画AI newsletter The Rundown AI (http://therundown.ai)&#xff1a;订阅超200万&#xff0c;行业第一&#xff0c;每日高密度产业动…

作者头像 李华
网站建设 2026/7/4 9:45:50

企业级AI对话前端部署指南:如何构建安全的SillyTavern 1.18.0系统

企业级AI对话前端部署指南&#xff1a;如何构建安全的SillyTavern 1.18.0系统 【免费下载链接】SillyTavern LLM Frontend for Power Users. 项目地址: https://gitcode.com/GitHub_Trending/si/SillyTavern SillyTavern作为一款面向高级用户的LLM前端界面&#xff0c;提…

作者头像 李华
网站建设 2026/7/4 9:44:40

【亲测免费】 E-Hentai Downloader 使用教程

E-Hentai Downloader 使用教程 1. 项目的目录结构及介绍 E-Hentai Downloader 项目的目录结构如下&#xff1a; E-Hentai-Downloader/ ├── src/ │ ├── e-hentai-downloader.meta.js │ └── e-hentai-downloader.user.js ├── LICENSE ├── README.md目录结构…

作者头像 李华
网站建设 2026/7/4 9:43:59

Crucible在学术研究中的应用:前沿符号验证技术案例分析

Crucible在学术研究中的应用&#xff1a;前沿符号验证技术案例分析 【免费下载链接】crucible Crucible is a library for symbolic simulation of imperative programs 项目地址: https://gitcode.com/gh_mirrors/cr/crucible Crucible作为一款语言无关的符号模拟库&am…

作者头像 李华