Skip to content
Open
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
2 changes: 1 addition & 1 deletion pkg/scheduler/api/devices/nvidia/vgpu/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func checkNodeGPUSharingPredicateAndScore(pod *v1.Pod, gssnap *GPUDevices, repli
continue
}
if val.MemPercentagereq != 101 && val.Memreq == 0 {
val.Memreq = gs.Device[i].Memory * uint(val.MemPercentagereq/100)
val.Memreq = gs.Device[i].Memory * uint(val.MemPercentagereq) / 100

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fix for the integer division is correct. To prevent this bug from recurring, it's important to add a regression test. Please consider adding a unit test for checkNodeGPUSharingPredicateAndScore that verifies the correct memory calculation when a pod requests GPU resources using the volcano.sh/vgpu-memory-percentage annotation.

}
if int(gs.Device[i].Memory)-int(gs.Device[i].UsedMem) < int(val.Memreq) {
continue
Expand Down
Loading