Skip to content

Commit

Permalink
Fix node gpu info init
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxuzhonghu committed Jun 23, 2020
1 parent ca7818c commit 70ad2b2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/scheduler/api/node_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,19 @@ func (ni *NodeInfo) setNodeGPUInfo(node *v1.Node) {
if node == nil {
return
}
if memory, ok := node.Status.Capacity[VolcanoGPUNumber]; ok {
ni.GPUTotalMemory = memory.Value()
memory, ok := node.Status.Capacity[VolcanoGPUResource]
if !ok {
return
}
ni.GPUTotalMemory = memory.Value()

gpuNumber, ok := node.Status.Capacity[VolcanoGPUNumber]
if ok {
ni.GPUNumber = gpuNumber.Value()
if !ok {
return
}
ni.GPUNumber = gpuNumber.Value()

memoryPerCard := uint(ni.GPUTotalMemory / ni.GPUNumber)

for i := 0; i < int(ni.GPUNumber); i++ {
ni.GPUDevices[i] = NewGPUDevice(i, memoryPerCard)
}
Expand Down

0 comments on commit 70ad2b2

Please sign in to comment.