Skip to content

Commit

Permalink
scheduler: assure only gpu will allocate by topology
Browse files Browse the repository at this point in the history
Signed-off-by: wangjianyu.wjy <wangjianyu.wjy@alibaba-inc.com>
  • Loading branch information
wangjianyu.wjy committed Aug 28, 2024
1 parent e1d910a commit 8e0a3ba
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions pkg/scheduler/plugins/deviceshare/device_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,24 @@ func (a *AutopilotAllocator) allocateDevices(requestCtx *requestContext, nodeDev
if deviceAllocations[deviceType] != nil {
continue
}
topologyGuide := newDeviceTopologyGuide(nodeDevice, requestCtx.requestsPerInstance, deviceType, nil)
allocations, status := a.allocateByTopology(requestCtx, nodeDevice, topologyGuide, deviceType, nil, nil)
if !status.IsSuccess() {
return nil, status
}
if len(allocations) != 0 && len(allocations[deviceType]) != 0 {
deviceAllocations[deviceType] = allocations[deviceType]
if deviceType != schedulingv1alpha1.GPU {
allocations, status := allocateDevices(requestCtx, nodeDevice, deviceType, requestCtx.requestsPerInstance[deviceType], requestCtx.desiredCountPerDeviceType[deviceType], nil)
if !status.IsSuccess() {
return nil, status
}
if len(allocations) != 0 {
deviceAllocations[deviceType] = allocations
}
} else {
// assure only gpu will allocate by topology
topologyGuide := newDeviceTopologyGuide(nodeDevice, requestCtx.requestsPerInstance, deviceType, nil)
allocations, status := a.allocateByTopology(requestCtx, nodeDevice, topologyGuide, deviceType, nil, nil)
if !status.IsSuccess() {
return nil, status
}
if len(allocations) != 0 && len(allocations[deviceType]) != 0 {
deviceAllocations[deviceType] = allocations[deviceType]
}
}
}
return deviceAllocations, nil
Expand Down

0 comments on commit 8e0a3ba

Please sign in to comment.