

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

# 在 AWS PCS 中設定自訂 cgroup 設定
<a name="cgroup-custom-settings"></a>

Slurm 使用 Linux cgroup 子系統來管理和限制任務的資源，包括記憶體、CPU 核心、裝置和交換空間。 AWS PCS 可讓您在叢集建立或更新`SlurmConfiguration`期間，透過 `CgroupCustomSettings` 屬性在叢集層級自訂`cgroup.conf`設定。

## 設定 cgroup 設定
<a name="cgroup-custom-settings-configure"></a>

Cgroup 自訂設定可以在叢集建立期間透過 AWS 主控台、CLI 或 SDKs 進行設定，或在稍後透過更新操作進行修改。

------
#### [ AWS 管理主控台 ]

導覽至叢集資源建立或編輯頁面中的**其他排程器設定**。

**新增設定**

1. 選擇**新增設定**。

1. 從下拉式清單中選取**參數**名稱 （其中包含簡短參數說明）。

1. 提供對應的值。

**取消設定自訂設定**

1. 選擇相關參數/值對旁的**移除**。

1. 建立或更新 資源。

------
#### [ AWS CLI ]

若要以程式設計方式管理 cgroup 設定，請在建立或更新叢集操作中使用 `CgroupCustomSettings` 欄位。

**Example – 在叢集`ConstrainRAMSpace`上設定**  

```
aws pcs update-cluster --cluster-identifier {{my-cluster}} \
--slurm-configuration \
'CgroupCustomSettings=[{parameterName=ConstrainRAMSpace,parameterValue="yes"}]'
```

------

## 叢集支援的 cgroup 設定
<a name="cgroup-custom-settings-cluster"></a>

叢集層級支援下列自訂 cgroup 設定：
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_AllowedRAMSpace](https://slurm.schedmd.com/cgroup.conf.html#OPT_AllowedRAMSpace)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_AllowedSwapSpace](https://slurm.schedmd.com/cgroup.conf.html#OPT_AllowedSwapSpace)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainCores](https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainCores)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainDevices](https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainDevices)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainRAMSpace](https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainRAMSpace)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainSwapSpace](https://slurm.schedmd.com/cgroup.conf.html#OPT_ConstrainSwapSpace)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_IgnoreSystemd](https://slurm.schedmd.com/cgroup.conf.html#OPT_IgnoreSystemd)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_MaxRAMPercent](https://slurm.schedmd.com/cgroup.conf.html#OPT_MaxRAMPercent)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_MaxSwapPercent](https://slurm.schedmd.com/cgroup.conf.html#OPT_MaxSwapPercent)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_MinRAMSpace](https://slurm.schedmd.com/cgroup.conf.html#OPT_MinRAMSpace)
+ [https://slurm.schedmd.com/cgroup.conf.html#OPT_SignalChildrenProcesses](https://slurm.schedmd.com/cgroup.conf.html#OPT_SignalChildrenProcesses)