-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Now in Interface Policy, we only return devices when calling Allocate, this is definitely enough for k8s-device-plugin, however, as a kubernetes scheduler developer, I would like to leverage this helper library to build GPU topology aware scheduler plugin, specifically the score extension point which requires a score in prioritizing
go-gpuallocator/gpuallocator/allocator.go
Lines 24 to 32 in 8fc3087
| type Policy interface { | |
| // Allocate is meant to do the heavy-lifting of implementing the actual | |
| // allocation strategy of the policy. It takes a slice of devices to | |
| // allocate GPUs from, and an amount 'size' to allocate from that slice. It | |
| // then returns a subset of devices of length 'size'. If the policy is | |
| // unable to allocate 'size' GPUs from the slice of input devices, it | |
| // returns an empty slice. | |
| Allocate(available []*Device, required []*Device, size int) []*Device | |
| } |
so I wonder whether we can extend the Allocate method return two values, like
Allocate(available []*Device, required []*Device, size int) ([]*Device, int)
Which then can be reused by other components.
The disadvantage is some policy like SimplyPolicy doesn't need the score at all.
Another option is we'll add another interface like PriorityPolicy which helps in prioritizing then the bestEffort policy can implement it. This requires to change the allocator.Allocator() anyway.
I can help to implement either way if accepted, hope to see your feedbacks.
/kind feature