Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions charts/hami/templates/scheduler/device-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion charts/hami/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down Expand Up @@ -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

2 changes: 1 addition & 1 deletion pkg/device/enflame/gcu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion pkg/device/enflame/gcu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/monitor/nvidia/v1/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,47 +90,47 @@ 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)] {
Comment thread
archlitchi marked this conversation as resolved.
v += p.used[idx].contextSize
}
return v
}

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
}

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
}

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
}

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
}

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
Expand Down
12 changes: 12 additions & 0 deletions pkg/monitor/nvidia/v1/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down
Loading