HcommChannelNotifyRecordOnThread
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
x |
|
x |
|
x |
For
Function
Sends a synchronization signal and records a Notify on the thread. This API is asynchronous and is mainly used for synchronization between the two ends of a channel.
Prototype
1 | int32_t HcommChannelNotifyRecordOnThread(ThreadHandle thread, ChannelHandle channel, uint32_t remoteNotifyIdx) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
thread |
Input |
Communication thread handle, which is threads returned by the HcclThreadAcquire call. For details, see ThreadHandle. |
channel |
Input |
Communication channel handle, which is channels returned by the HcclChannelAcquire call. For details, see ChannelHandle. |
remoteNotifyIdx |
Input |
Notify index at the remote end of the communication channel. The value range is [0, notifyNum in the channelDescs parameter passed to the HcclChannelAcquire API). |
Returns
int32_t: 0 on success; else, failure.
Restrictions
This API must be used in pair with HcommChannelNotifyWaitOnThread.
For the Atlas 350 Accelerator Card, this API can be called only on the device in AICPU_TS mode.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | // Allocate communication threads. CommEngine engine = CommEngine::COMM_ENGINE_CPU_TS; CommEngine engine = CommEngine::COMM_ENGINE_AICPU_TS; // Configured for the Atlas 350 Accelerator Card uint32_t threadNum = 1; uint32_t notifyNumPerThread = 1; ThreadHandle thread; HcclThreadAcquire(engine, threadNum, notifyNumPerThread, &thread); // Allocate communication channels. uint32_t channelNum = 1; HcclChannelDesc channelDesc; HcclChannelDescInit(&channelDesc, channelNum); HcclComm comm; ChannelHandle channel; HcclChannelAcquire(comm, engine, &channelDesc, channelNum, &channel); // For the Atlas 350 Accelerator Card, the following APIs need to be called on the device: // Notify the remote end. HcommChannelNotifyRecordOnThread(thread, channel, 0); // Data plane operations // ... // Wait for the remote end to notify the local end. uint32_t notifyTimeout = 1800; HcommChannelNotifyWaitOnThread(thread, channel, 0, notifyTimeout); |