

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

# 使用 Slurm 進行多個執行個體類型配置
<a name="slurm-multiple-instance-allocation-v3"></a>

從 3.3.0 AWS ParallelCluster 版開始，您可以設定叢集從運算資源的一組已定義的執行個體類型進行配置。配置可以根據 Amazon EC2 機群低成本或最佳容量策略。

這組已定義的執行個體類型必須全部具有相同數量vCPUs，或者，如果停用多執行緒，則必須具有相同數量的核心。此外，這組執行個體類型必須具有相同製造商的相同加速器數量。如果 [`Efa`](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-Efa) / [`Enabled`](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-Efa-Enabled) 設定為 `true`，則執行個體必須支援 EFA。如需詳細資訊和需求，請參閱 [`Scheduling`](Scheduling-v3.md) / / [`SlurmQueues`](Scheduling-v3.md#Scheduling-v3-SlurmQueues) [`AllocationStrategy`](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-AllocationStrategy)和 [`ComputeResources`](Scheduling-v3.md#Scheduling-v3-SlurmQueues-ComputeResources) / [`Instances`](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-Instances)。

您可以`capacity-optimized`根據您的 [CapacityType](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-CapacityType) 組態[`AllocationStrategy`](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-AllocationStrategy)，將 設定為 `lowest-price`或 。

在 中[`Instances`](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-Instances)，您可以設定一組執行個體類型。

**注意**  
從 3.7.0 AWS ParallelCluster 版開始，如果您在[執行個體](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-Instances)中設定多個執行個體類型，`EnableMemoryBasedScheduling`則可以啟用 。  
對於 3.2.0 到 3.6.{{x}} AWS ParallelCluster 版，如果您在[執行個體](Scheduling-v3.md#yaml-Scheduling-SlurmQueues-ComputeResources-Instances)中設定多個執行個體類型，則`EnableMemoryBasedScheduling`無法啟用 。

下列範例示範如何查詢 vCPUs、EFA 支援和架構的執行個體類型。

InstanceTypes 使用 96 個 vCPUs和 x86\_64 架構進行查詢。

```
$ aws ec2 describe-instance-types --region {{region-id}} \
  --filters "Name=vcpu-info.default-vcpus,Values=96" "Name=processor-info.supported-architecture,Values=x86_64" \
  --query "sort_by(InstanceTypes[*].{InstanceType:InstanceType,MemoryMiB:MemoryInfo.SizeInMiB,CurrentGeneration:CurrentGeneration,VCpus:VCpuInfo.DefaultVCpus,Cores:VCpuInfo.DefaultCores,Architecture:ProcessorInfo.SupportedArchitectures[0],MaxNetworkCards:NetworkInfo.MaximumNetworkCards,EfaSupported:NetworkInfo.EfaSupported,GpuCount:GpuInfo.Gpus[0].Count,GpuManufacturer:GpuInfo.Gpus[0].Manufacturer}, &InstanceType)" \
  --output table
```

InstanceTypes 具有 64 個核心、EFA 支援和 arm64 架構的查詢。

```
$ aws ec2 describe-instance-types --region {{region-id}} \
  --filters "Name=vcpu-info.default-cores,Values=64" "Name=processor-info.supported-architecture,Values=arm64" "Name=network-info.efa-supported,Values=true" --query "sort_by(InstanceTypes[*].{InstanceType:InstanceType,MemoryMiB:MemoryInfo.SizeInMiB,CurrentGeneration:CurrentGeneration,VCpus:VCpuInfo.DefaultVCpus,Cores:VCpuInfo.DefaultCores,Architecture:ProcessorInfo.SupportedArchitectures[0],MaxNetworkCards:NetworkInfo.MaximumNetworkCards,EfaSupported:NetworkInfo.EfaSupported,GpuCount:GpuInfo.Gpus[0].Count,GpuManufacturer:GpuInfo.Gpus[0].Manufacturer}, &InstanceType)" \
  --output table
```

下一個範例叢集組態程式碼片段顯示如何使用這些 InstanceType和 AllocationStrategy 屬性。

```
...
 Scheduling:
  Scheduler: slurm
  SlurmQueues:
    - Name: queue-1
      CapacityType: ONDEMAND
      AllocationStrategy: lowest-price
      ...
      ComputeResources:
        - Name: computeresource1
          Instances:
            - InstanceType: r6g.2xlarge
            - InstanceType: m6g.2xlarge
            - InstanceType: c6g.2xlarge
          MinCount: 0
          MaxCount: 500
        - Name: computeresource2
          Instances:
            - InstanceType: m6g.12xlarge
            - InstanceType: x2gd.12xlarge
          MinCount: 0
          MaxCount: 500
...
```