HcommChannelGetNotifyNum
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
Function
Obtains the number of Notifies of a specified channel.
Prototype
1 | HcommResult HcommChannelGetNotifyNum(ChannelHandle channelHandle, uint32_t *notifyNum) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
channelHandle |
Input |
Communication channel handle. For details, see ChannelHandle. |
notifyNum |
Output |
Number of Notifies of a specified channel. |
Returns
HcommResult: 0 on success; else, failure.
Restrictions
None
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | // The AICPU engine requires an endpoint of the DEVICE type. EndpointDesc deviceEp = {0}; deviceEp.protocol = COMM_PROTOCOL_ROCE; deviceEp.commAddr.type = COMM_ADDR_TYPE_IP_V4; inet_pton(AF_INET, "192.168.1.10", &deviceEp.commAddr.addr); deviceEp.loc.locType = ENDPOINT_LOC_TYPE_DEVICE; deviceEp.loc.device.devPhyId = 0; deviceEp.loc.device.superPodId = 0; EndpointHandle endpointHandle = nullptr; HcommResult ret = HcommEndpointCreate(&deviceEp, &endpointHandle); if (ret != 0) { printf("Failed to create device endpoint, ret = %d\n", ret); return ret; } // Prepare the channel descriptors. const uint32_t CHANNEL_NUM = 3; HcommChannelDesc channelDescs[CHANNEL_NUM] = {0}; for (uint32_t i = 0; i < CHANNEL_NUM; i++) { // Fill in the remote endpoint information. channelDescs[i].remoteEndpoint.protocol = COMM_PROTOCOL_ROCE; channelDescs[i].remoteEndpoint.commAddr.type = COMM_ADDR_TYPE_IP_V4; char remoteIp[32] = {0}; snprintf(remoteIp, sizeof(remoteIp), "192.168.2.%d", i + 1); inet_pton(AF_INET, remoteIp, &channelDescs[i].remoteEndpoint.commAddr.addr); channelDescs[i].remoteEndpoint.loc.locType = ENDPOINT_LOC_TYPE_DEVICE; channelDescs[i].remoteEndpoint.loc.device.devPhyId = i + 1; channelDescs[i].notifyNum = 32; // RoCE parameters channelDescs[i].roceAttr.queueNum = 16; channelDescs[i].roceAttr.retryCnt = 5; } // Create channels for the AICPU engine. ChannelHandle channels[CHANNEL_NUM] = {0}; ret = HcommChannelCreate(endpointHandle, COMM_ENGINE_AICPU, channelDescs, CHANNEL_NUM, channels); if (ret != 0) { printf("Failed to create AICPU channels, ret = %d\n", ret); HcommEndpointDestroy(endpointHandle); return ret; } uint32_t *notifyNum; ret = HcommChannelGetNotifyNum(channels[0], notifyNum); |
Parent topic: Basic Resource Management