CANN hcomm通道通知线程等待
HcommChannelNotifyWaitOnThread【免费下载链接】hcommHCOMMHuawei Communication是HCCL的通信基础库提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcomm产品支持情况Ascend 950PR/Ascend 950DT支持Atlas A3 训练系列产品/Atlas A3 推理系列产品支持Atlas A2 训练系列产品/Atlas A2 推理系列产品支持[!NOTE]说明 针对Atlas A2 训练系列产品/Atlas A2 推理系列产品仅支持Atlas 800T A2 训练服务器、Atlas 900 A2 PoD 集群基础单元、Atlas 200T A2 Box16 异构子框。功能说明等待同步信号阻塞等待Thread的运行直到指定的Notify完成。函数原型int32_t HcommChannelNotifyWaitOnThread(ThreadHandle thread, ChannelHandle channel, uint32_t localNotifyIdx, uint32_t timeout)参数说明参数名输入/输出描述thread输入通信线程句柄为通过HcclThreadAcquire接口获取到的threads。ThreadHandle类型的定义可参见ThreadHandle。channel输入通信通道句柄为通过HcclChannelAcquire接口获取到的channels。ChannelHandle类型的定义可参见ChannelHandle。localNotifyIdx输入本地Notify索引。取值范围[0, HcclChannelAcquire接口传入的channelDescs参数中的notifyNum)。timeout输入超时时间单位毫秒。- 0表示永久等待。- 0配置的具体超时时间。说明针对 Ascend 950PR/Ascend 950DT 暂不支持自定义超时功能固定为 1080000 毫秒。返回值int32_t接口成功返回0其他失败。约束说明该接口需要配合HcommChannelNotifyRecordOnThread使用。在 Ascend 950PR/Ascend 950DT 上仅支持 AICPU_TS 模式下、在 Device 侧调用该接口。调用示例// 申请通信线程资源 CommEngine engine CommEngine::COMM_ENGINE_CPU_TS; CommEngine engine CommEngine::COMM_ENGINE_AICPU_TS; // Ascend 950PR/Ascend 950DT时配置 uint32_t threadNum 1; uint32_t notifyNumPerThread 1; ThreadHandle thread; HcclThreadAcquire(engine, threadNum, notifyNumPerThread, thread); // 申请通信通道资源 uint32_t channelNum 1; HcclChannelDesc channelDesc; HcclChannelDescInit(channelDesc, channelNum); HcclComm comm; ChannelHandle channel; HcclChannelAcquire(comm, engine, channelDesc, channelNum, channel); // 针对Ascend 950PR/Ascend 950DT需要在 Device 侧调用以下接口 // 通知对端 HcommChannelNotifyRecordOnThread(thread, channel, 0); // 数据面操作 // ... // 等待对端通知本端 uint32_t notifyTimeout 1800; HcommChannelNotifyWaitOnThread(thread, channel, 0, notifyTimeout);【免费下载链接】hcommHCOMMHuawei Communication是HCCL的通信基础库提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcomm创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考