HcclRankGraphGetRankSizeByLayer

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

x

Atlas training product

x

For Atlas A2 training product/Atlas A2 inference product, only the Atlas 800T A2 training server, Atlas 900 A2 PoD cluster basic unit, and Atlas 200T A2 Box16 heterogeneous subrack are supported.

Function

Returns the number of ranks in the topology instance where the current rank is located at a specified topology layer in a specified communicator.

Take the preceding topology model as an example:
  • 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 number of ranks returned by this API is 3. If the specified layer is 1, the number of ranks returned by this API is 6.

Prototype

1
HcclResult HcclRankGraphGetRankSizeByLayer(HcclComm comm, uint32_t netLayer, uint32_t *rankNum)

Parameters

Parameter

Input/Output

Description

comm

Input

Communicator.

The HcclComm type is defined as follows:

1
typedef void *HcclComm;

netLayer

Input

Topology layer ID.

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:

1
2
3
4
5
6
HcclComm comm;
uint32_t rankNum;
HcclRankGraphGetRankSizeByLayer(comm, 0, &rankNum);
// rankNum=3
HcclRankGraphGetRankSizeByLayer(comm, 1, &rankNum);
// rankNum=6