CANN/hccl自定义通信算子AllGather

发布时间:2026/7/8 5:33:51

CANN/hccl自定义通信算子AllGather
Custom Communication Operator - AllGather【免费下载链接】hccl集合通信库Huawei Collective Communication Library简称HCCL是基于昇腾AI处理器的高性能集合通信库为计算集群提供高性能、高可靠的通信方案项目地址: https://gitcode.com/cann/hcclSample DescriptionThis sample demonstrates how to develop an AllGather communication operator based on the HCCL communication programming interface. It covers the following features:Implement an AllGather collective communication operator based on the CCU_SCHED communication engine.Support independent building and deployment of custom operator packages.Directory Structure├── CMakeLists.txt # Compilation and build configuration file ├── op_host/ | ├── allgather.cc # HcclAllGatherCustom operator implementation source file | ├── utils.cc # Utility module (channel acquisition, thread acquisition, Kernel registration) | └── utils.h # Utility module header file ├── op_kernel_ccu/ | ├── ccu_kernel.cc # CCU Kernel implementation logic | ├── ccu_kernel.h # CCU Kernel header file | ├── exec_op.cc # CCU operator orchestration logic | └── exec_op.h # CCU operator orchestration header file ├── inc/ | ├── hccl_custom_allgather.h # Custom AllGather operator interface header file | ├── common.h # Common type header file | └── log.h # Log macro definitions └── testcase/ ├── main.cc # Sample implementation source file └── Makefile # Compilation and build configuration fileThe custom operator compilation project depends on the cmake configuration and the build.sh compilation script in the HCCL repository.cmake contains CMake configuration, MakeSelf packaging configuration, and so on.build.sh is the compilation entry for the project.1. Environment Preparation1.1 Environment RequirementsThis sample supports the following Ascend products in a single-server N-card configuration (N 2):Ascend 950PR / Ascend 950DTThe following software dependencies are required for compiling this sample. Ensure that the version requirements are met:gcc and g 7.3.0cmake 3.16.01.2 Install the CANN Toolkit Development Kit PackageRefer to the Ascend Documentation Center - CANN Software Installation Guide to install the CANN Toolkit development kit package version 9.1.0 that matches the sample.The installation supports both default path and specified path installation:Default path installation: Do not specify the--install-pathparameter. After installation, the software is located at/usr/local/Ascend(root user) or${HOME}/Ascend(non-root user).Specified path installation: Use the--install-pathparameter to specify the installation directory. After installation, the software is located at${install_path}. Use this path for subsequent compilation and environment variable configuration.# Ensure the installation package has executable permissions chmod x Ascend-cann-toolkit_${cann_version}_linux-${arch}.run # Default path installation ./Ascend-cann-toolkit_${cann_version}_linux-${arch}.run --install # Specified path installation (replace ${install_path} with the actual installation directory) # ./Ascend-cann-toolkit_${cann_version}_linux-${arch}.run --install --install-path${install_path}1.3 Configure Environment VariablesAfter installing the CANN Toolkit development kit package, select the corresponding environment variable configuration command based on the installation method to apply the environment variables.# Default path installation, using the root user as an example (for non-root users, replace /usr/local with ${HOME}) source /usr/local/Ascend/cann/set_env.sh # Specified path installation. ${install_path} indicates the actual CANN-Toolkit package installation path. # source ${install_path}/cann/set_env.shset_env.shis an environment initialization script that configures environment variables such as PATH, LD_LIBRARY_PATH, and PYTHONPATH, enabling the compiler and runtime to correctly find the Ascend NPU toolchain, library files, and operator libraries.2. Compiling the Custom Operator PackageThe HCCL repository provides a custom operator compilation and packaging project. This project depends on the following files in the repository:├── build.sh # Compilation entry in the hccl repository root directory ├── CMakeLists.txt # Compilation and build configuration file in the hccl repository root directory ├── cmake/ | ├── config.cmake # CMake variable definitions | ├── func.cmake # CMake function definitions | ├── package.cmake # Signature and packaging function definitions | └── makeself_custom.cmake # MakeSelf packaging logic └── scripts/ ├── custom/install.sh # Custom operator package installation script └── sign/add_header_sign.py # Operator package signing scriptTherefore, developers first need to download the hccl repository, then runbuild.shfrom the repository root directory for compilation, specifying the custom operator project path usingcustom_ops_path:# Download the hccl repository git clone https://gitcode.com/cann/hccl.git # Compile the custom operator package cd hccl bash build.sh --vendorcust --opsallgather_ccu --custom_ops_path./examples/05_custom_ops_allgather/ccuWhere:--vendorspecifies the custom operator identifier.--opsspecifies the custom operator name.--custom_ops_pathspecifies the custom operator project path.3. Installing the Custom Operator PackageThe custom operator installation package is located in the./build_outdirectory. Install it using the--installparameter:./build_out/cann-hccl_custom_allgather_ccu_linux-arch.run --install --install-pathascend_cann_pathWhere:archis the system architecture of the current compilation environment.ascend_cann_pathis an optional parameter indicating the CANN software package installation directory. The default value is the CANN software package path where theASCEND_CUSTOM_OPP_PATHorASCEND_OPP_PATHenvironment variable is located.The custom operator package installation information is as follows:Header file:${ASCEND_HOME_PATH}/opp/vendors/cust/include/hccl_custom_allgather.hDynamic library:${ASCEND_HOME_PATH}/opp/vendors/cust/lib64/libhccl_custom_allgather.so${ASCEND_HOME_PATH}is the CANN-Toolkit installation path.4. Running the Custom Operator4.1 Compile the Test SampleRun the following commands in theexamples/05_custom_ops_allgather/ccu/testcasedirectory:# Compile the test sample make4.2 Run the Test SampleRun the following commands in theexamples/05_custom_ops_allgather/ccu/testcasedirectory:# Run the test sample make test # Or run the sample binary directly export LD_LIBRARY_PATH${ASCEND_HOME_PATH}/opp/vendors/cust/lib64:${LD_LIBRARY_PATH} ./custom_allgather_ccu4.3 Sample OutputThe input data of all nodes is initialized to the Device ID of that node. After successful execution, the terminal displays log output similar to the following (using 2 cards as an example):Found 2 NPU device(s) available rankId: 1, input: [ 1 ] rankId: 0, input: [ 0 ] rankId: 0, output: [ 0 1 ] rankId: 1, output: [ 0 1 ]【免费下载链接】hccl集合通信库Huawei Collective Communication Library简称HCCL是基于昇腾AI处理器的高性能集合通信库为计算集群提供高性能、高可靠的通信方案项目地址: https://gitcode.com/cann/hccl创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

