CANN/hcomm线程通知记录
HcommThreadNotifyRecordOnThread【免费下载链接】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发送同步信号主要用于多Thread之间的同步等待场景。函数原型int32_t HcommThreadNotifyRecordOnThread(ThreadHandle thread, ThreadHandle dstThread, uint32_t dstNotifyIdx)参数说明参数名输入/输出描述thread输入通信线程句柄为通过HcclThreadAcquire接口获取到的threads。ThreadHandle类型的定义请参见ThreadHandle。dstThread输入目标通信线程句柄为通过HcclThreadAcquire接口获取到的threads。ThreadHandle类型的定义请参见ThreadHandle。dstNotifyIdx输入目标Notify索引。取值范围为[0, HcclThreadAcquire接口传入的notifyNumPerThread参数的值)。返回值int32_t接口成功返回0其他失败。约束说明该接口需要配合HcommThreadNotifyWaitOnThread使用。在 Ascend 950PR/Ascend 950DT 上仅支持 AICPU_TS 模式下、在 Device 侧调用该接口。调用示例HcclComm comm; CommEngine engine COMM_ENGINE_CPU_TS; aclrtStream streams[2]; ThreadHandle threads[2]; // 申请2条流每条流2个Notify aclrtCreateStream(streams[0]); aclrtCreateStream(streams[1]); HcclResult result HcclThreadAcquireWithStream(comm, engine, streams[0], 2, threads[0]); result HcclThreadAcquireWithStream(comm, engine, streams[1], 2, threads[1]); uint32_t notifyIdx 0; // 发送同步信号 HcommThreadNotifyRecordOnThread(threads[0], threads[1], notifyIdx); uint32_t timeout 1; // 等待同步信号 HcommThreadNotifyWaitOnThread(threads[1], notifyIdx, timeout);在 Ascend 950PR/Ascend 950DT 上该函数需要编译到 Device 侧使用HcclComm comm; CommEngine engine COMM_ENGINE_AICPU_TS; ThreadHandle threads[2]; uint32_t notifyNumPerThread 2; HcclThreadAcquire(comm, engine, 1, notifyNumPerThread, threads[0]); HcclThreadAcquire(comm, engine, 1, notifyNumPerThread, threads[1]); // 其余资源申请 // 拷贝参数并 Launch Kernel // Device 侧算法编排 uint32_t notifyIdx 0; // 发送同步信号 HcommThreadNotifyRecordOnThread(threads[0], threads[1], notifyIdx); uint32_t timeout 1; // 等待同步信号 HcommThreadNotifyWaitOnThread(threads[1], notifyIdx, timeout);【免费下载链接】hcommHCOMMHuawei Communication是HCCL的通信基础库提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcomm创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考