HcommChannelNotifyWaitOnThread

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

x

Atlas training product

x

For Atlas A2 training product/Atlas A2 inference product, only the Atlas 800T A2 training server, Atlas 900 A2 PoD cluster basic unit, and Atlas 200T A2 Box16 heterogeneous subrack are supported.

Function

Waits for a synchronization signal. This API blocks and waits for the thread execution until the specified Notify is completed.

Prototype

1
int32_t HcommChannelNotifyWaitOnThread(ThreadHandle thread, ChannelHandle channel, uint32_t localNotifyIdx, uint32_t timeout)

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.

localNotifyIdx

Input

Local Notify index.

The value range is [0, notifyNum in the channelDescs parameter passed to the HcclChannelAcquire API).

timeout

Input

Timeout interval, in milliseconds.
  • 0: waits forever.
  • > 0: specific timeout interval.

Note: For the Atlas 350 Accelerator Card, the custom timeout function is not supported. The timeout interval is fixed at 1,080,000 ms.

Returns

int32_t: 0 on success; else, failure.

Restrictions

This API must be used in pair with HcommChannelNotifyRecordOnThread.

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);