相关新闻

TestNG入门指南:从零搭建Java自动化测试框架

TestNG入门指南:从零搭建Java自动化测试框架

2026/7/8 4:00:18

1. 项目概述:为什么选择TestNG作为你的第一个测试框架?如果你刚开始接触Java自动化测试,面对JUnit、TestNG这些名词可能有点懵。我刚开始做测试开发那会儿,也纠结过到底该从哪个入手。后来在多个实际项目中摸爬滚打,发…

CANN Task A 产出验证

CANN Task A 产出验证

2026/7/7 13:32:28

Task A 产出验证 【免费下载链接】cannbot-skills CANNBot 是面向 CANN 开发的用于提升开发效率的系列智能体,本仓库为其提供可复用的 Skills 模块。 项目地址: https://gitcode.com/cann/cannbot-skills 校验 S2P1_path_list.json 中对源码的声明是否真实。…

NCSN模型架构详解:ConvResBlock与DeconvResBlock的设计艺术

NCSN模型架构详解:ConvResBlock与DeconvResBlock的设计艺术

2026/7/8 12:49:42

NCSN模型架构详解:ConvResBlock与DeconvResBlock的设计艺术 【免费下载链接】ncsn Noise Conditional Score Networks (NeurIPS 2019, Oral) 项目地址: https://gitcode.com/gh_mirrors/nc/ncsn Noise Conditional Score Networks (NCSN) 是NeurIPS 2019的口…

3 款主流反作弊软件报错对比:EAC 30005、BattlEye、VAC 的成因与修复差异

3 款主流反作弊软件报错对比:EAC 30005、BattlEye、VAC 的成因与修复差异

2026/7/8 20:19:03

主流游戏反作弊系统报错深度解析:EAC、BattlEye与VAC的故障处理指南当你在深夜终于结束工作,准备打开心爱的游戏放松片刻,却遭遇"Error 30005: Create File Failed With 32"的冰冷提示——这种挫败感每位PC玩家都深有体会。反作弊系…

ASP.NET/PHP/JSP 3大平台Cookie注入防御:从Request对象到参数化查询

ASP.NET/PHP/JSP 3大平台Cookie注入防御:从Request对象到参数化查询

2026/7/8 20:19:03

ASP.NET/PHP/JSP 3大平台Cookie注入防御:从Request对象到参数化查询在Web应用开发中,安全性始终是开发者需要面对的首要挑战之一。Cookie注入作为一种特殊的SQL注入形式,往往因为其隐蔽性而被开发者忽视。本文将深入探讨ASP.NET、PHP和JSP三大…

如何用FanControl彻底告别电脑风扇噪音,实现智能温控?

如何用FanControl彻底告别电脑风扇噪音,实现智能温控?

