

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# Support NVIDIA-IMEX mit p6e-gb200-Instanz
<a name="support-nvidia-imex-p6e-gb200-instance"></a>

Dieses Tutorial zeigt Ihnen, wie Sie mit AWS ParallelCluster P6e- beginnen könnenGB200, um die höchste GPU-Leistung für KI-Training und Inferenz zu nutzen. [p6e-gb200.36xlarge-Instances sind nur über P6e- GB200 UltraServers verfügbar, wobei](https://aws.amazon.com/ec2/instance-types/p6/) der Wert für die Größe des Ultraservers steht und der Name ist, aus dem der Ultraserver besteht. `u-p6e-gb200x72` `p6e-gb200.36xlarge` [InstanceType](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-InstanceType) [Beim Kauf eines Ultraservers wird dieser über einen EC2 Capacity Blocks for ML mit 18 Instances erhältlich `u-p6e-gb200x72` sein.](https://aws.amazon.com/ec2/capacityblocks/) `p6e-gb200.36xlarge` [Weitere Informationen finden Sie unter P6e-. GB200](https://aws.amazon.com/ec2/instance-types/p6/)

AWS ParallelCluster Version 3.14.0: 
+ stellt den kompletten NVIDIA-Softwarestack (Treiber, CUDA, EFA, NVIDIA-IMEX) bereit, der für diesen Instance-Typ erforderlich ist 
+ erstellt nvidia-imex-Konfigurationen für P6e-Ultraserver GB200 
+ aktiviert und startet den Dienst für P6e-Ultraserver `nvidia-imex` GB200 
+ konfiguriert das Slurm-Block-Topologie-Plugin so, dass jeder P6e-GB200-Ultraserver (ein EC2-Kapazitätsblock) ein Slurm-Block mit der richtigen Größe ist (siehe den Eintrag für Version 3.14.0). [Versionshinweise und Dokumentenverlauf](document_history.md)

Für die GPU-to-GPU Kommunikation sind jedoch zusätzliche Konfigurationen NVLink erforderlich, insbesondere eine [https://docs.nvidia.com/multi-node-nvlink-systems/imex-guide/config.html#imex-service-node-configuration-file-location](https://docs.nvidia.com/multi-node-nvlink-systems/imex-guide/config.html#imex-service-node-configuration-file-location)Datei, die die IP-Adressen von Rechenknoten in einer IMEX-Domäne enthält, die nicht automatisch generiert wird. ParallelCluster Um bei der Generierung dieser Datei zu helfen, stellen wir ein Prolog-Skript bereit, das den Rechenknoten automatisch erkennt IPs und die [https://docs.nvidia.com/multi-node-nvlink-systems/imex-guide/config.html#imex-service-node-configuration-file-location](https://docs.nvidia.com/multi-node-nvlink-systems/imex-guide/config.html#imex-service-node-configuration-file-location)folgenden Empfehlungen für die [NVIDIA IMEX Slurm](https://docs.nvidia.com/multi-node-nvlink-systems/imex-guide/deployment.html#job-scheduler-integration) Job Scheduler-Integration konfiguriert. In diesem Tutorial erfahren Sie, wie Sie das Prolog-Skript erstellen, es über eine HeadNode benutzerdefinierte Aktion bereitstellen und das IMEX-Setup validieren.

**Anmerkung**  
P6e- GB200 wird ab Version AWS ParallelCluster 3.14.0 auf Amazon Linux 2023, Ubuntu 22.04 und Ubuntu 24.04 unterstützt. [Detaillierte Softwareversionen und eine aktualisierte Liste der unterstützten Distributionen finden Sie im Changelog.AWS ParallelCluster](https://github.com/aws/aws-parallelcluster/blob/develop/CHANGELOG.md)

## Erstellen Sie ein Prolog-Skript zur Verwaltung von NVIDIA-IMEX
<a name="support-nvidia-imex-p6e-gb200-instance-prolog"></a>

**Einschränkung:**
+ Dieses Prolog-Skript wird bei Einreichung eines exklusiven Jobs ausgeführt. Dadurch soll sichergestellt werden, dass ein IMEX-Neustart keine laufenden Jobs auf P6e-GB200-Knoten unterbricht, die zu einer IMEX-Domain gehören.

Im Folgenden finden Sie das `91_nvidia_imex_prolog.sh` Skript, das Sie als Prolog in Slurm konfigurieren sollten. Es wird verwendet, um die nvidia-imex-Konfiguration auf Rechenknoten automatisch zu aktualisieren. [Der Name des Skripts hat das Präfix von, um der Namenskonvention von `91` SchedMD zu entsprechen.](https://slurm.schedmd.com/prolog_epilog.html) Dadurch wird sichergestellt, dass es vor allen anderen Prolog-Skripten in der Sequenz ausgeführt wird. Das Skript konfiguriert die Konfiguration des NVIDIA Imex-Knotens neu, wenn ein Job gestartet wird, und lädt die erforderlichen NVIDIA-Daemons neu.

**Anmerkung**  
Dieses Skript wird nicht ausgeführt, falls mehrere Jobs gleichzeitig auf denselben Knoten gestartet werden. Wir empfehlen daher, das Flag bei der Einreichung zu verwenden. `--exclusive`

```
#!/usr/bin/env bash

# This prolog script configures the NVIDIA IMEX on compute nodes involved in the job execution.
#
# In particular:
# - Checks whether the job is executed exclusively.
#   If not, it exits immediately because it requires jobs to be executed exclusively.
# - Checks if it is running on a p6e-gb200 instance type.
#   If not, it exits immediately because IMEX must be configured only on that instance type.
# - Checks if the IMEX service is enabled.
#   If not, it exits immediately because IMEX must be enabled to get configured.
# - Creates the IMEX default channel.
#   For more information about IMEX channels, see https://docs.nvidia.com/multi-node-nvlink-systems/imex-guide/imexchannels.html
# - Writes the private IP addresses of compute nodes into /etc/nvidia-imex/nodes_config.cfg.
# - Restarts the IMEX system service.
#
# REQUIREMENTS:
#  - This prolog assumes to be run only with exclusive jobs.

LOG_FILE_PATH="/var/log/parallelcluster/nvidia-imex-prolog.log"
SCONTROL_CMD="/opt/slurm/bin/scontrol"
IMEX_START_TIMEOUT=60
IMEX_STOP_TIMEOUT=15
ALLOWED_INSTANCE_TYPES="^(p6e-gb200)"
IMEX_SERVICE="nvidia-imex"
IMEX_NODES_CONFIG="/etc/nvidia-imex/nodes_config.cfg"

function info() {
  echo "$(date "+%Y-%m-%dT%H:%M:%S.%3N") [INFO] [PID:$$] [JOB:${SLURM_JOB_ID}] $1"
}

function warn() {
  echo "$(date "+%Y-%m-%dT%H:%M:%S.%3N") [WARN] [PID:$$] [JOB:${SLURM_JOB_ID}] $1"
}

function error() {
  echo "$(date "+%Y-%m-%dT%H:%M:%S.%3N") [ERROR] [PID:$$] [JOB:${SLURM_JOB_ID}] $1"
}

function error_exit() {
  error "$1" && exit 1
}

function prolog_end() {
    info "PROLOG End JobId=${SLURM_JOB_ID}: $0"
    info "----------------"
    exit 0
}

function get_instance_type() {
  local token=$(curl -X PUT -s "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
  curl -s -H "X-aws-ec2-metadata-token: ${token}" http://169.254.169.254/latest/meta-data/instance-type
}

function return_if_unsupported_instance_type() {
  local instance_type=$(get_instance_type)

  if [[ ! ${instance_type} =~ ${ALLOWED_INSTANCE_TYPES} ]]; then
    info "Skipping IMEX configuration because instance type ${instance_type} does not support it"
    prolog_end
  fi
}

function return_if_imex_disabled() {
  if ! systemctl is-enabled "${IMEX_SERVICE}" &>/dev/null; then
    warn "Skipping IMEX configuration because system service ${IMEX_SERVICE} is not enabled"
    prolog_end
  fi
}

function return_if_job_is_not_exclusive() {
  if [[ "${SLURM_JOB_OVERSUBSCRIBE}" =~ ^(NO|TOPO)$  ]]; then
    info "Job is exclusive, proceeding with IMEX configuration"
  else
    info "Skipping IMEX configuration because the job is not exclusive"
    prolog_end
  fi
}

function get_ips_from_node_names() {
  local _nodes=$1
  ${SCONTROL_CMD} -ao show node "${_nodes}" | sed 's/^.* NodeAddr=\([^ ]*\).*/\1/'
}

function get_compute_resource_name() {
  local _queue_name_prefix=$1
  local _slurmd_node_name=$2
  echo "${_slurmd_node_name}" | sed -E "s/${_queue_name_prefix}(.+)-[0-9]+$/\1/"
}

function reload_imex() {
  info "Stopping IMEX"
  timeout ${IMEX_STOP_TIMEOUT} systemctl stop ${IMEX_SERVICE}
  pkill -9 ${IMEX_SERVICE}

  info "Restarting IMEX"
  timeout ${IMEX_START_TIMEOUT} systemctl start ${IMEX_SERVICE}
}

function create_default_imex_channel() {
  info "Creating IMEX default channel"
  MAJOR_NUMBER=$(cat /proc/devices | grep nvidia-caps-imex-channels | cut -d' ' -f1)
  if [ ! -d "/dev/nvidia-caps-imex-channels" ]; then
    sudo mkdir /dev/nvidia-caps-imex-channels
  fi

  # Then check and create device node
  if [ ! -e "/dev/nvidia-caps-imex-channels/channel0" ]; then
    sudo mknod /dev/nvidia-caps-imex-channels/channel0 c $MAJOR_NUMBER 0
    info "IMEX default channel created"
  else
    info "IMEX default channel already exists"
  fi
}

{
  info "PROLOG Start JobId=${SLURM_JOB_ID}: $0"

  return_if_job_is_not_exclusive
  return_if_unsupported_instance_type
  return_if_imex_disabled

  create_default_imex_channel

  IPS_FROM_CR=$(get_ips_from_node_names "${SLURM_NODELIST}")

  info "Node Names: ${SLURM_NODELIST}"
  info "Node IPs: ${IPS_FROM_CR}"
  info "IMEX Nodes Config: ${IMEX_NODES_CONFIG}"

  info "Updating IMEX nodes config ${IMEX_NODES_CONFIG}"
  echo "${IPS_FROM_CR}" > "${IMEX_NODES_CONFIG}"
  reload_imex

  prolog_end

} 2>&1 | tee -a "${LOG_FILE_PATH}" | logger -t "91_nvidia_imex_prolog"
```

## Erstellen Sie das HeadNode OnNodeStart benutzerdefinierte Aktionsskript
<a name="support-nvidia-imex-p6e-gb200-instance-action-script"></a>

Erstellen Sie eine `install_custom_action.sh` benutzerdefinierte Aktion, die das oben genannte Prolog-Skript in ein gemeinsam genutztes Verzeichnis herunterlädt, auf `/opt/slurm/etc/scripts/prolog.d/` das Compute Nodes zugreifen, und die entsprechenden Berechtigungen für die Ausführung festlegt.

```
#!/bin/bash
set -e

echo "Executing $0"

PROLOG_NVIDIA_IMEX=/opt/slurm/etc/scripts/prolog.d/91_nvidia_imex_prolog.sh
aws s3 cp "s3://<Bucket>/91_nvidia_imex_prolog.sh" "${PROLOG_NVIDIA_IMEX}"
chmod 0755 "${PROLOG_NVIDIA_IMEX}"
```

## Den Cluster erstellen
<a name="support-nvidia-imex-p6e-gb200-instance-cluster"></a>

Erstellen Sie einen Cluster mit P6e-Instanzen. GB200 Im Folgenden finden Sie eine Beispielkonfiguration, die den Typ SlurmQueues Ultraserver enthält. `u-p6e-gb200x72`

P6e- GB200 ist derzeit nur in Local Zones verfügbar. Einige [Local Zones unterstützen kein NAT-Gateway](https://docs.aws.amazon.com/local-zones/latest/ug/local-zones-connectivity-nat.html). Folgen Sie daher bei ParallelCluster Bedarf den [Verbindungsoptionen für Local Zones](https://docs.aws.amazon.com/local-zones/latest/ug/local-zones-connectivity.html), [Konfiguration von Sicherheitsgruppen für eingeschränkte Umgebungen](security-groups-configuration.md) um eine Verbindung zu den AWS Diensten herzustellen. Bitte folgen Sie den Anweisungen [Starten Sie Instances mit Capacity Blocks (CB)](launch-instances-capacity-blocks.md) (AWS ParallelClusterLaunch), da Ultraserver nur als Kapazitätsblöcke verfügbar sind. 

```
HeadNode:
  CustomActions:
    OnNodeStart:
      Script: s3://<s3-bucket-name>/install_custom_action.sh
    S3Access:
      - BucketName: <s3-bucket-name>
  InstanceType: <HeadNode-instance-type>
  Networking:
    SubnetId: <subnet-abcd78901234567890>
  Ssh:
    KeyName: <Key-name>
Image:
  Os: ubuntu2404
Scheduling:
  Scheduler: slurm
  SlurmSettings:
    CustomSlurmSettings:
      - PrologFlags: "Alloc,NoHold"
      - MessageTimeout: 240
  SlurmQueues:
    - CapacityReservationTarget:
        CapacityReservationId: <cr-123456789012345678>
      CapacityType: CAPACITY_BLOCK
      ComputeResources: ### u-p6e-gb200x72
        - DisableSimultaneousMultithreading: true
          Efa:
            Enabled: true
          InstanceType: p6e-gb200.36xlarge  
          MaxCount: 18
          MinCount: 18
          Name: cr1
      Name: q1
      Networking:
        SubnetIds:
          - <subnet-1234567890123456>
```

## Überprüfen Sie das IMEX-Setup
<a name="support-nvidia-imex-p6e-gb200-instance-validate"></a>

Der `91_nvidia_imex_prolog.sh` Prolog wird ausgeführt, wenn Sie einen Slurm-Job einreichen. Im Folgenden finden Sie einen Beispieljob zur Überprüfung des Status der NVIDIA-IMEX-Domain.

```
#!/bin/bash
#SBATCH --job-name=nvidia-imex-status-job
#SBATCH --ntasks-per-node=1
#SBATCH --output=slurm-%j.out
#SBATCH --error=slurm-%j.err

QUEUE_NAME="q1"
COMPUTE_RES_NAME="cr1"
IMEX_CONFIG_FILE="/opt/parallelcluster/shared/nvidia-imex/config_${QUEUE_NAME}_${COMPUTE_RES_NAME}.cfg"

srun bash -c "/usr/bin/nvidia-imex-ctl -N -c ${IMEX_CONFIG_FILE} > result_\${SLURM_JOB_ID}_\$(hostname).out 2> result_\${SLURM_JOB_ID}_\$(hostname).err"
```

Überprüfen Sie die Ausgabe des Job:

```
Connectivity Table Legend:
I - Invalid - Node wasn't reachable, no connection status available
N - Never Connected
R - Recovering - Connection was lost, but clean up has not yet been triggered.
D - Disconnected - Connection was lost, and clean up has been triggreed.
A - Authenticating - If GSSAPI enabled, client has initiated mutual authentication.
!V! - Version mismatch, communication disabled.
!M! - Node map mismatch, communication disabled.
C - Connected - Ready for operation

5/12/2025 06:08:10.580
Nodes:
Node #0   - 172.31.48.81    - READY                - Version: 570.172
Node #1   - 172.31.48.98    - READY                - Version: 570.172
Node #2   - 172.31.48.221   - READY                - Version: 570.172
Node #3   - 172.31.49.228   - READY                - Version: 570.172
Node #4   - 172.31.50.39    - READY                - Version: 570.172
Node #5   - 172.31.50.44    - READY                - Version: 570.172
Node #6   - 172.31.51.66    - READY                - Version: 570.172
Node #7   - 172.31.51.157   - READY                - Version: 570.172
Node #8   - 172.31.52.239   - READY                - Version: 570.172
Node #9   - 172.31.53.80    - READY                - Version: 570.172
Node #10  - 172.31.54.95    - READY                - Version: 570.172
Node #11  - 172.31.54.183   - READY                - Version: 570.172
Node #12  - 172.31.54.203   - READY                - Version: 570.172
Node #13  - 172.31.54.241   - READY                - Version: 570.172
Node #14  - 172.31.55.59    - READY                - Version: 570.172
Node #15  - 172.31.55.187   - READY                - Version: 570.172
Node #16  - 172.31.55.197   - READY                - Version: 570.172
Node #17  - 172.31.56.47    - READY                - Version: 570.172

 Nodes From\To  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17
       0        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C 
       1        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C 
       2        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C
       3        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C  
       4        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C 
       5        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C 
       6        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C
       7        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C 
       8        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C 
       9        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   
      10        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   
      11        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   
      12        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   
      13        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   
      14        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C  
      15        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C  
      16        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C  
      17        C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C   C  

Domain State: UP
```