HcclGetRootInfo
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
☓ |
|
√ |
|
√ |
For
For the
Function
Generates the identification information (HcclRootInfo) of the root rank. Call this API on the root rank before calling the HCCL initialization API HcclCommInitRootInfo or HcclCommInitRootInfoConfig.
- This API must be used in conjunction with the initialization API HcclCommInitRootInfo or HcclCommInitRootInfoConfig.
- This API supports single-threaded loop calling. That is, you can call this API in a for loop by specifying different devices to obtain rootInfo of different devices within a thread.
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 1 Example of communicator division
Figure 2 shows the process of obtaining rootInfo and initializing collective communication. In a thread, create four rootInfo records by switching devices and store the information in an array with a length of 4. After obtaining the rootInfo records, start four threads to initialize the communicators by calling the HcclCommInitRootInfo or HcclCommInitRootInfoConfig API based on the rootInfo information. Figure 2 uses HcclCommInitRootInfo as an example.
- (Optional) In the multi-server collective communication scenario, perform the following operations before calling HcclGetRootInfo:
- Configure the environment variable HCCL_IF_IP or HCCL_SOCKET_IFNAME to specify the IP address of the root NIC for HCCL initialization. (HCCL_IF_IP takes precedence over HCCL_SOCKET_IFNAME. If neither of them is specified, the root NIC is selected in ascending lexicographical order of NIC names by default.)
- Configure the environment variable HCCL_WHITELIST_DISABLE to enable trustlist verification and use HCCL_WHITELIST_FILE to specify the communication trustlist configuration file. (If this environment variable is not set, communication trustlist verification is disabled by default.)
Prototype
1 | HcclResult HcclGetRootInfo(HcclRootInfo *rootInfo) |
Parameters
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. |
Returns
HcclResult: HCCL_SUCCESS on success, or else failure.
Constraints
None.
Call Example
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); |
