

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

# 在 HyperPod 集群上安装指标导出器包
安装指标导出程序包

在[基本配置中，该 SageMaker HyperPod 团队提供的生命周期脚本](sagemaker-hyperpod-lifecycle-best-practices-slurm-slurm-base-config.md)还包括安装各种指标导出器包。要激活安装步骤，只需在 [https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/config.py](https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/config.py) 文件中设置参数 `enable_observability=True`。生命周期脚本旨在使用以下开源指标导出程序包启动集群。


|  |  |  | 
| --- |--- |--- |
| 名称 | 脚本部署目标节点 | 导出程序描述 | 
| [Prometheus 的 Slurm 导出程序](https://github.com/vpenso/prometheus-slurm-exporter) | 主节点（控制器） |  导出 Slurm 会计指标。  | 
|  [Elastic Fabric Adapter（EFA）节点导出程序](https://github.com/aws-samples/awsome-distributed-training/tree/main/4.validation_and_observability/3.efa-node-exporter)  |  计算节点  |  从集群节点和 EFA 导出指标。该软件包是 [Prometheus 节点导出程序](https://github.com/prometheus/node_exporter)的分叉。  | 
|  [NVIDIA 数据中心 GPU 管理（DCGM）导出程序](https://github.com/NVIDIA/dcgm-exporter)  | 计算节点 |  导出有关 NVIDIA 运行状况和性能的 NVIDIA GPUs DCGM 指标。  | 

通过 [https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/config.py](https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/config.py) 文件中的 `enable_observability=True`，以下安装步骤将在 [https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/lifecycle_script.py](https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/lifecycle_script.py) 脚本中激活。

```
# Install metric exporting software and Prometheus for observability
if Config.enable_observability:
    if node_type == SlurmNodeType.COMPUTE_NODE:
        ExecuteBashScript("./utils/install_docker.sh").run()
        ExecuteBashScript("./utils/install_dcgm_exporter.sh").run()
        ExecuteBashScript("./utils/install_efa_node_exporter.sh").run()

    if node_type == SlurmNodeType.HEAD_NODE:
        wait_for_scontrol()
        ExecuteBashScript("./utils/install_docker.sh").run()
        ExecuteBashScript("./utils/install_slurm_exporter.sh").run()
        ExecuteBashScript("./utils/install_prometheus.sh").run()
```

在计算节点上，脚本会安装 NVIDIA 数据中心 GPU 管理 (DCGM) 导出程序和 Elastic Fabric Adapter（EFA）节点导出程序。DCGM 导出器是 Prometheus 的导出器，它从 GPUs NVIDIA 收集指标，从而可以监控 GPU 的使用情况、性能和运行状况。另一方面，EFA 节点导出程序收集与 EFA 网络接口相关的指标，这对高性能计算集群的低延迟和高带宽通信至关重要。

在主节点上，脚本会安装 Prometheus 的 Slurm 导出程序和 [Prometheus 开放源代码软件](https://prometheus.io/docs/introduction/overview/)。Slurm 导出程序可为 Prometheus 提供与 Slurm 作业、分区和节点状态相关的指标。

请注意，生命周期脚本旨在将所有出口程序包安装为 docker 容器，因此主节点和计算节点上也应安装 Docker 软件包。这些组件的脚本可以方便地在 *Awsome Distributed Training GitHub 存储库*的[https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/utils](https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/utils)文件夹中提供。

成功设置安装了导出器包的 HyperPod 集群后，请继续阅读下一个主题，完成针对 Prometheus 和 Amazon Managed Grafana 的亚马逊托管服务的设置。