

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

# 为 SageMaker HyperPod Slurm 集群设置多个控制器节点
设置多个控制器节点

本主题介绍如何使用生命周期脚本在 SageMaker HyperPod Slurm 集群中配置多个控制器（头）节点。在开始之前，请查看[使用的先决条件 SageMaker HyperPod](sagemaker-hyperpod-prerequisites.md)中列出的先决条件并熟悉[使用生命周期脚本自定义 SageMaker HyperPod 集群](sagemaker-hyperpod-lifecycle-best-practices-slurm.md)中的生命周期脚本。本主题中的说明使用的是 Amazon Linux 环境中的 Amazon CLI 命令。请注意，这些命令中使用的环境变量仅在当前会话中可用，除非将其显式保留。

**Topics**
+ [

# 使用 Amazon CloudFormation 堆栈配置资源
](sagemaker-hyperpod-multihead-slurm-cfn.md)
+ [

# 创建并附加 IAM 策略
](sagemaker-hyperpod-multihead-slurm-iam.md)
+ [

# 准备并上传生命周期脚本
](sagemaker-hyperpod-multihead-slurm-scripts.md)
+ [

# 创建集 SageMaker HyperPod 群
](sagemaker-hyperpod-multihead-slurm-create.md)
+ [

# 考虑重要说明
](sagemaker-hyperpod-multihead-slurm-notes.md)
+ [

# 查看环境变量参考
](sagemaker-hyperpod-multihead-slurm-variables-reference.md)

# 使用 Amazon CloudFormation 堆栈配置资源
预置资源

