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

CANN / hcomm 实验性NIC插件指南

HCOMM Experimental NIC Plugin Guide

【免费下载链接】hcommHCOMM(Huawei Communication)是HCCL的通信基础库,提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcomm

Overview

The HCOMM Experimental NIC Plugin extends the host-side NIC communication implementation in general server scenarios. The plugin is built and deployed as an independent.sofile. When creating a HOST endpoint or channel, HCOMM searches for registered plugins based onEndpointDesc.protocol. If a matching plugin protocol is found, the plugin implementation is used. Otherwise, the original built-in implementation is used.

This directory provides two example plugins:

PluginArtifactRegistered Protocol
HOST RoCE pluginlibhcomm_cpu_roce_plugin.soCOMM_PROTOCOL_ROCE
HOST UB pluginlibhcomm_cpu_ub_plugin.soCOMM_PROTOCOL_UBC_TP,COMM_PROTOCOL_UBC_CTP

Building and Packaging

Before compiling, complete the dependency installation, CANN software package installation, and environment variable configuration as described indocs/en/build/build.md.

After navigating to the repository root directory, execute the following command to compile the host package with experimental plugins enabled:

bash build.sh --pkg --experimental

To compile both the host and device packages:

bash build.sh --pkg --full --experimental

If the compilation environment does not have network access, download the third-party dependency packages in a networked environment, upload them to the compilation environment, and specify the dependency package path using--cann_3rd_lib_path:

bash build.sh --pkg --experimental --cann_3rd_lib_path={your_3rd_party_path}

After compilation, the HCOMM software package is generated in thebuild_outdirectory at the repository root:

./build_out/cann-hcomm_<version>_linux-<arch>.run

<version>is the software version number, and<arch>is the system architecture, for example,x86_64oraarch64.

Installation and Deployment

Install the compiled HCOMM software package:

bash ./build_out/cann-hcomm_<version>_linux-<arch>.run --full

Replace the package name in the command with the actual generated file name. After installation, the experimental plugins are installed in the HCOMM plugin directory:

${ASCEND_HOME_PATH}/hcomm_plugin/libhcomm_cpu_roce_plugin.so ${ASCEND_HOME_PATH}/hcomm_plugin/libhcomm_cpu_ub_plugin.so

For manual debugging, you can also copy the plugin.sofiles directly to the${ASCEND_HOME_PATH}/hcomm_plugin/directory.

Signature Verification Notes

Host-only plugin usage does not involve device package signature verification. If you compile and install the--fullpackage and run on-board tests, refer todocs/en/build/build.mdfor the steps to disable signature verification.

Enabling at Runtime

Before running, load the CANN or HCOMM environment variables. For the default installation path, execute:

source /usr/local/Ascend/cann/set_env.sh

For a specified installation path, execute:

source ${install_path}/cann/set_env.sh

