
Directory Structure【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge├── 01_udf_add │ ├── CMakeLists.txt │ └── add_flow_func.cpp Single func interface definition of add function ├── 02_udf_call_add_nn │ ├── CMakeLists.txt │ └── call_nn_flow_func.cpp UDF calls tensorflow model ├── 03_udf_add_multi_func │ ├── CMakeLists.txt │ └── add_flow_func.cpp Multi-Func interface definition of add function ├── 04_control_func │ ├── CMakeLists.txt │ └── control_func.cpp Activates one of the multi funcs defined in 03 according to input └── README.mdDevelopment Guide01_udf_add and 02_udf_call_add_nn are single func call samples.Include external header file meta_flow_func.hDefine processing class, public inheritance from MetaFlowFunc base class, overload Init and Proc functionsInit function performs initialization actions, such as variable initialization, attribute acquisition, etc. UDF framework will call this function during initialization phaseProc contains user-defined computation processing logic. UDF framework will call this function after receiving input dataUDF registration, implemented through REGISTER_FLOW_FUNC macro to map class declaration to user-defined UDF function name, and register to UDF framework. For example:EGISTER_FLOW_FUNC(call_nn, CallNnFlowFunc);call_nn: User-defined UDF function nameCallNnFlowFunc: Actual executing class name, needs to be consistent with class name in cpp file03_udf_add_multi_func and 04_control_func are multi-func call samplesInclude external header file meta_multi_func.hDefine processing class, public inheritance from MetaMultiFunc base class, overload Init and Proc functionsInit function performs initialization actions, such as variable initialization, attribute acquisition, etc. UDF framework will call this function during initialization phaseProc contains user-defined computation processing logic. UDF framework will call this function after receiving input data. Multiple proc functions can be definedUDF registration, implemented through FLOW_FUNC_REGISTRAR macro to map class declaration to user-defined UDF function name, and register to UDF framework. For example:FLOW_FUNC_REGISTRAR(AddFlowFunc).RegProcFunc(Proc1, AddFlowFunc::Proc1).RegProcFunc(Proc2, AddFlowFunc::Proc2);Compilation GuideAfter UDF function development is completed, you can use the following compilation instructions to check whether CMakeLists file and cpp source code have any issues.source {HOME}/Ascend/cann/set_env.sh #{HOME} is the CANN software package installation directory, please replace according to the actual installation path # T ake 01_udf_add as an example cd 01_udf_add mkdir build cd build # If host is x86, compile x86 type so cmake -S .. -DTOOLCHAINg -DRELEASE../release -DRESOURCE_TYPEx86 -DUDF_TARGET_LIBudf # If host is arm, compile arm type so cmake -S .. -DTOOLCHAINg -DRELEASE../release -DRESOURCE_TYPEAarch -DUDF_TARGET_LIBudf # If compiling Ascend type so, need to specify g in the environment where cann package is installed cmake -S .. -DTOOLCHAIN$ASCEND_HOME_PATH/toolkit/toolchain/hcc/bin/aarch64-target-linux-gnu-g -DRELEASE_DIR../release -DRESOURCE_TYPEAscend -DUDF_TARGET_LIBudf make -j 64【免费下载链接】geGEGraph Engine是面向昇腾的图编译器和执行器提供了计算图优化、多流并行、内存复用和模型下沉等技术手段加速模型执行效率减少模型内存占用。 GE 提供对 PyTorch、TensorFlow 前端的友好接入能力并同时支持 onnx、pb 等主流模型格式的解析与编译。项目地址: https://gitcode.com/cann/ge创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考