配置 EFA 客户端 - FSx 为了光泽

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

配置 EFA 客户端

使用以下过程将 Lustre 客户端设置为通过 Elastic Fabric Adapt FSx er (EFA) Fabric Adapter 访问 for Lustre 文件系统。

运行以下操作系统的 Lustre 客户端支持 EFA:

  • 亚马逊 Linux 2023 (AL2023)

  • Red Hat Enterprise Linux(RHEL)9.5 或更新版本

  • 具有内核版本 6.8+ 的 Ubuntu 22.04 或更新版本

以下列出的 Lustre 客户端支持 EFA。有关更多信息,请参阅 安装 Lustre 客户端

支持 EFA 的 Nitro v4(或更高版本) EC2 实例支持 EFA,不包括 trn2 实例系列。请参阅《Amazon EC2 用户指南》中支持的实例类型

步骤 1:安装所需的驱动程序

注意

如果您使用的是深度学习 AMI,则可以跳过此步骤,因为已预先安装了 Lustre 客户端、EFA 驱动程序和 NVIDIA GPUDirect 存储 (GDS) 驱动程序。

安装 Lustre 客户端和 EFA 驱动程序

快速安装 Lustre 客户端和 EFA 驱动程序
  1. 下载并解压缩包含安装脚本的文件:

    curl -O https://docs.aws.amazon.com/fsx/latest/LustreGuide/samples/install-fsx-lustre-client.zip unzip install-fsx-lustre-client.zip
  2. 切换到该install-fsx-lustre-client文件夹并运行安装脚本:

    cd install-fsx-lustre-client sudo ./bin/install-fsx-lustre-client.sh --install-lustre --install-efa

    脚本会自动执行以下操作:

    • 安装 Lustre 客户端

    • 安装 EFA 驱动程序

    • 验证 Lustre 客户端和 EFA 驱动程序的安装

    有关可在 install-fsx-lustre-client.sh 脚本中使用的选项和用法示例列表,请参阅 zip 文件中的 README.md 文件。

安装 GDS 驱动程序(可选)

仅当您计划将 NVIDIA GPUDirect 存储 (GDS) 与 Lustre 搭配 FSx 使用时,才需要执行此步骤。

要求:

  • 亚马逊 EC2 P5、P5e、P5en 或 P6-B200 实例

  • NVIDIA GDS 驱动程序版本 2.24.2 或更高版本

在您的客户端实例上安装 NVIDIA GPUDirect 存储驱动程序
  1. 克隆 NVIDIA GDS 存储库:

    git clone https://github.com/NVIDIA/gds-nvidia-fs.git
  2. 构建和安装驱动程序:

    cd gds-nvidia-fs/src/ export NVFS_MAX_PEER_DEVS=128 export NVFS_MAX_PCI_DEPTH=16 sudo -E make sudo insmod nvidia-fs.ko

步骤 2:为 Lustre 客户端配置 EFA

要使用 EFA 接口 FSx 访问 for Lustre 文件系统,必须安装 Lustre EFA 模块并配置 EFA 接口。

快速设置

快速配置 Lustre 客户端
  1. 连接到您的亚马逊 EC2 实例。

  2. 下载并解压包含配置脚本的文件:

    curl -O https://docs.aws.amazon.com/fsx/latest/LustreGuide/samples/configure-efa-fsx-lustre-client.zip unzip configure-efa-fsx-lustre-client.zip
  3. 更改为 configure-efa-fsx-lustre-client 文件夹并运行设置脚本:

    cd configure-efa-fsx-lustre-client # for regular IO sudo ./setup.sh # for NVIDIA GPUDirect Storage (GDS) IO sudo ./setup.sh --optimized-for-gds

    脚本会自动执行以下操作:

    • 导入 Lustre 模块

    • 配置 TCP 和 EFA 接口

    • 创建用于在重启时自动完成配置的 systemd 服务

    有关可在 setup.sh 脚本中使用的选项和用法示例列表,请参阅 zip 文件中的 README.md 文件。

手动管理 systemd 服务

systemd 服务文件是在/ etc/systemd/system/configure-efa-fsx-lustre-client .service 中创建的。以下是一些有用的 systemd 相关命令:

# Check status sudo systemctl status configure-efa-fsx-lustre-client.service # View logs sudo journalctl -u configure-efa-fsx-lustre-client.service # View warnings/errors from dmesg sudo dmesg

有关更多信息,请参阅 zip 文件中的 README.md 文件。

自动挂载配置(可选)

有关在启动时自动装载 Amazon f FSx or Lustre 文件系统的信息,请参阅自动挂载您的 Amazon FSx 文件系统

步骤 3:EFA 接口

每个 FSx Lustre 文件系统在所有客户端实例上都有 1024 个 EFA 连接的最大限制。

configure-efa-fsx-lustre-client.sh 脚本会根据实例类型自动配置 EFA 接口。

实例类型 EFA 接口默认数量
p6e-gb200.36xlarge

8

p6-b200.48xlarge

8

p5en.48xlarge

8

p5e.48xlarge

8

p5.48xlarge

8

使用多个网卡的其他实例

2

使用单个网卡的其他实例

1

当连接到 for Lustre 文件系统时,客户端实例上每个配置的 EFA 接口都算作一个 FSx 连接,而不超过 1024 个 EFA 连接限制。

手动管理 EFA 接口

实例的 EFA 接口越多,通常支持的吞吐量越高。您可以自定义接口数量以优化特定工作负载的性能,但需确保总数不超过 EFA 连接限制。

可使用以下命令手动管理 EFA 接口:

  1. 查看可用的 EFA 接口:

    for interface in /sys/class/infiniband/*; do if [ ! -e "$interface/device/driver" ]; then continue; fi driver=$(basename "$(realpath "$interface/device/driver")") if [ "$driver" != "efa" ]; then continue; fi echo $(basename $interface) done
  2. 查看当前配置的接口:

    sudo lnetctl net show
  3. 添加 EFA 接口:

    sudo lnetctl net add --net efa --if device_name --peer-credits 32

    device_name替换为步骤 1 中列表中的实际设备名称。

  4. 移除 EFA 接口:

    sudo lnetctl net del --net efa --if device_name

    device_name替换为步骤 2 中列表中的实际设备名称。