diff --git a/charts/hami/templates/scheduler/device-configmap.yaml b/charts/hami/templates/scheduler/device-configmap.yaml index 7501d0a45c..3d8f478934 100644 --- a/charts/hami/templates/scheduler/device-configmap.yaml +++ b/charts/hami/templates/scheduler/device-configmap.yaml @@ -176,6 +176,23 @@ data: memory: 32768 aiCore: 10 aiCPU: 3 + - chipName: 910B4-1 + commonWord: Ascend910B4-1 + resourceName: huawei.com/Ascend910B4-1 + resourceMemoryName: huawei.com/Ascend910B4-1-memory + memoryAllocatable: 65536 + memoryCapacity: 65536 + aiCore: 20 + aiCPU: 7 + templates: + - name: vir05_1c_8g + memory: 8192 + aiCore: 5 + aiCPU: 1 + - name: vir10_3c_16g + memory: 16384 + aiCore: 10 + aiCPU: 3 - chipName: 910B4 commonWord: Ascend910B4 resourceName: huawei.com/Ascend910B4 diff --git a/charts/hami/values.yaml b/charts/hami/values.yaml index 73ed4afcb7..b671a6445a 100644 --- a/charts/hami/values.yaml +++ b/charts/hami/values.yaml @@ -9,7 +9,7 @@ global: ## - myRegistryKeySecretName ## @param global.imagePullSecrets Global Docker image pull secrets imagePullSecrets: [] - imageTag: "v2.6.0" + imageTag: "v2.6.1" gpuHookPath: /usr/local labels: {} annotations: {} @@ -384,6 +384,8 @@ devices: - huawei.com/Ascend910B3-memory - huawei.com/Ascend910B4 - huawei.com/Ascend910B4-memory + - huawei.com/Ascend910B4-1 + - huawei.com/Ascend910B4-1-memory - huawei.com/Ascend310P - huawei.com/Ascend310P-memory diff --git a/pkg/device/enflame/gcu.go b/pkg/device/enflame/gcu.go index 8a23b70b3a..bac63224b9 100644 --- a/pkg/device/enflame/gcu.go +++ b/pkg/device/enflame/gcu.go @@ -136,7 +136,7 @@ func (dev *GCUDevices) AddResourceUsage(pod *corev1.Pod, n *device.DeviceUsage, return nil } -func (gcuDev *GCUDevices) Fit(devices []*device.DeviceUsage, request device.ContainerDeviceRequest, annos map[string]string, pod *corev1.Pod, nodeInfo *device.NodeInfo, allocated *device.PodDevices) (bool, map[string]device.ContainerDevices, string) { +func (gcuDev *GCUDevices) Fit(devices []*device.DeviceUsage, request device.ContainerDeviceRequest, pod *corev1.Pod, nodeInfo *device.NodeInfo, allocated *device.PodDevices) (bool, map[string]device.ContainerDevices, string) { k := request originReq := k.Nums klog.InfoS("Allocating device for container request", "pod", klog.KObj(pod), "card request", k) diff --git a/pkg/device/enflame/gcu_test.go b/pkg/device/enflame/gcu_test.go index e3f0d25fb7..a6bfc2188c 100644 --- a/pkg/device/enflame/gcu_test.go +++ b/pkg/device/enflame/gcu_test.go @@ -577,7 +577,12 @@ func TestGCUDevices_Fit(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { allocated := &device.PodDevices{} - fit, result, reason := dev.Fit(test.devices, test.request, test.annos, &corev1.Pod{}, &device.NodeInfo{}, allocated) + pod := &corev1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Annotations: test.annos, + }, + } + fit, result, reason := dev.Fit(test.devices, test.request, pod, &device.NodeInfo{}, allocated) if fit != test.wantFit { t.Errorf("Fit: got %v, want %v", fit, test.wantFit) } diff --git a/pkg/monitor/nvidia/v1/spec.go b/pkg/monitor/nvidia/v1/spec.go index 5bfcd9363d..bf01ca4113 100644 --- a/pkg/monitor/nvidia/v1/spec.go +++ b/pkg/monitor/nvidia/v1/spec.go @@ -90,7 +90,7 @@ func (s Spec) DeviceNum() int { func (s Spec) DeviceMemoryContextSize(idx int) uint64 { v := uint64(0) - for _, p := range s.sr.procs { + for _, p := range s.sr.procs[:int(s.sr.procnum)] { v += p.used[idx].contextSize } return v @@ -98,7 +98,7 @@ func (s Spec) DeviceMemoryContextSize(idx int) uint64 { func (s Spec) DeviceMemoryModuleSize(idx int) uint64 { v := uint64(0) - for _, p := range s.sr.procs { + for _, p := range s.sr.procs[:int(s.sr.procnum)] { v += p.used[idx].moduleSize } return v @@ -106,7 +106,7 @@ func (s Spec) DeviceMemoryModuleSize(idx int) uint64 { func (s Spec) DeviceMemoryBufferSize(idx int) uint64 { v := uint64(0) - for _, p := range s.sr.procs { + for _, p := range s.sr.procs[:int(s.sr.procnum)] { v += p.used[idx].bufferSize } return v @@ -114,7 +114,7 @@ func (s Spec) DeviceMemoryBufferSize(idx int) uint64 { func (s Spec) DeviceMemoryOffset(idx int) uint64 { v := uint64(0) - for _, p := range s.sr.procs { + for _, p := range s.sr.procs[:int(s.sr.procnum)] { v += p.used[idx].offset } return v @@ -122,7 +122,7 @@ func (s Spec) DeviceMemoryOffset(idx int) uint64 { func (s Spec) DeviceMemoryTotal(idx int) uint64 { v := uint64(0) - for _, p := range s.sr.procs { + for _, p := range s.sr.procs[:int(s.sr.procnum)] { v += p.used[idx].total } return v @@ -130,7 +130,7 @@ func (s Spec) DeviceMemoryTotal(idx int) uint64 { func (s Spec) DeviceSmUtil(idx int) uint64 { v := uint64(0) - for _, p := range s.sr.procs { + for _, p := range s.sr.procs[:int(s.sr.procnum)] { v += p.deviceUtil[idx].smUtil } return v diff --git a/pkg/monitor/nvidia/v1/spec_test.go b/pkg/monitor/nvidia/v1/spec_test.go index 548f403c1e..39dadda27a 100644 --- a/pkg/monitor/nvidia/v1/spec_test.go +++ b/pkg/monitor/nvidia/v1/spec_test.go @@ -114,6 +114,7 @@ func Test_DeviceMemoryContextSize(t *testing.T) { idx: int(0), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -150,6 +151,7 @@ func Test_DeviceMemoryContextSize(t *testing.T) { idx: int(1), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -205,6 +207,7 @@ func Test_DeviceMemoryModuleSize(t *testing.T) { idx: int(0), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -241,6 +244,7 @@ func Test_DeviceMemoryModuleSize(t *testing.T) { idx: int(1), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -296,6 +300,7 @@ func Test_DeviceMemoryBufferSize(t *testing.T) { idx: int(0), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -332,6 +337,7 @@ func Test_DeviceMemoryBufferSize(t *testing.T) { idx: int(1), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -387,6 +393,7 @@ func Test_DeviceMemoryOffset(t *testing.T) { idx: int(0), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -423,6 +430,7 @@ func Test_DeviceMemoryOffset(t *testing.T) { idx: int(1), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -478,6 +486,7 @@ func Test_DeviceMemoryTotal(t *testing.T) { idx: int(0), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -514,6 +523,7 @@ func Test_DeviceMemoryTotal(t *testing.T) { idx: int(1), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { used: [16]deviceMemory{ @@ -569,6 +579,7 @@ func Test_DeviceSmUtil(t *testing.T) { idx: int(0), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { deviceUtil: [16]deviceUtilization{ @@ -605,6 +616,7 @@ func Test_DeviceSmUtil(t *testing.T) { idx: int(1), spec: &Spec{ sr: &sharedRegionT{ + procnum: 2, procs: [1024]shrregProcSlotT{ { deviceUtil: [16]deviceUtilization{