HcommChannelGetStatus
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
Function
Query the status of communication channels in batches. This API is used to check whether the channels are ready after they are created and before communication operations are performed.
This API uses the polling mechanism. The caller needs to continuously call this API until all channels return the READY state.
This API is mainly used for synchronization in the channel connection establishment phase.
Prototype
1 | HcommResult HcommChannelGetStatus(const ChannelHandle *channelList, uint32_t listNum, int32_t *statusList); |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
channelList |
Input |
Handle array of channels whose status is to be queried. Each element identifies a created communication channel. For details, see ChannelHandle. This parameter cannot be a null pointer. Each channel handle in the array must be a valid handle created by HcommChannelCreate. |
listNum |
Input |
Number of channels to be queried. Value range: [1, 1048576]. The value must be greater than 0. |
statusList |
Output |
Channel status array, which is used to return the current status of each channel, corresponding to each channel in channelList. This parameter cannot be a null pointer. The array allocated by the caller must contain at least listNum elements. |
Returns
HcommResult: 0 on success; else, failure.
Restrictions
- The length of the channelList array must be the same as that of the listNum parameter.
- statusList[i] corresponds to channelList[i], indicating the status of the ith channel.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | uint32_t channelNum = 50; std::vector<ChannelHandle> channels(channelNum); // Create a channel by referring to HcommChannelCreate. ... uint32_t timeOut = 0; while (timeOut < 1000) { CHK_RET(HcommChannelGetStatus(channels, channelNum, statuses)); result = 0; for (int i = 0; i < channelNum; i++) { result |= statuses[i]; } if (result == 0) {break;} timeOut += 10; } // Channels are ready, and the communication operation is performed. // ... |