

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

# 在 Amazon SageMaker HyperPod 中使用 UltraServer
<a name="sagemaker-hyperpod-ultraserver"></a>

SageMaker HyperPod 支援 Ultraserver，可為 AI 和機器學習工作負載提供高效能 GPU 運算功能。這些 Ultraserver 建置在 NVIDIA GB200 和 NVL72 架構之上，以雙機架組態提供跨 18 個 GB200 執行個體的 NVLink 連線能力，總計 72 個 B200 GPU。此 NVLink 織網可讓工作負載使用 GPU 通訊，增加可用的 GPU 容量和可定址記憶體，超越離散執行個體所能達到的範圍，從而支援更複雜和資源密集的 AI 模型。NVLink 連線由 NVIDIA IMEX 技術啟用，可處理相同機架內執行個體間安全 GPU 織網連線的低階組態。

HyperPod 透過智慧型拓撲感知和自動化組態，簡化這些 GPU 叢集的部署和管理。平台會自動探索並標記節點的實體位置和容量區塊資訊，支援分散式工作負載的拓撲感知排程。HyperPod 會抽象化複雜的 IMEX 組態要求，讓您可以專注於工作負載部署，而非低階 GPU 織網設定。您可以選擇靈活的部署選項，包括自我管理節點和 EKS 受管節點群組。Amazon EKS 提供最佳化的 AMI，其中包括預先設定的 NVIDIA 驅動程式、Fabric Manager、IMEX 驅動程式，以及所有必要的系統軟體以實現無縫操作。

整合包含 Pod 置放功能，確保使用標準 Kubernetes 拓撲標籤，在 NVL72 網域間以最佳方式排程分散式工作負載。內建監控和自動復原功能提供操作支援，其中 AMI 運作狀態代理程式會從核心日誌偵測 GPU 錯誤，並可以自動修復問題或取代受管節點群組中的故障節點。這種 GPU 擴展、智慧型工作負載置放和自動化操作的組合，可協助您專注於 AI/ML 創新，而不是基礎設施複雜性，同時從 GPU 投資中獲得最大效能。

若要使用 UltraServer 搭配 HyperPod 叢集進行設定，請參閱下列步驟：

1. 建立 [EKS 型 HyperPod 叢集](https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-hyperpod-eks-operate-console-ui-create-cluster.html)。當您選擇執行個體群組時，請務必選擇 UltraServer。

1. 建立您的叢集後，請使用下列命令安裝操作外掛程式：

   NVIDIA 裝置外掛程式 v0.17.2

   ```
   kubectl apply -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.2/deployments/static/nvidia-device-plugin.yml
   ```

   FD DaemonSet v0.17.3

   ```
   kubectl apply -k "https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref=v0.17.3"
   ```

   GPU 功能探索

   ```
   kubectl apply -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.2/deployments/static/gpu-feature-discovery-daemonset.yaml
   ```

您現在可以執行任務。下列範例示範如何建立網域、設定 IMEX 網域，以及啟用通道配置。這些步驟也可讓您建立 Pod 來佈建通道進行 NCCL 通訊。

1. 建立要與 Kubectl 搭配使用的資源規格檔案。

   ```
   cat <<EOF > imex-channel-injection.yaml
   ---
   apiVersion: resource.nvidia.com/v1beta1
   kind: ComputeDomain
   metadata:
     name: imex-channel-injection
   spec:
     numNodes: 1
     channel:
       resourceClaimTemplate:
         name: imex-channel-0
   ---
   apiVersion: v1
   kind: Pod
   metadata:
     name: imex-channel-injection
   spec:
     affinity:
       nodeAffinity:
         requiredDuringSchedulingIgnoredDuringExecution:
           nodeSelectorTerms:
           - matchExpressions:
             - key: nvidia.com/gpu.clique
               operator: Exists
             - key: topology.k8s.aws/ultraserver-id
               operator: In
               values: 
               - <UltraServer-ID>
     containers:
     - name: ctr
       image: ubuntu:22.04
       command: ["bash", "-c"]
       args: ["ls -la /dev/nvidia-caps-imex-channels; trap 'exit 0' TERM; sleep 9999 & wait"]
       resources:
         claims:
         - name: imex-channel-0
     resourceClaims:
     - name: imex-channel-0
       resourceClaimTemplateName: imex-channel-0
   EOF
   ```

