CANN/hcomm多线程通信器示例 Communicator Management - One NPU Device per Thread【免费下载链接】hcommHCOMMHuawei Communication是HCCL的通信基础库提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcommSample OverviewThis sample demonstrates how to use theHcclCommInitRootInfoConfig()API to initialize a communicator in a single process, with each thread managing one NPU device. It covers the following features:Device detection: Query the number of available devices using theaclrtGetDeviceCount()API.Use rank0 as the root node and generate rootinfo identification information through theHcclGetRootInfo()API.The rootinfo identification information mainly includes the Device IP, Device ID, and so on. This information must be broadcast to all ranks in the cluster to initialize the communicator.Initialize the communicator in each thread based on the rootinfo identification information using theHcclCommInitRootInfoConfig()API.Call theHcclAllReduce()operator and print the results.Directory Structure├── main.cc # Sample source file ├── Makefile # Build or configuration file └── one_device_per_pthread # Compiled executableEnvironment PreparationRequirementsThis sample supports the following products:Ascend 950PR / Ascend 950DTAtlas A3 training series products / Atlas A3 inference series productsAtlas A2 training series productsAtlas training series products / Atlas inference series productsSoftware DependenciesRunning this sample requires the CANN ops operator package to be installed. For detailed installation steps, see the Install the CANN Software Package section in Source Code Build.Disabling Signature VerificationThecann-hcomm_version_linux-arch.runsoftware package generated from this source repository contains the following tar.gz subpackages:cann-hcomm-compat.tar.gz: HCOMM compatibility upgrade package.cann-hccd-compat.tar.gz: DataFlow compatibility upgrade package.aicpu_hcomm.tar.gz: AI CPU communication base package.These tar.gz packages are loaded to the Device when the service starts. During the loading process, the driver performs security signature verification by default to ensure the package is trusted. Because the tar.gz packages compiled from this source repository do not contain a signature header, the driver security signature verification mechanism needs to be disabled. For the method to disable signature verification, refer to the Disable Signature Verification section in Source Code Build.Configuring Environment Variables# Set CANN environment variables, using the root user default installation path as an example source /usr/local/Ascend/cann/set_env.shCompiling and Running the SampleExecute the following commands in the sample code directory:make make testNote: You can set theHCCL_OP_EXPANSION_MODEenvironment variable to configure the expansion mode of communication operators. For the range supported by different product models, refer to the usage of this environment variable in the Environment Variable List.# Set the expansion mode of communication operators to AI CPU communication engine export HCCL_OP_EXPANSION_MODEAI_CPUSample OutputThe data for each rank is initialized to 0 to 7. After the AllReduce operation, the result for each rank is the sum of the data at the corresponding positions across all ranks (the data from 8 ranks is summed).Found 8 NPU device(s) available rankId: 0, output: [ 0 8 16 24 32 40 48 56 ] rankId: 1, output: [ 0 8 16 24 32 40 48 56 ] rankId: 2, output: [ 0 8 16 24 32 40 48 56 ] rankId: 3, output: [ 0 8 16 24 32 40 48 56 ] rankId: 4, output: [ 0 8 16 24 32 40 48 56 ] rankId: 5, output: [ 0 8 16 24 32 40 48 56 ] rankId: 6, output: [ 0 8 16 24 32 40 48 56 ] rankId: 7, output: [ 0 8 16 24 32 40 48 56 ]【免费下载链接】hcommHCOMMHuawei Communication是HCCL的通信基础库提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcomm创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

相关新闻

最新新闻

智能照明系统安全风险分析与防御实战

智能照明系统安全风险分析与防御实战

1. 照明系统入侵:一个被忽视的安全盲区上周和几位工业控制系统安全工程师喝咖啡时,他们提到一个令人不安的发现:某大型商业综合体的智能照明系统被入侵,攻击者通过调暗走廊灯光制造了多起安全事故。这让我意识到,大多数…

2026/7/15 10:24:21
NS-USBLoader:Switch玩家的免费跨平台终极文件管理工具

NS-USBLoader:Switch玩家的免费跨平台终极文件管理工具

NS-USBLoader:Switch玩家的免费跨平台终极文件管理工具 【免费下载链接】ns-usbloader Awoo Installer and GoldLeaf uploader of the NSPs (and other files), RCM payload injector, application for split/merge files. 项目地址: https://gitcode.com/gh_mirr…

2026/7/15 10:24:21
Windows Cleaner深度解析:Python驱动的系统优化工具完全指南

Windows Cleaner深度解析:Python驱动的系统优化工具完全指南

Windows Cleaner深度解析:Python驱动的系统优化工具完全指南 【免费下载链接】WindowsCleaner Windows Cleaner——专治C盘爆红及各种不服! 项目地址: https://gitcode.com/gh_mirrors/wi/WindowsCleaner Windows Cleaner是一款基于Python和PyQt5…

2026/7/15 10:24:21
探索Windows DLL注入新维度:Xenos注入器的5大核心能力解析

探索Windows DLL注入新维度:Xenos注入器的5大核心能力解析

探索Windows DLL注入新维度:Xenos注入器的5大核心能力解析 【免费下载链接】Xenos Windows dll injector 项目地址: https://gitcode.com/gh_mirrors/xe/Xenos 你是否曾面临这样的技术困境:需要在运行时动态修改Windows应用程序的行为&#xff0c…

2026/7/15 10:24:21
PYNQ-Z2开发板开箱与Python可编程逻辑开发指南

PYNQ-Z2开发板开箱与Python可编程逻辑开发指南

1. PYNQ-Z2开发板开箱初体验第一次拿到PYNQ-Z2开发板时,这个巴掌大小的板子给我的第一印象是"麻雀虽小,五脏俱全"。板载的Xilinx Zynq-7000 SoC芯片在黑色PCB板上格外醒目,四周整齐排列着各种接口和扩展槽。作为一款主打Python可编…

2026/7/15 10:24:21
RobotStudio 2023安装避坑指南:工业机器人仿真与ROS 2集成实战

RobotStudio 2023安装避坑指南:工业机器人仿真与ROS 2集成实战

1. 项目概述:为什么RobotStudio 2023值得你花两小时认真装一遍RobotStudio 2023不是又一个“点下一步就能完事”的普通软件,它是ABB工业机器人工程师日常工作的数字孪生工作台——你拖拽一个机械臂模型,它就实时反馈关节力矩极限;…

2026/7/15 10:19:20

月新闻