

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在您的 HyperPod 叢集上安裝指標匯出工具套件
<a name="sagemaker-hyperpod-cluster-observability-slurm-install-exporters"></a>

在 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 GPU 運作狀態和效能的 NVIDIA 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 的匯出工具，可從 NVIDIA GPU 收集指標，進而監控 GPU 用量、效能和運作狀態。另一方面，EFA 節點匯出工具會收集與 EFA 網路介面相關的指標，這對於 HPC 叢集中的低延遲和高頻寬通訊至關重要。

在主節點上，指令碼會安裝適用於 Prometheus 的 Slurm 匯出工具和 [Prometheus 開放原始碼軟體](https://prometheus.io/docs/introduction/overview/)。Slurm 匯出工具會提供 Prometheus，其中具有與 Slurm 任務、分割區和節點狀態相關的指標。

請注意，生命週期指令碼旨在將所有匯出工具套件安裝為 Docker 容器，因此 Docker 套件也應該同時安裝在主節點和運算節點上。這些元件的指令碼可方便地在 *Awsome 分散式訓練 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 叢集之後，請繼續下一個主題以完成設定 Amazon Managed Service for Prometheus 和 Amazon Managed Grafana。