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

#### 产品支持情况

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


#### 功能说明

给定通信域和拓扑层级编号，查询当前rank所在的拓扑实例集合。


#### 函数原型

```
HcclResult HcclRankGraphGetTopoInstsByLayer(HcclComm comm, uint32_t netLayer, uint32_t **topoInsts, uint32_t *topoInstNum)
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |  |  |
| --- | --- | --- | --- | --- |
| comm | 输入 | 通信域。 HcclComm类型的定义如下： 1 typedef void \*HcclComm; | 1 | typedef void \*HcclComm; |
| 1 | typedef void \*HcclComm; |  |  |  |
| netLayer | 输入 | 拓扑层级编号。 |  |  |
| topoInsts | 输出 | 拓扑实例列表。 |  |  |
| topoInstNum | 输出 | 拓扑实例数量。 |  |  |


#### 返回值

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


#### 约束说明

无


#### 调用示例

```
HcclComm comm;
uint32_t netLayer = 0;
uint32_t *topoInsts = nullptr;
uint32_t topoInstNum = 0;
// topo文件中不配置topoInstanceId时默认为0
HcclRankGraphGetTopoInstsByLayer(comm, netLayer, &topoInsts, &topoInstNum); 
// topoInsts = [0], topoInstNum = 1
```
