Documentation ¶
Overview ¶
* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of the * License at * * https://opensource.org/licenses/Apache-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.
* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of the * License at * * https://opensource.org/licenses/Apache-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.
* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of the * License at * * https://opensource.org/licenses/Apache-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func NodeInfoSort(less ...LessFunc) *nodeInfoPriority
- type DeviceInfo
- type LessFunc
- type NodeInfo
- func (n *NodeInfo) AddUsedResources(devID int, vcore uint, vmemory uint) error
- func (n *NodeInfo) GetAvailableCore() int
- func (n *NodeInfo) GetAvailableMemory() int
- func (n *NodeInfo) GetDeviceCount() int
- func (n *NodeInfo) GetDeviceMap() map[int]*DeviceInfo
- func (n *NodeInfo) GetName() string
- func (n *NodeInfo) GetNode() *v1.Node
Constants ¶
This section is empty.
Variables ¶
var ( // ByAllocatableCores compares two device or node by allocatable cores ByAllocatableCores = func(p1, p2 interface{}) bool { var result bool switch p1.(type) { case *DeviceInfo: d1 := p1.(*DeviceInfo) d2 := p2.(*DeviceInfo) result = d1.AllocatableCores() < d2.AllocatableCores() case *NodeInfo: n1 := p1.(*NodeInfo) n2 := p2.(*NodeInfo) result = n1.GetAvailableCore() < n2.GetAvailableCore() } return result } // ByAllocatableMemory compares two device or node by allocatable memory ByAllocatableMemory = func(p1, p2 interface{}) bool { var result bool switch p1.(type) { case *DeviceInfo: d1 := p1.(*DeviceInfo) d2 := p2.(*DeviceInfo) result = d1.AllocatableMemory() < d2.AllocatableMemory() case *NodeInfo: n1 := p1.(*NodeInfo) n2 := p2.(*NodeInfo) result = n1.GetAvailableMemory() < n2.GetAvailableMemory() } return result } ByID = func(p1, p2 interface{}) bool { var result bool switch p1.(type) { case *DeviceInfo: d1 := p1.(*DeviceInfo) d2 := p2.(*DeviceInfo) result = d1.GetID() < d2.GetID() case *NodeInfo: n1 := p1.(*NodeInfo) n2 := p2.(*NodeInfo) result = n1.GetName() < n2.GetName() } return result } )
Functions ¶
func NodeInfoSort ¶
func NodeInfoSort(less ...LessFunc) *nodeInfoPriority
Types ¶
type DeviceInfo ¶
type DeviceInfo struct {
// contains filtered or unexported fields
}
func (*DeviceInfo) AddUsedResources ¶
func (dev *DeviceInfo) AddUsedResources(usedCore uint, usedMemory uint) error
AddUsedResources records the used GPU core and memory
func (*DeviceInfo) AllocatableCores ¶
func (d *DeviceInfo) AllocatableCores() uint
AllocatableCores returns the remaining cores of this GPU device
func (*DeviceInfo) AllocatableMemory ¶
func (d *DeviceInfo) AllocatableMemory() uint
AllocatableMemory returns the remaining memory of this GPU device
type LessFunc ¶
type LessFunc func(p1, p2 interface{}) bool
LessFunc represents funcion to compare two DeviceInfo or NodeInfo
type NodeInfo ¶
type NodeInfo struct {
// contains filtered or unexported fields
}
func (*NodeInfo) AddUsedResources ¶
AddUsedResources records the used GPU core and memory
func (*NodeInfo) GetAvailableCore ¶
GetAvailableCore returns the remaining cores of this node
func (*NodeInfo) GetAvailableMemory ¶
GetAvailableMemory returns the remaining memory of this node
func (*NodeInfo) GetDeviceCount ¶
GetDeviceCount returns the number of GPU devices
func (*NodeInfo) GetDeviceMap ¶
func (n *NodeInfo) GetDeviceMap() map[int]*DeviceInfo
GetDeviceMap returns each GPU device information structure