|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
☓ |
|
|
√ |
|
|
√ |
For
For the
This API needs to be called only on the root rank before the HCCL initialization API HcclCommInitRootInfo or HcclCommInitRootInfoConfig is called, to generate the rank identification information (HcclRootInfo) of the root rank.
Assume that an AI server has eight devices, which are divided into four communicators. The two devices in each communicator communicates with each other, as shown in the following figure.
Figure 2 shows the process of obtaining rootInfo information and initializing collective communication. In a thread, create four pieces of rootInfo information by switching devices and store the information in an array with a length of 4. After the rootInfo information is obtained, start four threads to call the HcclCommInitRootInfo or HcclCommInitRootInfoConfig API (HcclCommInitRootInfo is used as an example in Figure 2) and initialize the communicator based on different rootInfo information.
1
|
HcclResult HcclGetRootInfo(HcclRootInfo *rootInfo) |
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
rootInfo |
Output |
Rank identification information, including the device IP address and device ID. The information needs to be broadcast to all ranks in the cluster for HCCL initialization. For details about the definition of the HcclRootInfo type, see HcclRootInfo. |
HcclResult: HCCL_SUCCESS on success; else, failure.
None
1 2 3 4 5 6 7 8 9 10 |
uint32_t rankSize = 8; uint32_t deviceId = 0; // Generate the identification information of the root rank. HcclRootInfo rootInfo; HcclGetRootInfo(&rootInfo); // Initialize the communicator. HcclComm hcclComm; HcclCommInitRootInfo(rankSize, &rootInfo, deviceId, &hcclComm); // Destroy the communicator. HcclCommDestroy(hcclComm); |