HcclRankGraphGetRanksByLayer
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
x |
|
x |
|
x |
For
Function
Returns the list of all rank IDs and the number of ranks in the topology instance where the current rank is located at a specified topology layer in a specified communicator.

- Layer 0 contains two topology instances. For easy understanding, the topology instance IDs are defined as 0 and 1.
- Layer 1 contains one topology instance.
Assume that this API is called on rank 0. If the specified layer is 0, the rank ID list returned by this API is [0,1,2] and the number of ranks is 3. If the specified layer is 1, the rank ID list returned by this API is [0,1,2,3,4,5] and the number of ranks is 6.
Prototype
1 | HcclResult HcclRankGraphGetRanksByLayer(HcclComm comm, uint32_t netLayer, uint32_t **ranks, uint32_t *rankNum) |
Parameters
Parameter |
Input/Output |
Description |
||
|---|---|---|---|---|
comm |
Input |
Communicator. The HcclComm type is defined as follows:
|
||
netLayer |
Input |
Topology layer ID. |
||
ranks |
Output |
List of rank IDs. |
||
rankNum |
Output |
Number of ranks. |
Returns
HcclResult: HCCL_SUCCESS on success, or else failure.
Restrictions
None
Example
The following uses the topology model in Function as an example:
For rank 0:
1 2 3 4 5 6 7 | HcclComm commTp; vector<uint32_t> ranks; uint32_t rankNum; HcclRankGraphGetRanksByLayer(commTp, netLayer=0, &ranks, &rankNum); // For a level-0 topology, ranks = [0,1,2] and rankNum = 3. HcclRankGraphGetRanksByLayer(commTp, netLayer=1, &ranks, &rankNum); // For a level-1 topology, ranks = [0,1,2,3,4,5] and rankNum = 6. |
For rank 3:
1 2 3 4 5 6 7 | HcclComm commTp; vector<uint32_t> ranks; uint32_t rankNum; HcclRankGraphGetRanksByLayer(commTp, netLayer=0, &ranks, &rankNum); // For a level-0 topology, ranks = [3,4,5] and rankNum = 3. HcclRankGraphGetRanksByLayer(commTp, netLayer=1, &ranks, &rankNum); // For a level-1 topology, ranks = [0,1,2,3,4,5] and rankNum = 6. |