CANN/ge ES生成器工具指南
ES (Eager Style) Generator【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/gePrerequisitesProperly installtoolkitpackage through Installation Guide, andcorrectly configure environment variablesaccording to the guideProperly install operatoropspackage through Installation Guide (ES depends on operator prototypes for API generation), andcorrectly configure environment variablesaccording to the guideEnvironment Variable RequirementsList of environment variables required by gen_esb:ASCEND_OPP_PATH: Points to the opp path under installation directoryLD_LIBRARY_PATH: Environment variable specifying dynamic library search pathNote: The above environment variables dont need and are not recommended to be configured separately, the environment variables already configured in Prerequisites by default meet the requirementsFunctionality ExplanationThis program supports two generation modesCode Generation Mode Generate ES graph builder C, C, Python code, including:C interfaces for all supported operators (ops)C interfaces for all supported operatorsPython interfaces for all supported operatorsAggregation header files for convenient one-time inclusion of all operatorsAggregation Python files for convenient one-time import of all operatorsHistorical Prototype Library Generation Mode Generate historical prototype structured data, including:Version indexVersion metadataOperator prototype data for that versionUsage MethodsCode Generation Modegen_esb [--output_dirDIR] [--module_nameNAME] [--h_guard_prefixPREFIX] [--exclude_opsOP_TYPE1,OP_TYPE2] [--history_registryPKG_DIR] [--release_versionVER]Historical Prototype Library Generation Modegen_esb --es_modeextract_history --release_versionVER [--output_dirDIR] [--release_dateYYYY-MM-DD] [--branch_nameBRANCH]Note: Because environment variables have already been configured in Prerequisites,gen_esbhas been added toPATHenvironment variable, so can be executed directlyParameter 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 namingmath - es_math_ops_c.h, es_math_ops.h, es_math_ops.pyall - es_all_ops_c.h, es_all_ops.h, es_all_ops.pyNot 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 distinctionIf not specified, use default prefixWhen specified, concatenate with default prefixpython files dont recognize this parameter, same-name scenarios avoid conflict through different paths--exclude_ops: Optional parameter, control operators to exclude from code generationSeparate operator names by,--history_registry: Optional parameter, specify historical prototype library directory for code generationIf not specified, historical prototype library is not enabled by defaultWhen 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 dateHistorical 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-DDIf not specified, use current date--branch_name: Optional parameter, control release branch name of historical prototype structured dataOutput File ExplanationCode Generation Mode Outputes_ _ops_c.h: C interface aggregation header filees_ _ops.h: C interface aggregation header filees_ _ops.py: Python interface aggregation filees_op_type_c.h: Single operator C interface header filees_op_type.cpp: Single operator C interface implementation filees_op_type.h: Single operator C interface header filees_op_type.py: Single operator Python interface fileHistorical Prototype Library Generation Mode Outputindex.json: Version indexregistry/ /metadata.json: Version metadataregistry/ /operators.json: Operator prototype data for that versionUsage ExamplesGenerate code to current directory, use default module name all, default guard macro prefixgen_esbGenerate code to specified directory, use default module name all, default guard macro prefixgen_esb --output_dir./outputGenerate code to specified directory, use math module name, default guard macro prefixgen_esb --output_dir./output --module_namemathGenerate code to specified directory, use all module name, default guard macro prefixgen_esb --output_dir./output --module_nameallGenerate code to specified directory, use math module name, custom guard macro prefix MY_CUSTOMgen_esb --output_dir./output --module_namemath --h_guard_prefixMY_CUSTOMGenerate code to specified directory, use math module name, custom guard macro prefix MY_CUSTOM, and exclude Add operator generationgen_esb --output_dir./output --module_namemath --h_guard_prefixMY_CUSTOM --exclude_opsAddGenerate 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_namemath --history_registry/${CANN_INSTALL_PATH}/cann/opp/history_registry/mathGenerate 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【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考