An ACK managed Pro cluster supports GPU sharing. Set the policy parameter of the GPU sharing add-on to select from different computing power allocation policies. The policy determines how a GPU divides its computing power among the containers that share it.
For more information about cGPU, see What is cGPU?.
Prerequisites
-
An ACK managed Pro cluster is created, and the Kubernetes version of the cluster is 1.18.8 or later. For information about how to upgrade Kubernetes, see Manually upgrade a cluster.
-
The cGPU version is 1.0.6 or later. For information about how to upgrade cGPU, see Upgrade the cGPU version of a node.
Usage notes
-
If a node already has the cGPU isolation module installed, you must restart the node after you install the GPU sharing add-on for the policy to take effect. For more information, see Restart an instance.
ImportantA restart interrupts the workloads that run on the node, and the policy applies to all GPU-sharing nodes in the cluster. Change the policy and restart the nodes during off-peak hours, after you move or stop the GPU workloads on each node.
NoteLog on to the node and run the
cat /proc/cgpu_km/versioncommand to check whether the cGPU isolation module is installed. If a cGPU version number is returned, the cGPU isolation module is installed. -
If the cGPU isolation module is not installed on your node or has been uninstalled, the policy takes effect immediately after you install the GPU sharing add-on.
-
All GPU-sharing nodes in the same cluster must use the same policy.
Step 1: Check whether the GPU sharing add-on is installed
When you configure a computing power allocation policy for GPU sharing, the procedure differs depending on whether the GPU sharing add-on is installed. Therefore, first check whether the add-on is installed in your cluster.
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
On the Helm page, check whether ack-ai-installer is in the add-on list.
If ack-ai-installer is present, the GPU sharing add-on is installed; if it is absent, the GPU sharing add-on is not installed.
Step 2: Configure a computing power allocation policy for GPU sharing
Select the tab that matches your cluster state.
GPU sharing add-on not installed
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
On the Cloud-native AI Suite page, click Deploy.
-
In the Scheduling section, select Scheduling Policy Extension (Batch Task Scheduling, GPU Sharing, Topology-aware GPU Scheduling), and then click Advanced.
-
On the Parameters page, modify the
policyfield, and then click OK.cgpu: enabled: true image: acs/cgpu-installer tag: v1.5.3-8d3fc1b-aliyun financeCloudImageTag: v1.0.7-fin imagePullPolicy: IfNotPresent policy: 1 nodeSelector: {} checkRegions: trueThe following table describes the valid values. For more information, see cGPU usage examples.
Value
Description
0
Fair-share scheduling. Each container occupies a fixed time slice. The time slice ratio is
1/max_inst.1
Preemptive scheduling. Each container occupies as many time slices as possible. The time slice ratio is 1 divided by the number of current containers.
2
Weight-based preemptive scheduling. This policy is automatically used if you set ALIYUN_COM_GPU_SCHD_WEIGHT to an integer from 2 to max_inst when you create a container.
3
Fixed percentage scheduling. Allocates a fixed percentage of computing power. The percentage is the ratio of ALIYUN_COM_GPU_SCHD_WEIGHT to max_inst.
4
Soft scheduling. Provides weaker isolation than preemptive scheduling.
5
Native scheduling. The policy uses the GPU driver's own scheduling method.
-
At the bottom of the page, click Deploy Cloud-native AI Suite.
GPU sharing add-on already installed
-
Edit the DaemonSet that installs the cGPU isolation module in the GPU sharing add-on.
kubectl edit daemonset cgpu-installer -nkube-system -
Modify and save the DaemonSet that installs the cGPU isolation module.
-
Check the image version of the DaemonSet by using the
imagefield.Make sure that the image version is v1.0.6 or later. The following example shows the
imagefield:image: registry-vpc.cn-hongkong.aliyuncs.com/acs/cgpu-installer:<image_version> -
Modify the
value.Under
spec.template.spec.containers, set thePOLICYvalueto the target policy value.# Other fields are omitted. spec: template: spec: containers: - env: - name: POLICY value: "1" # Other fields are omitted.value: The following table describes the valid values.Value
Description
0
Fair-share scheduling. Each container occupies a fixed time slice. The time slice ratio is
1/max_inst.1
Preemptive scheduling. Each container occupies as many time slices as possible. The time slice ratio is 1 divided by the number of current containers.
2
Weight-based preemptive scheduling. This policy is automatically used if you set ALIYUN_COM_GPU_SCHD_WEIGHT to an integer from 2 to max_inst when you create a container.
3
Fixed percentage scheduling. Allocates a fixed percentage of computing power. The percentage is the ratio of ALIYUN_COM_GPU_SCHD_WEIGHT to max_inst.
4
Soft scheduling. Provides weaker isolation than preemptive scheduling.
5
Native scheduling. The policy uses the GPU driver's own scheduling method.
-
-
Restart the GPU-sharing node instances. For more information, see Restart an instance.
ImportantA restart interrupts the workloads that run on the node. Move or stop the GPU workloads on the node before you restart it.