要在 HyperPod Slurm 集群中设置多个控制器节点，请通过两个 Amazon CloudFormation 堆栈配置 Amazon 资源：和。[预调配基本资源](#sagemaker-hyperpod-multihead-slurm-cfn-basic) [预调配其他资源以支持多个控制器节点](#sagemaker-hyperpod-multihead-slurm-cfn-multihead)

## 预调配基本资源


按照以下步骤为您的 Amazon SageMaker HyperPod Slurm 集群配置基本资源。

1. 将 [sagemaker-hyperpod.yaml](https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/sagemaker-hyperpod.yaml) 模板文件下载到您的计算机上。此 YAML 文件是一个 Amazon CloudFormation 模板，用于定义要为您的 Slurm 集群创建的以下资源。
   + 计算节点实例组的执行 IAM 角色
   + 用于存储生命周期脚本的 Amazon S3 存储桶
   + 公有子网和私有子网（私有子网可通过 NAT 网关访问互联网）
   + 互联网 Gateway/NAT 网关
   + 两个 Amazon EC2 安全组
   + 用于存储配置文件的 Amazon FSx 卷

1. 运行以下 CLI 命令创建名为的 Amazon CloudFormation 堆栈`sagemaker-hyperpod`。在和中 IDs 为您的集群定义可用区 (AZ) `BackupSubnetAZ`。`PrimarySubnetAZ`例如，*use1-az4*是该`us-east-1`区域中可用区的可用区 ID。有关更多信息，请参阅[可用区 IDs](https://docs.amazonaws.cn//ram/latest/userguide/working-with-az-ids.html)和[在多个 SageMaker HyperPod 集群中设置集群 AZs](sagemaker-hyperpod-prerequisites.md#sagemaker-hyperpod-prerequisites-multiple-availability-zones)。

   ```
   aws cloudformation deploy \
   --template-file /path_to_template/sagemaker-hyperpod.yaml \
   --stack-name sagemaker-hyperpod \
   --parameter-overrides PrimarySubnetAZ=use1-az4 BackupSubnetAZ=use1-az1 \
   --capabilities CAPABILITY_IAM
   ```

   有关更多信息，请参阅[通过 Amazon Command Line Interface 参考进行部署](https://docs.amazonaws.cn//cli/latest/reference/cloudformation/deploy/)。堆栈创建可能需要几分钟才能完成。堆栈创建完成后，您将在命令行界面中看到以下内容。

   ```
   Waiting for changeset to be created..
   Waiting for stack create/update to complete
   Successfully created/updated stack - sagemaker-hyperpod
   ```

1. （可选）在 [Amazon CloudFormation 控制台](https://console.amazonaws.cn/cloudformation/home)中验证堆栈。
   + 从左侧导航栏中，选择**堆栈**。
   + 在**堆栈**页面上，找到并选择 **sagemaker-hyperpod**。
   + 选择**资源**和**输出**等标签页以查看资源和输出。

1. 从堆栈（`sagemaker-hyperpod`）输出中创建环境变量。您将使用这些变量的值来[预调配其他资源以支持多个控制器节点](#sagemaker-hyperpod-multihead-slurm-cfn-multihead)。

   ```
   source .env
   PRIMARY_SUBNET=$(aws --region $REGION cloudformation describe-stacks --stack-name $SAGEMAKER_STACK_NAME --query 'Stacks[0].Outputs[?OutputKey==`PrimaryPrivateSubnet`].OutputValue' --output text)
   BACKUP_SUBNET=$(aws --region $REGION cloudformation describe-stacks --stack-name $SAGEMAKER_STACK_NAME --query 'Stacks[0].Outputs[?OutputKey==`BackupPrivateSubnet`].OutputValue' --output text)
   EMAIL=$(bash -c 'read -p "INPUT YOUR SNSSubEmailAddress HERE: " && echo $REPLY')
   DB_USER_NAME=$(bash -c 'read -p "INPUT YOUR DB_USER_NAME HERE: " && echo $REPLY')
   SECURITY_GROUP=$(aws --region $REGION cloudformation describe-stacks --stack-name $SAGEMAKER_STACK_NAME --query 'Stacks[0].Outputs[?OutputKey==`SecurityGroup`].OutputValue' --output text)
   ROOT_BUCKET_NAME=$(aws --region $REGION cloudformation describe-stacks --stack-name $SAGEMAKER_STACK_NAME --query 'Stacks[0].Outputs[?OutputKey==`AmazonS3BucketName`].OutputValue' --output text)
   SLURM_FSX_DNS_NAME=$(aws --region $REGION cloudformation describe-stacks --stack-name $SAGEMAKER_STACK_NAME --query 'Stacks[0].Outputs[?OutputKey==`FSxLustreFilesystemDNSname`].OutputValue' --output text)
   SLURM_FSX_MOUNT_NAME=$(aws --region $REGION cloudformation describe-stacks --stack-name $SAGEMAKER_STACK_NAME --query 'Stacks[0].Outputs[?OutputKey==`FSxLustreFilesystemMountname`].OutputValue' --output text)
   COMPUTE_NODE_ROLE=$(aws --region $REGION cloudformation describe-stacks --stack-name $SAGEMAKER_STACK_NAME --query 'Stacks[0].Outputs[?OutputKey==`AmazonSagemakerClusterExecutionRoleArn`].OutputValue' --output text)
   ```

   当您看到要求您输入电子邮件地址和数据库用户名的提示时，请输入如下值。

   ```
   INPUT YOUR SNSSubEmailAddress HERE: Email_address_to_receive_SNS_notifications
   INPUT YOUR DB_USER_NAME HERE: Database_user_name_you_define
   ```

   要验证变量值，请使用 `print $variable` 命令。

   ```
   print $REGION
   us-east-1
   ```

## 预调配其他资源以支持多个控制器节点


按照以下步骤为具有多个控制器节点的 Amazon SageMaker HyperPod Slurm 集群配置更多资源。

1. 将 [sagemaker-hyperpod-slurm-multi-headnode.yaml](https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/sagemaker-hyperpod-slurm-multi-headnode.yaml) 模板文件下载到您的计算机上。第二个 YAML 文件是一个 Amazon CloudFormation 模板，用于定义要为 Slurm 集群中的多个控制器节点支持创建的额外资源。
   + 控制器节点实例组的执行 IAM 角色
   + Amazon RDS for MariaDB 实例
   + Amazon SNS 主题和订阅
   + Amazon Secrets Manager 适用于 MariaDB 的 Amazon RDS 的凭证

1. 运行以下 CLI 命令创建名为的 Amazon CloudFormation 堆栈`sagemaker-hyperpod-mh`。第二个堆栈使用 Amazon CloudFormation 模板创建其他 Amazon 资源来支持多控制器节点架构。

   ```
   aws cloudformation deploy \
   --template-file /path_to_template/slurm-multi-headnode.yaml \
   --stack-name sagemaker-hyperpod-mh \
   --parameter-overrides \
   SlurmDBSecurityGroupId=$SECURITY_GROUP \
   SlurmDBSubnetGroupId1=$PRIMARY_SUBNET \
   SlurmDBSubnetGroupId2=$BACKUP_SUBNET \
   SNSSubEmailAddress=$EMAIL \
   SlurmDBUsername=$DB_USER_NAME \
   --capabilities CAPABILITY_NAMED_IAM
   ```

   有关更多信息，请参阅[通过 Amazon Command Line Interface 参考进行部署](https://docs.amazonaws.cn//cli/latest/reference/cloudformation/deploy/)。堆栈创建可能需要几分钟才能完成。堆栈创建完成后，您将在命令行界面中看到以下内容。

   ```
   Waiting for changeset to be created..
   Waiting for stack create/update to complete
   Successfully created/updated stack - sagemaker-hyperpod-mh
   ```

1. （可选）在 [Amazon Cloud Formation 控制台](https://console.amazonaws.cn/cloudformation/home)中验证堆栈。
   + 从左侧导航栏中，选择**堆栈**。
   + 在**堆栈**页面上，找到并选择**sagemaker-hyperpod-mh**。
   + 选择**资源**和**输出**等标签页以查看资源和输出。

1. 从堆栈（`sagemaker-hyperpod-mh`）输出中创建环境变量。您将使用这些变量的值来更新[准备并上传生命周期脚本](sagemaker-hyperpod-multihead-slurm-scripts.md)中的配置文件（`provisioning_parameters.json`）。

   ```
   source .env
   SLURM_DB_ENDPOINT_ADDRESS=$(aws --region us-east-1 cloudformation describe-stacks --stack-name $MULTI_HEAD_SLURM_STACK --query 'Stacks[0].Outputs[?OutputKey==`SlurmDBEndpointAddress`].OutputValue' --output text)
   SLURM_DB_SECRET_ARN=$(aws --region us-east-1 cloudformation describe-stacks --stack-name $MULTI_HEAD_SLURM_STACK --query 'Stacks[0].Outputs[?OutputKey==`SlurmDBSecretArn`].OutputValue' --output text)
   SLURM_EXECUTION_ROLE_ARN=$(aws --region us-east-1 cloudformation describe-stacks --stack-name $MULTI_HEAD_SLURM_STACK --query 'Stacks[0].Outputs[?OutputKey==`SlurmExecutionRoleArn`].OutputValue' --output text)
   SLURM_SNS_FAILOVER_TOPIC_ARN=$(aws --region us-east-1 cloudformation describe-stacks --stack-name $MULTI_HEAD_SLURM_STACK --query 'Stacks[0].Outputs[?OutputKey==`SlurmFailOverSNSTopicArn`].OutputValue' --output text)
   ```

# 创建并附加 IAM 策略
创建并附加 IAM 策略

此部分介绍如何创建 IAM 策略并将其附加到您在[预调配其他资源以支持多个控制器节点](sagemaker-hyperpod-multihead-slurm-cfn.md#sagemaker-hyperpod-multihead-slurm-cfn-multihead)中创建的执行角色。

1. 从 GitHub存储库将 [IAM 策略示例](https://github.com/aws-samples/awsome-distributed-training/blob/main/1.architectures/5.sagemaker-hyperpod/1.AmazonSageMakerClustersExecutionRolePolicy.json)下载到您的计算机。

1. 使用 [create-policy](https://docs.amazonaws.cn//cli/latest/reference/iam/create-policy.html) CLI 命令通过下载的示例创建 IAM 策略。

   ```
   aws --region us-east-1 iam create-policy \
       --policy-name AmazonSagemakerExecutionPolicy \
       --policy-document file://1.AmazonSageMakerClustersExecutionRolePolicy.json
   ```

   该命令的示例输出。

   ```
   {
       "Policy": {
           "PolicyName": "AmazonSagemakerExecutionPolicy",
           "PolicyId": "ANPAXISIWY5UYZM7WJR4W",
           "Arn": "arn:aws:iam::111122223333:policy/AmazonSagemakerExecutionPolicy",
           "Path": "/",
           "DefaultVersionId": "v1",
           "AttachmentCount": 0,
           "PermissionsBoundaryUsageCount": 0,
           "IsAttachable": true,
           "CreateDate": "2025-01-22T20:01:21+00:00",
           "UpdateDate": "2025-01-22T20:01:21+00:00"
       }
   }
   ```

1. 使用 CL [attach-role-policy](https://docs.amazonaws.cn//cli/latest/reference/iam/attach-role-policy.html)I 命令将策略附加`AmazonSagemakerExecutionPolicy`到您在中[预调配其他资源以支持多个控制器节点](sagemaker-hyperpod-multihead-slurm-cfn.md#sagemaker-hyperpod-multihead-slurm-cfn-multihead)创建的 Slurm 执行角色。

   ```
   aws --region us-east-1 iam attach-role-policy \
       --role-name AmazonSagemakerExecutionRole \
       --policy-arn arn:aws:iam::111122223333:policy/AmazonSagemakerExecutionPolicy
   ```

   此命令不会生成任何输出。

   （可选）如果您使用环境变量，以下是示例命令。
   + 获取角色名称和策略名称 

     ```
     POLICY=$(aws --region $REGION iam list-policies --query 'Policies[?PolicyName==AmazonSagemakerExecutionPolicy].Arn' --output text)
     ROLENAME=$(aws --region $REGION iam list-roles --query "Roles[?Arn=='${SLURM_EXECUTION_ROLE_ARN}'].RoleName" —output text)
     ```
   + 附加 策略

     ```
     aws  --region us-east-1 iam attach-role-policy \
          --role-name $ROLENAME --policy-arn $POLICY
     ```

有关更多信息，请参阅 [IAM 角色适用于 SageMaker HyperPod](sagemaker-hyperpod-prerequisites-iam.md#sagemaker-hyperpod-prerequisites-iam-role-for-hyperpod)。

# 准备并上传生命周期脚本
准备并上传生命周期脚本

创建完所有必需的资源后，您需要为 SageMaker HyperPod 集群设置[生命周期脚本](https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts)。这些[生命周期脚本](https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts)提供了可用于创建[基本 HyperPod Slurm 集群的基本配置](https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config)。

## 准备生命周期脚本


按照以下步骤操作可获取生命周期脚本。

1. 将[生命周期脚本](https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts)从 GitHub 存储库下载到您的计算机。

1. 使用 [cp](https://docs.amazonaws.cn//cli/latest/reference/s3/cp.html) CLI 命令将[生命周期脚本](https://github.com/aws-samples/awsome-distributed-training/tree/main/1.architectures/5.sagemaker-hyperpod/LifecycleScripts)上传到您在[预调配基本资源](sagemaker-hyperpod-multihead-slurm-cfn.md#sagemaker-hyperpod-multihead-slurm-cfn-basic)中创建的 Amazon S3 存储桶。

   ```
   aws s3 cp --recursive LifeCycleScripts/base-config s3://${ROOT_BUCKET_NAME}/LifeCycleScripts/base-config
   ```

## 创建配置文件


按照以下步骤操作，创建配置文件并将其上传到用于存储生命周期脚本的同一 Amazon S3 存储桶。

1. 使用以下配置创建名为 `provisioning_parameters.json` 的配置文件。请注意，`slurm_sns_arn` 是可选项。如果未提供， HyperPod 则无法设置 Amazon SNS 通知。

   ```
   cat <<EOF > /tmp/provisioning_parameters.json
   {
     "version": "1.0.0",
     "workload_manager": "slurm",
     "controller_group": "$CONTOLLER_IG_NAME",
     "login_group": "my-login-group",
     "worker_groups": [
       {
         "instance_group_name": "$COMPUTE_IG_NAME",
         "partition_name": "dev"
       }
     ],
     "fsx_dns_name": "$SLURM_FSX_DNS_NAME",
     "fsx_mountname": "$SLURM_FSX_MOUNT_NAME",
     "slurm_configurations": {
       "slurm_database_secret_arn": "$SLURM_DB_SECRET_ARN",
       "slurm_database_endpoint": "$SLURM_DB_ENDPOINT_ADDRESS",
       "slurm_shared_directory": "/fsx",
       "slurm_database_user": "$DB_USER_NAME",
       "slurm_sns_arn": "$SLURM_SNS_FAILOVER_TOPIC_ARN"
     }
   }
   EOF
   ```

1. 将 `provisioning_parameters.json` 文件上传到用于存储生命周期脚本的同一 Amazon S3 存储桶。

   ```
   aws s3 cp /tmp/provisioning_parameters.json s3://${ROOT_BUCKET_NAME}/LifeCycleScripts/base-config/provisioning_parameters.json
   ```
**注意**  
如果您使用的是 API 驱动的配置，则不需要该`provisioning_parameters.json`文件。使用 API 驱动的配置，您可以直接在 API 负载中定义 Slurm 节点类型、分区和 FSx 挂载。 CreateCluster 有关详细信息，请参阅[ SageMaker HyperPod 使用入门 Amazon CLI](smcluster-getting-started-slurm-cli.md)。

## 验证 Amazon S3 存储桶中的文件


上传所有生命周期脚本和 `provisioning_parameters.json` 文件后，Amazon S3 存储桶应如下所示。

![\[图片显示了在 Amazon Simple Storage Service 控制台中上传到 Amazon S3 存储桶的所有生命周期脚本。\]](http://docs.amazonaws.cn/sagemaker/latest/dg/images/hyperpod/hyperpod-lifecycle-scripts-s3.png)


有关更多信息，请参阅[从提供的基本生命周期脚本开始 HyperPod](https://docs.amazonaws.cn//sagemaker/latest/dg/sagemaker-hyperpod-lifecycle-best-practices-slurm-slurm-base-config.html)。

# 创建集 SageMaker HyperPod 群
创建集群

设置完所有必需资源并将脚本上传到 Amazon S3 存储桶后，您可以创建集群。

1. 要创建集群，请运行[https://docs.amazonaws.cn//cli/latest/reference/sagemaker/create-cluster.html](https://docs.amazonaws.cn//cli/latest/reference/sagemaker/create-cluster.html) Amazon CLI 命令。创建过程可能最多需要 15 分钟才能完成。

   ```
   aws --region $REGION sagemaker create-cluster \
       --cluster-name $HP_CLUSTER_NAME \
       --vpc-config '{
           "SecurityGroupIds":["'$SECURITY_GROUP'"],
           "Subnets":["'$PRIMARY_SUBNET'", "'$BACKUP_SUBNET'"]
       }' \
       --instance-groups '[{                  
       "InstanceGroupName": "'$CONTOLLER_IG_NAME'",
       "InstanceType": "ml.t3.medium",
       "InstanceCount": 2,
       "LifeCycleConfig": {
           "SourceS3Uri": "s3://'$BUCKET_NAME'",
           "OnCreate": "on_create.sh"
       },
       "ExecutionRole": "'$SLURM_EXECUTION_ROLE_ARN'",
       "ThreadsPerCore": 1
   },
   {
       "InstanceGroupName": "'$COMPUTE_IG_NAME'",          
       "InstanceType": "ml.c5.xlarge",
       "InstanceCount": 2,
       "LifeCycleConfig": {
           "SourceS3Uri": "s3://'$BUCKET_NAME'",
           "OnCreate": "on_create.sh"
       },
       "ExecutionRole": "'$COMPUTE_NODE_ROLE'",
       "ThreadsPerCore": 1
   }]'
   ```

   成功执行后，该命令会返回集群 ARN，如下所示。

   ```
   {
       "ClusterArn": "arn:aws:sagemaker:us-east-1:111122223333:cluster/cluster_id"
   }
   ```

1. （可选）要检查集群的状态，您可以使用 SageMaker AI 控制台（[https://console.aws.amazon.com/sagemaker/](https://console.amazonaws.cn/sagemaker/)）。从左侧导航栏中选择 “**HyperPod 集群**”，然后选择 “**集群管理**”。选择集群名称以打开集群详细信息页面。如果您的集群已成功创建，您将看到集群状态为**InService**。  
![\[该图显示了 Amazon A SageMaker I 控制台中包含多个控制器节点的 HyperPod Slurm 集群。\]](http://docs.amazonaws.cn/sagemaker/latest/dg/images/hyperpod/hyperpod-lifecycle-multihead-cluster.png)

# 考虑重要说明
注意事项

此部分提供了一些重要说明，可能会对您有所帮助。

1. 要迁移到多控制器 Slurm 集群，请完成以下步骤。

   1. 按照[使用 Amazon CloudFormation 堆栈配置资源](sagemaker-hyperpod-multihead-slurm-cfn.md)中的说明操作以预调配所有必需的资源。

   1. 按照[准备并上传生命周期脚本](sagemaker-hyperpod-multihead-slurm-scripts.md)中的说明操作以上传更新后的生命周期脚本。更新 `provisioning_parameters.json` 文件时，将现有的控制器组移到 `worker_groups` 部分，并在 `controller_group` 部分中添加新的控制器组名称。

   1. 运行 [update-cluster](https://docs.amazonaws.cn/cli/latest/reference/sagemaker/update-cluster.html) API 调用以创建新的控制器组，并保留原始计算实例组和控制器组。

1. 要缩减控制器节点的数量，请使用 [update-cluster](https://docs.amazonaws.cn/cli/latest/reference/sagemaker/update-cluster.html) CLI 命令。对于每个控制器实例组，可缩减至的最小控制器节点数为 1。这意味着您无法将控制器节点数缩减至 0。
**重要**  
对于 2025 年 1 月 24 日之前创建的集群，在运行 update-cluster CLI 命令之前，必须先使用 [UpdateClusterSoftware](https://docs.amazonaws.cn/sagemaker/latest/APIReference/API_UpdateClusterSoftware.html)API [更新集群](https://docs.amazonaws.cn/cli/latest/reference/sagemaker/update-cluster.html)软件。

   以下是用于缩减控制器节点数的 CLI 命令示例。

   ```
   aws sagemaker update-cluster \
       --cluster-name my_cluster \
       --instance-groups '[{                  
       "InstanceGroupName": "controller_ig_name",
       "InstanceType": "ml.t3.medium",
       "InstanceCount": 3,
       "LifeCycleConfig": {
           "SourceS3Uri": "s3://amzn-s3-demo-bucket1",
           "OnCreate": "on_create.sh"
       },
       "ExecutionRole": "slurm_execution_role_arn",
       "ThreadsPerCore": 1
   },
   {
       "InstanceGroupName": "compute-ig_name",       
       "InstanceType": "ml.c5.xlarge",
       "InstanceCount": 2,
       "LifeCycleConfig": {
           "SourceS3Uri": "s3://amzn-s3-demo-bucket1",
           "OnCreate": "on_create.sh"
       },
       "ExecutionRole": "compute_node_role_arn",
       "ThreadsPerCore": 1
   }]'
   ```

1. 要批量删除控制器节点，请使用 [batch-delete-cluster-nodes](https://docs.amazonaws.cn/cli/latest/reference/sagemaker/batch-delete-cluster-nodes.html)CLI 命令。对于每个控制器实例组，您必须至少保留一个控制器节点。如果要批量删除所有控制器节点，则 API 操作将不起作用。
**重要**  
对于 2025 年 1 月 24 日之前创建的集群，必须先使用 [UpdateClusterSoftware](https://docs.amazonaws.cn/sagemaker/latest/APIReference/API_UpdateClusterSoftware.html)API 更新集群软件，然后才能运行 [batch-delete-cluster-nodes](https://docs.amazonaws.cn/cli/latest/reference/sagemaker/batch-delete-cluster-nodes.html)CLI 命令。

   以下是用于批量删除控制器节点的 CLI 命令示例。

   ```
   aws sagemaker batch-delete-cluster-nodes --cluster-name my_cluster --node-ids instance_ids_to_delete
   ```

1. 要对集群创建问题进行故障排除，请查看 SageMaker AI 控制台中集群详细信息页面上的失败消息。您还可以使用 CloudWatch日志来解决集群创建问题。在 CloudWatch 控制台中，选择**日志组**。然后，搜索 `clusters` 以查看与集群创建相关的日志组列表。  
![\[该图显示了 CloudWatch控制台中的 Amazon SageMaker HyperPod 集群日志组。\]](http://docs.amazonaws.cn/sagemaker/latest/dg/images/hyperpod/hyperpod-lifecycle-multihead-logs.png)

# 查看环境变量参考
环境变量参考

[为 SageMaker HyperPod Slurm 集群设置多个控制器节点](sagemaker-hyperpod-multihead-slurm-setup.md)教程中定义并使用以下环境变量。这些环境变量仅在当前会话中可用，除非将其显式保留。它们是使用 `$variable_name` 语法定义的。 key/value 成对的变量表示 Amazon创建的资源，而没有键的变量是用户定义的。


**环境变量参考**  

| 变量 | 说明 | 
| --- | --- | 
| \$1BACKUP\$1SUBNET |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1COMPUTE\$1IG\$1NAME |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1COMPUTE\$1NODE\$1ROLE |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1CONTOLLER\$1IG\$1NAME |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1DB\$1USER\$1NAME |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1EMAIL |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1PRIMARY\$1SUBNET |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1POLICY |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1REGION |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1ROOT\$1BUCKET\$1NAME |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1SECURITY\$1GROUP |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1SLURM\$1DB\$1ENDPOINT\$1ADDRESS |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1SLURM\$1DB\$1SECRET\$1ARN |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1SLURM\$1EXECUTION\$1ROLE\$1ARN |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1SLURM\$1FSX\$1DNS\$1NAME |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1SLURM\$1FSX\$1MOUNT\$1NAME |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 
| \$1SLURM\$1SNS\$1FAILOVER\$1TOPIC\$1ARN |  [\[See the AWS documentation website for more details\]](http://docs.amazonaws.cn/sagemaker/latest/dg/sagemaker-hyperpod-multihead-slurm-variables-reference.html)  | 