ACK Pro clusters support PPU nodes in Lingjun node pools. Verify that the nodes are ready, enable binpack scheduling, and request PPUs in a workload through resources.limits.
Prerequisites
An ACK managed Pro cluster is created, and the ack-rdma-device-plugin and ack-ppu-device-plugin add-ons are installed.
When you install the ack-ppu-device-plugin add-on, select the Enable PPU Topology option. After this option is enabled, the add-on reports PPU topology information, and PPU topology-aware scheduling assigns the optimal PPU combination to your tasks based on the physical topology of PPUs by default. Scheduling requests for 1, 2, 4, 8, or 16 PPUs are supported.
Add existing Lingjun nodes (PPU nodes) to the Lingjun node pool.
Verify that PPU nodes are ready
After you add PPU nodes to the Lingjun node pool, check whether the nodes are ready:
kubectl get nodes -l aliyun.accelerator/xpu_type=ppuAfter a PPU node is ready, the node has the following PPU-related Kubernetes labels:
Label | Description | Example |
aliyun.accelerator/xpu_type | The type of accelerator. | ppu |
aliyun.accelerator/ppu_name | The model name of the PPU. | PPU-ZW810E |
aliyun.accelerator/ppu_count | The number of PPUs per node. | 16 |
aliyun.accelerator/ppu_mem | The memory size of each PPU. | 98304MiB |
View the labels of a node:
kubectl get node <NODE_NAME> -o jsonpath='{.metadata.labels}' | jq 'to_entries[ ] | select(.key | startswith("aliyun.accelerator"))'Enable the binpack scheduling policy
To prioritize placing PPU tasks on the same node and reduce resource fragmentation, it is recommended that you enable the binpack scheduling policy.
-
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 Components and Add-ons .
Find Kube Scheduler and click Configuration. Configure the parameters in the Kube Scheduler Parameters dialog box.
Enable Pod scheduling prioritizes consolidating Pods on fewer nodes.
In the binpackResourceWeight area, click Add and set resourceName to
alibabacloud.com/pputo enable the binpack scheduling policy for PPU resources.
Deploy a PPU application
After the configuration is complete, request PPU resources by using resources.limits in a workload. The following example shows how to deploy an application that requests one PPU:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: ppu
name: ppu-test
namespace: default
spec:
selector:
matchLabels:
app: ppu
template:
metadata:
labels:
app: ppu
spec:
containers:
- image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6
imagePullPolicy: IfNotPresent
name: ppu
ports:
- containerPort: 80
protocol: TCP
resources:
limits:
alibabacloud.com/ppu: "1"
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
tolerations:
- key: node-role.alibabacloud.com/lingjun
operator: Exists
effect: NoScheduleKey configurations:
resources.limits.alibabacloud.com/ppu: The number of requested PPUs. Valid values: 1, 2, 4, 8, and 16.tolerations: Add a toleration for thenode-role.alibabacloud.com/lingjuntaint on Lingjun nodes. Otherwise, pods cannot be scheduled to PPU nodes.
Verify the result
Check whether the pod is scheduled to a PPU node and running normally:
kubectl get pod -l app=ppu -o wideIn the expected output, the status of the pod is Running, and the NODE column shows the name of a PPU node.
View the PPU allocation of the node on which the pod runs:
kubectl describe node <NODE_NAME> | grep -A 5 "Allocated resources"The expected output shows that the alibabacloud.com/ppu resource is allocated.