1. 套用您建立的組態。

   ```
   kubectl apply -f imex-channel-injection.yaml
   ```

1. 若要驗證是否已建立您的 Pod，請執行 `get pods` 命令。

   ```
   kubectl get pods
   kubectl get pods -n nvidia-dra-driver-gpu -l resource.nvidia.com/computeDomain
   ```

1. 您也可以從 Pod 檢查日誌，以查看其是否已配置通訊管道。

   ```
   kubectl logs imex-channel-injection
   ```

   ```
   total 0
   drwxr-xr-x 2 root root     60 Feb 19 10:43 .
   drwxr-xr-x 6 root root    380 Feb 19 10:43 ..
   crw-rw-rw- 1 root root 507, 0 Feb 19 10:43 channel0
   ```

1. 您也可以檢查日誌，以驗證自動化 IMEX 組態是否使用配置的通道執行。

   ```
   kubectl logs -n nvidia-dra-driver-gpu -l resource.nvidia.com/computeDomain --tail=-1
   /etc/nvidia-imex/nodes_config.cfg:
   ```

   ```
   IMEX Log initializing at: 8/8/2025 14:23:12.081
   [Aug 8 2025 14:23:12] [INFO] [tid 39] IMEX version 570.124.06 is running with the following configuration options
   
   [Aug 8 2025 14:23:12] [INFO] [tid 39] Logging level = 4
   
   [Aug 8 2025 14:23:12] [INFO] [tid 39] Logging file name/path = /var/log/nvidia-imex.log
   
   [Aug 8 2025 14:23:12] [INFO] [tid 39] Append to log file = 0
   
   [Aug 8 2025 14:23:12] [INFO] [tid 39] Max Log file size = 1024 (MBs)
   
   [Aug 8 2025 14:23:12] [INFO] [tid 39] Use Syslog file = 0
   
   [Aug 8 2025 14:23:12] [INFO] [tid 39] IMEX Library communication bind interface =
   
   [JAug 8 2025 14:23:12] [INFO] [tid 39] IMEX library communication bind port = 50000
   
   [Aug 8 2025 14:23:12] [INFO] [tid 39] Identified this node as ID 0, using bind IP of '10.115.131.8', and network interface of enP5p9s0
   [Aug 8 2025 14:23:120] [INFO] [tid 39] nvidia-imex persistence file /var/run/nvidia-imex/persist.dat does not exist.  Assuming no previous importers.
   [Aug 8 2025 14:23:12] [INFO] [tid 39] NvGpu Library version matched with GPU Driver version
   [Aug 8 2025 14:23:12] [INFO] [tid 63] Started processing of incoming messages.
   [Aug 8 2025 14:23:12] [INFO] [tid 64] Started processing of incoming messages.
   [Aug 8 2025 14:23:12] [INFO] [tid 65] Started processing of incoming messages.
   [Aug 8 2025 14:23:12] [INFO] [tid 39] Creating gRPC channels to all peers (nPeers = 1).
   [Aug 8 2025 14:23:12] [INFO] [tid 66] Started processing of incoming messages.
   [Aug 8 2025 14:23:12] [INFO] [tid 39] IMEX_WAIT_FOR_QUORUM != FULL, continuing initialization without waiting for connections to all nodes.
   [Aug 8 2025 14:23:12] [INFO] [tid 67] Connection established to node 0 with ip address 10.115.131.8. Number of times connected: 1
   [Aug 8 2025 14:23:12] [INFO] [tid 39] GPU event successfully subscribed
   ```

1. 在您驗證了所有項目之後，請刪除工作負載並移除組態。

   ```
   kubectl delete -f imex-channel-injection.yaml
   ```