当前位置: 首页 > news >正文

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),仅供参考

http://www.jsqmd.com/news/1120996/

相关文章:

  • 计算机毕业设计之jsp浪淘音乐网站的设计与实现
  • 高性能计算之OpenMP——超算习堂学习2
  • 如何高效使用智能技能管理工具:开发者的完全实战指南
  • HsMod终极指南:高效自定义你的炉石传说游戏体验
  • gprMax项目代码分解:理解 gprMax的项目结构、运行主线与开发模块
  • MZmine 3终极指南:如何免费快速处理质谱数据的完整解决方案
  • Slash实战案例:从代码示例到真实项目,教你如何优雅实现复杂富文本界面
  • EFCore 反向工程
  • 自定义View之文字测量原理与文字特效实现
  • AI 学习路径推荐:别把薄弱点变成焦虑清单
  • PoseDiffusion部署实战:从本地测试到生产环境的完整指南
  • DocStrap社区贡献指南:如何参与项目开发与问题修复
  • 线性回归最小二乘法 Python 3.12 实现:从公式推导到 15 行核心代码
  • 省时省力!德国宣誓翻译驾照认证件去哪办?24小时出件全攻略
  • cdc同步工具
  • AI大模型驱动自动化测试:从原理到落地的全链路实践指南
  • nginx模块以及反向代理配置
  • 【Java课程设计/毕业设计】基于 SpringBoot 的数字科技风险报告管理系统的设计与实现智能化科技风险报告编制与溯源管理系统【附源码、数据库、万字文档】
  • 5分钟掌握163MusicLyrics:让每首歌都有完美歌词的终极解决方案
  • 从0到1打造终端工作流:gh_mirrors/do/dotfiles-archive的插件与主题安装教程
  • JoyAI-Image-Edit-Plus参数优化指南:30步出图+CFG=4.0,效果提升300%的秘密
  • Tabled API集成指南:如何将表格提取功能嵌入到你的应用中
  • Micro Journal Rev.7电子墨水屏版本:护眼写作的革命性突破
  • 融云「北极星」数据监控平台:数据可视通晓全局,精准分析定位问题
  • Auto Playwright:用自然语言驱动AI自动化测试,提升测试效率与健壮性
  • Instatic媒体批量上传:拖放功能与进度监控的终极指南
  • Android Debug Bridge (ADB) v1.0.41
  • 协议之RTCP介绍
  • readpe高级用法:CSV/XML/HTML输出格式定制与自动化分析技巧
  • postcss-write-svg与构建工具集成:Gulp/Grunt/PostCSS配置教程