The plugin loading rules are as follows:

  • WhenASCEND_HOME_PATHis not empty, HCOMM scans${ASCEND_HOME_PATH}/hcomm_plugin/*.so.
  • WhenASCEND_HOME_PATHis empty, HCOMM reads the plugin path specified byHCOMM_NIC_PLUGIN_SO.
  • HCOMM_NIC_PLUGIN_SOsupports multiple.sopaths separated by colons.

Example:

export HCOMM_NIC_PLUGIN_SO=/path/to/libhcomm_cpu_roce_plugin.so:/path/to/libhcomm_cpu_ub_plugin.so

Business code does not need to call plugin interfaces directly. When HCOMM creates a HOST endpoint throughHcommEndpointCreate, it searches for plugins based onEndpointDesc.protocol. If the protocol is registered by a plugin, subsequent endpoint, channel, and data plane interfaces are dispatched to the pluginops. If no matching plugin is found, the original built-in path is used.

Usage Conditions and Limitations

  • The plugin only applies to endpoints whereEndpointDesc.loc.locType == ENDPOINT_LOC_TYPE_HOST.
  • The current example plugins target general server host-only scenarios.
  • The current loader skips plugin loading when it detects that the number of runtime devices is non-zero.
  • When multiple plugins register the same protocol, the later-loaded plugin overrides the earlier one.
  • The plugin ABI must match the magic word, version, and size defined inHcommNicPluginInfo,HcommNicEndpointOps, andHcommNicChannelOps.

Custom Plugin Development Entry Points

Custom plugins need to export the following C ABI symbols:

const HcommNicPluginInfo *HcommNicPluginGetInfo(void); int32_t HcommNicPluginCreateEndpoint( const EndpointDesc *endpointDesc, void **outCtx, HcommNicEndpointOps **outOps); int32_t HcommNicPluginCreateChannel( void *epCtx, const HcommChannelDesc *channelDesc, void **outCtx, HcommNicChannelOps **outOps);

Development requirements:

  • Declare the plugin name and supportedCommProtocolinHcommNicPluginInfo.
  • FillHcommNicEndpointOpsfor the endpoint, implementing interfaces such as initialization, memory registration, export, import, and destroy.
  • FillHcommNicChannelOpsfor the channel, implementing interfaces such as initialization, status query, read, write, notify, fence, and destroy.
  • Ensure the magic word, version, and size in the ABI header match the definitions inhcomm_nic_plugin.h.

For reference, see the following files:

  • host_roce_plugin.cc: HOST RoCE plugin entry point.
  • host_ub_plugin.cc: HOST UB plugin entry point.
  • nic_plugin_ops.h: Example plugin ops adaptation template.
  • plugin_core.cc: Plugin common auxiliary logic.

Troubleshooting

If the plugin does not take effect, check the following items in order:

  1. Confirm that--experimentalwas added during the build and that the plugin.sois included in the software package.
  2. Confirm that the plugin.sois installed in${ASCEND_HOME_PATH}/hcomm_plugin/.
  3. Confirm thatASCEND_HOME_PATHorHCOMM_NIC_PLUGIN_SOis set according to the current loading rules.
  4. Confirm that the business creates a HOST endpoint, that is,EndpointDesc.loc.locType == ENDPOINT_LOC_TYPE_HOST.
  5. Confirm thatEndpointDesc.protocolis registered in the pluginHcommNicPluginInfo.protocols.
  6. Check the runtime log for the[NicPlugin]keyword to see whether the plugin was scanned, loaded, and its protocol registered.

【免费下载链接】hcommHCOMM(Huawei Communication)是HCCL的通信基础库,提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcomm

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

http://www.cnnetsun.cn/news/3393975.html

相关文章:

  • 如何快速上手openEuler/embedded?零基础入门到编译镜像的完整指南
  • SM320C6748-HIREL串行通信外设深度解析:I2C、UART与USB2.0 OTG寄存器级实战
  • 模板驱动文档自动化:从填空题到内容工业化
  • [ 网络协议篇 ] vlan 详解之 vlan if 实战:从二层隔离到三层互通的网关配置
  • 彻底解决C++运行库安装错误代码5:从原理到实战的完整指南
  • CVE-2019-11043:从PATH_INFO空值到PHP-FPM内存下溢的RCE漏洞深度剖析
  • 如何迁移Intero配置到新工具?无缝过渡Haskell开发环境指南
  • 对偶单纯形法:从理论到实践,解锁线性规划的高效求解新视角
  • Jido运行时模式选择指南:何时使用SpawnAgent、InstanceManager或Pod
  • Ornith-1.0-35B-3bit与主流VLM对比:为什么选择3位量化方案
  • 小米智能音箱Pro技术解析:硬件架构、语音交互与智能家居应用
  • Elasticsearch IK分词器实战:从基础配置到高级自定义与集群部署
  • 掌握LTX2.3-22B_IC-LoRA-CrossView-Prompt提示词:63个有效组合让你的视频视角随心变
  • 软件工程中的可行性分析:从理论到实践的全景指南
  • CANN/Ascend C数据类型转换API
  • STM32 HAL库 PWM+DMA 驱动WS2812B彩灯:从移植到动画效果实战(STM32F030F4P6)
  • Jetson TK1系统检查五层诊断指南:从硬件通断到CUDA就绪
  • Jido持久化存储指南:ETS、Redis和文件存储配置
  • Tomcat 高危漏洞深度剖析与实战复现
  • Blender3mfFormat:3D打印工作流的完美解决方案,让Blender支持3MF格式
  • CANN广播OneDim优化
  • CANN/asc-devkit 整型转浮点函数
  • 终极窗口置顶神器:3分钟掌握AlwaysOnTop,工作效率提升200%
  • 分水岭算法优化:解决过分割问题的常用方法
  • 运动控制器G代码自定义功能在非标自动化设备中的集成应用
  • Jido生态系统解析:req_llm、jido_ai等配套工具使用指南
  • IDEA+Maven构建SpringMVC Web项目:从零到部署的完整指南
  • 从故障定位到闭环改进:构建高效失效分析体系的实践指南
  • Cocos Creator游戏开发:关卡管理与地图操作实战指南
  • 《凌微经》助读·通俗版——宇宙为什么“停不下来”?