synchronization
This commit is contained in:
30
gpushare-scheduler-extender/pkg/utils/node.go
Normal file
30
gpushare-scheduler-extender/pkg/utils/node.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package utils
|
||||
|
||||
import "k8s.io/api/core/v1"
|
||||
|
||||
// Is the Node for GPU sharing
|
||||
func IsGPUSharingNode(node *v1.Node) bool {
|
||||
return GetTotalGPUMemory(node) > 0
|
||||
}
|
||||
|
||||
// Get the total GPU memory of the Node
|
||||
func GetTotalGPUMemory(node *v1.Node) int {
|
||||
val, ok := node.Status.Capacity[ResourceName]
|
||||
|
||||
if !ok {
|
||||
return 0
|
||||
}
|
||||
|
||||
return int(val.Value())
|
||||
}
|
||||
|
||||
// Get the GPU count of the node
|
||||
func GetGPUCountInNode(node *v1.Node) int {
|
||||
val, ok := node.Status.Capacity[CountName]
|
||||
|
||||
if !ok {
|
||||
return int(0)
|
||||
}
|
||||
|
||||
return int(val.Value())
|
||||
}
|
Reference in New Issue
Block a user