2026/7/8 20:19:03

如何用FanControl彻底告别电脑风扇噪音,实现智能温控? 【免费下载链接】FanControl.Releases This is the release repository for Fan Control, a highly customizable fan controlling software for Windows. 项目地址: https://gitcode.com/GitHub_…

Magisk 27.0 后 Root 环境隐藏:Shamiko 与 Zygisk 配置的 3 种实战方案对比

Magisk 27.0 后 Root 环境隐藏:Shamiko 与 Zygisk 配置的 3 种实战方案对比

2026/7/8 20:19:03

Magisk 27.0后Root环境隐藏:Shamiko与Zygisk的三种高阶配置方案实测 当手机成功获取Root权限后,许多金融类应用和游戏会检测到Root环境并拒绝运行。这给需要Root功能又不想放弃日常应用的用户带来了困扰。本文将深入分析三种主流的Root隐藏方案&#xff…

羽球联盟 HarmonyOS NEXT 实战系列 (19/20):构建、静态检查与质量门禁

羽球联盟 HarmonyOS NEXT 实战系列 (19/20):构建、静态检查与质量门禁

2026/7/8 20:19:03

文章导读 一个 HarmonyOS 工程能不能交付,不能只看“代码写完了没有”,还要看构建、模块、权限和关键路径是否闭合。构建成功只是底线,不是结论;首页能打开、详情能进入、设置能生效,才说明应用真的站住了。对系列文章…

Android APP 加固壳识别实战:5大厂商特征与3款检测工具对比

Android APP 加固壳识别实战:5大厂商特征与3款检测工具对比

2026/7/8 20:09:02

Android APP加固壳识别实战:5大厂商特征与3款检测工具深度评测 在移动应用安全领域,加固技术如同给APP穿上防弹衣,而逆向工程师则需要具备"透视眼"的能力。本文将聚焦Android加固壳的实战识别技巧,通过解构主流厂商的技…

解锁AMD Ryzen处理器深层性能:SMU Debug Tool完全指南

解锁AMD Ryzen处理器深层性能:SMU Debug Tool完全指南

2026/7/8 0:44:47

解锁AMD Ryzen处理器深层性能:SMU Debug Tool完全指南 【免费下载链接】SMUDebugTool A dedicated tool to help write/read various parameters of Ryzen-based systems, such as manual overclock, SMU, PCI, CPUID, MSR and Power Table. 项目地址: https://gi…

6个月转型AI工程师:实战路径与核心技能

6个月转型AI工程师:实战路径与核心技能

2026/7/8 6:29:42

1. 项目概述:6个月转型AI工程师的可行性路径在2023年大模型技术爆发的背景下,AI工程师岗位需求同比增长217%(LinkedIn数据)。不同于传统算法工程师需要3-5年培养周期,现代AI工程师更侧重工程化落地能力。我在硅谷科技公…

YOLOv5模型剪枝与量化实战:边缘设备部署优化

YOLOv5模型剪枝与量化实战:边缘设备部署优化

2026/7/8 14:04:34

1. 项目背景与核心价值在计算机视觉领域,YOLOv5因其出色的实时检测性能成为工业界宠儿。但当我们尝试将其部署到边缘设备(如树莓派、Jetson Nano或手机终端)时,立刻会遇到两个致命问题:模型体积庞大(原始YO…

Qwen Code+Obsidian构建可执行的AI时代认知操作系统

Qwen Code+Obsidian构建可执行的AI时代认知操作系统

2026/7/8 0:07:15

1. 项目概述:这不是又一个笔记软件教程,而是一套可复用的“认知操作系统”搭建逻辑你有没有试过,在读完Andrej Karpathy那篇著名的《Software 2.0》之后,满脑子都是“神经网络即代码”的震撼,但合上网页,打…

校园服饰细分赛道测算程序,学生平价国风,机能穿搭市场规模预估。

校园服饰细分赛道测算程序,学生平价国风,机能穿搭市场规模预估。

2026/7/8 0:07:15

校园服饰细分赛道测算程序(Python)——学生平价国风 & 机能穿搭市场规模预估(TAM / SAM / SOM)一、实际应用场景描述(真实业务抽象)在《时尚产业与品牌创新》课程中,细分市场切入&#xff0…

Visual C++运行库完整解决方案:告别软件兼容性问题

Visual C++运行库完整解决方案:告别软件兼容性问题

2026/7/8 0:07:15

Visual C运行库完整解决方案:告别软件兼容性问题 【免费下载链接】vcredist AIO Repack for latest Microsoft Visual C Redistributable Runtimes 项目地址: https://gitcode.com/gh_mirrors/vc/vcredist 你是否曾为打开游戏时弹出的"DLL缺失"错误…