

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# （可选）测试 EFA
<a name="working-with_networking_efa_test-efa"></a>

 您可以通过运行程序 EFA-enabled 来演示计算节点组中两个节点之间的通信，该`fi_pingpong`程序包含在 EFA 软件安装中。如果此测试成功，则很可能已正确配置 EFA。

 要启动，您需要在计算节点组中运行两个实例。如果您的计算节点组使用静态容量，则应该已经有可用的实例。对于使用动态容量的计算节点组，您可以使用`salloc`命令启动两个节点。以下是一个集群的示例，该群集的动态节点组名为`hpc7g`与名为的队列相关联`all`。

```
% salloc --nodes 2 -p all
salloc: Granted job allocation 6
salloc: Waiting for resource configuration
... a few minutes pass ...
salloc: Nodes hpc7g-[1-2] are ready for job
```

 使用查找两个已分配节点的 IP 地址`scontrol`。在以下示例中，地址分别是 for `hpc7g-1` 和 `10.3.140.69` f `10.3.132.211` or `hpc7g-2`。

```
% scontrol show nodes hpc7g-[1-2]
NodeName=hpc7g-1 Arch=aarch64 CoresPerSocket=1
   CPUAlloc=0 CPUEfctv=64 CPUTot=64 CPULoad=0.00
   AvailableFeatures=hpc7g
   ActiveFeatures=hpc7g
   Gres=(null)
   NodeAddr=10.3.140.69 NodeHostName=ip-10-3-140-69 Version=25.11.2
   OS=Linux 6.12.80-106.156.amzn2023.aarch64 #1 SMP Fri May 1 14:08:14 UTC 2026
   RealMemory=124518 AllocMem=0 FreeMem=110763 Sockets=64 Boards=1
   State=IDLE+CLOUD ThreadsPerCore=1 TmpDisk=0 Weight=1 Owner=N/A MCS_label=N/A
   Partitions=efa
   BootTime=2026-05-02T19:00:09 SlurmdStartTime=2026-05-08T19:33:25
   LastBusyTime=2026-05-08T19:33:25 ResumeAfterTime=None
   CfgTRES=cpu=64,mem=124518M,billing=64
   AllocTRES=
   CapWatts=n/a
   CurrentWatts=0 AveWatts=0
   ExtSensorsJoules=n/a ExtSensorsWatts=0 ExtSensorsTemp=n/a
   Reason=Maintain Minimum Number Of Instances [root@2026-05-02T18:59:00]
   InstanceId=i-04927897a9ce3c143 InstanceType=hpc7g.16xlarge

NodeName=hpc7g-2 Arch=aarch64 CoresPerSocket=1
   CPUAlloc=0 CPUEfctv=64 CPUTot=64 CPULoad=0.00
   AvailableFeatures=hpc7g
   ActiveFeatures=hpc7g
   Gres=(null)
   NodeAddr=10.3.132.211 NodeHostName=ip-10-3-132-211 Version=25.11.2
   OS=Linux 6.12.80-106.156.amzn2023.aarch64 #1 SMP Fri May 1 14:08:14 UTC 2026
   RealMemory=124518 AllocMem=0 FreeMem=110759 Sockets=64 Boards=1
   State=IDLE+CLOUD ThreadsPerCore=1 TmpDisk=0 Weight=1 Owner=N/A MCS_label=N/A
   Partitions=efa
   BootTime=2026-05-02T19:00:09 SlurmdStartTime=2026-05-08T19:33:25
   LastBusyTime=2026-05-08T19:33:25 ResumeAfterTime=None
   CfgTRES=cpu=64,mem=124518M,billing=64
   AllocTRES=
   CapWatts=n/a
   CurrentWatts=0 AveWatts=0
   ExtSensorsJoules=n/a ExtSensorsWatts=0 ExtSensorsTemp=n/a
   Reason=Maintain Minimum Number Of Instances [root@2026-05-02T18:59:00]
   InstanceId=i-0a2c82623cb1393a7 InstanceType=hpc7g.16xlarge
```

使用 SSH（或 SSM`hpc7g-1`）连接到其中一个节点（在本例中为）。请注意，这是一个内部 IP 地址，因此如果您使用 SSH，则可能需要从其中一个登录节点进行连接。另请注意，需要通过计算节点组启动模板使用 SSH 密钥配置实例。

```
% ssh ec2-user@10.3.140.69
```

 现在，`fi_pingpong`以服务器模式启动。

```
/opt/amazon/efa/bin/fi_pingpong -p efa
```

 连接到第二个实例 (`hpc7g-2`)。

```
% ssh ec2-user@10.3.132.211
```

 `fi_pingpong`在客户端模式下运行，连接到服务器`hpc7g-1`。您应该看到类似于以下示例的输出。

```
% /opt/amazon/efa/bin/fi_pingpong -p efa 10.3.140.69

bytes   #sent   #ack     total       time     MB/sec    usec/xfer   Mxfers/sec
64      10      =10      1.2k        0.00s      3.08      20.75       0.05
256     10      =10      5k          0.00s     21.24      12.05       0.08
1k      10      =10      20k         0.00s     82.91      12.35       0.08
4k      10      =10      80k         0.00s    311.48      13.15       0.08
[error] util/pingpong.c:1876: fi_close (-22) fid 0
```