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

#### 产品支持情况

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


针对 Atlas A2 训练系列产品 / Atlas A2 推理系列产品 ，仅支持Atlas 800T A2 训练服务器、Atlas 900 A2 PoD 集群基础单元、Atlas 200T A2 Box16 异构子框。


#### 功能说明

给定通信域和拓扑层级编号，查询源rank和目的rank之间的通信连接信息。

以Atlas A3 训练系列产品 / Atlas A3 推理系列产品为例：- 示例1：源rank与目的rank分别在两个超节点。
  netLayer = 0， 无连接。

  netLayer = 1， 无连接。

  netLayer = 2， RDMA连接。

- 示例2：源rank与目的rank在同一个超节点，但不在同一个AI Server内。
  netLayer = 0， 无连接。

  netLayer = 1， HCCS连接。

  netLayer = 2， 无连接。

- 示例3：源rank与目的rank在同一个AI Server内，不在同一个NPU中。
  netLayer = 0， HCCS连接。

  netLayer = 1， 无连接。

  netLayer = 2， 无连接。


#### 函数原型

```
HcclResult HcclRankGraphGetLinks(HcclComm comm, uint32_t netLayer, uint32_t srcRank, uint32_t dstRank, CommLink **links, uint32_t *linkNum)
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |  |  |
| --- | --- | --- | --- | --- |
| comm | 输入 | 通信域。 HcclComm类型的定义如下： 1 typedef void \*HcclComm; | 1 | typedef void \*HcclComm; |
| 1 | typedef void \*HcclComm; |  |  |  |
| netLayer | 输入 | 拓扑层级编号。 |  |  |
| srcRank | 输入 | 源rank编号。 |  |  |
| dstRank | 输入 | 目的rank编号。 |  |  |
| links | 输出 | 通信连接列表。 CommLink类型的定义请参见CommLink。 |  |  |
| linkNum | 输出 | 通信连接数量。 |  |  |


#### 返回值

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


#### 约束说明

无


#### 调用示例

```
HcclComm comm;
CommLink *links;
uint32_t linkNum;
uint32_t netlayer = 0;
// 查询机内rank0与rank1间的链路
HcclRankGraphGetLinks(comm, netlayer, 0, 1, &links, &linkNum);
```
