---
title: HcclRankGraphGetRanksByTopoInst
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/programug/commopdev/hcclopdevapi_07_0044.html
sourcePath: /source/zh/canncommercial/900/programug/commopdev/hcclopdevapi_07_0044.html
indexId: 3f2dd2ecffa31bbbb021635ab2550d212fc545c894ce79ba8c96791ab123e64a75
---
# HcclRankGraphGetRanksByTopoInst

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | ☓ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | ☓ |
| Atlas 200I/500 A2 推理产品 | ☓ |
| Atlas 推理系列产品 | ☓ |
| Atlas 训练系列产品 | ☓ |


#### 功能说明

给定通信域和拓扑层级编号，查询当前rank对应的指定拓扑实例中包含的rank信息。


#### 函数原型

```
HcclResult HcclRankGraphGetRanksByTopoInst(HcclComm comm, uint32_t netLayer, uint32_t topoInstId, uint32_t **ranks, uint32_t *rankNum)
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |  |  |
| --- | --- | --- | --- | --- |
| comm | 输入 | 通信域。 HcclComm类型的定义如下： 1 typedef void \*HcclComm; | 1 | typedef void \*HcclComm; |
| 1 | typedef void \*HcclComm; |  |  |  |
| netLayer | 输入 | 拓扑层级编号。 |  |  |
| topoInstId | 输入 | 拓扑实例ID。（拓扑文件中存在的） |  |  |
| ranks | 输出 | 对应拓扑实例中包含的rank列表。 |  |  |
| rankNum | 输出 | 列表数量。 |  |  |


#### 返回值

HcclResult：接口成功返回HCCL_SUCCESS，其他失败。


#### 约束说明

无


#### 调用示例

```
//8卡通信域，同一个8p Mesh
HcclComm comm;
uint32_t netlayer = 0;
uint32_t topoInstId = 0;
uint32_t *ranks;
uint32_t rankNum;
HcclRankGraphGetRanksByLayer( comm, netLayer, topoInstId,  &ranks, &rankNum )
 // ranks = [0,1,2,…,7],  rankNum=8
```
