The overall scheduling logic is illustrated as below. Ascend Device Plugin discovers Ascend AI Processor resources and reports them. Volcano is a scheduler adapted and modified by Huawei based on the open source Volcano framework.
Field Description
- Ascend Device Plugin (open source version) reports node resources in ConfigMap format. The reported resource format is huawei.com/resource name:resource name+physical ID, as shown in Figure 3. The marked part in the figure indicates the list of available Ascend AI processors, calculated by the total number of healthy Ascend AI processors minus the number of Ascend AI processors allocated by Volcano. The information about all healthy Ascend AI processors is obtained by calling the NPU driver interface. The processors allocated by Volcano are obtained by traversing all pods that meet the conditions on the current node. That is, the pod status is not Failed or Succeeded, and the pod's Annotations contains the Ascend AI processor information allocated by Volcano.
- You can log in to the background environment and run the kubectl describe cm mindx-dl-deviceinfo-{nodeName} -n kube-system command to obtain the reported resource information.
- This field huawei.com/resource name will be deleted in later versions. By default, the available processors of a node are maintained by Volcano, and this field does not take effect. To make the field take effect, change the value of the Volcano configuration parameter self-maintain-available-card to false.
Figure 3 Node NPU resource information
- Volcano calculates the available Ascend AI processors based on the node and ConfigMap information. (If self-maintain-available-card of Volcano is disabled, Volcano reads the DeviceInfo field information using huawei.com/resource name as the key to obtain available Ascend AI processors.) Once the Ascend AI processor that satisfies the affinity rules and is required by the job is selected according to the affinity scheduling policy (that is, the Ascend AI processor allocated to the job), Volcano writes the processor allocation information in the pod's Annotations, as shown in the first part of Figure 4. Then, it writes predicate-time, which captures the exact timestamp of resource allocation. This value does not need to be converted into a readable format, but it can be directly used for comparison. Once kubelet detects that a pod is scheduled to its node, it calls the Allocate function of device-plugin to mount the NPU device.
Figure 4 NPU information assigned to the pod
- Ascend Device Plugin receives the Allocate request (two-processor task used as an example). The input parameter of Allocate is randomly allocated by kubelet, as shown in the huawei.com/kltDev field in Figure 4. The value may be the Ascend AI processor ID that does not meet the affinity rule, for example, Ascend910-7 and Ascend910-0.
In this case, Ascend Device Plugin finds all pods that meet the conditions on the current node. Pods are not in the Failed or Succeeded status, and Annotations contains the allocated Ascend AI processor IDs written by Volcano. The count must be the same as the number of Ascend AI processors allocated by kubelet.
Then, select the pod with the smallest predicate-time from the pods that meet the conditions, and change predicate-time to the maximum uint value to prevent future selection. Finally, parse Annotations to obtain the Ascend AI processor information allocated by Volcano, for example, Ascend910-0 and Ascend910-1. Return the information such as the mount path and write the information about the actually allocated Ascend AI processors to huawei.com/AscendReal under Annotations.