changed the type of percentage in rapl.Cap(...) from int to float64. Retrofitted power-capping strategies to cap using a float64 value instead of an int. Moved common functions in loganddynamiccap.go and logAndProgressiveExtrema.go into pcp/utils.go. New power-capping strategy that builds on top of extrema, where it caps the victims at different until it can't cap further, in which case it starts uncapping them in the reverse order of capping.
This commit is contained in:
parent
d5d3c87ff2
commit
d42b7a3a3b
9 changed files with 237 additions and 56 deletions
|
@ -157,7 +157,7 @@ func (s *BinPackedPistonCapper) Disconnected(sched.SchedulerDriver) {
|
|||
var bpPistonCapValues = make(map[string]float64)
|
||||
|
||||
// Storing the previous cap value for each host so as to not repeatedly cap the nodes to the same value. (reduces overhead)
|
||||
var bpPistonPreviousRoundedCapValues = make(map[string]int)
|
||||
var bpPistonPreviousRoundedCapValues = make(map[string]float64)
|
||||
|
||||
func (s *BinPackedPistonCapper) startCapping() {
|
||||
go func() {
|
||||
|
@ -167,7 +167,7 @@ func (s *BinPackedPistonCapper) startCapping() {
|
|||
// Need to cap each node
|
||||
bpPistonMutex.Lock()
|
||||
for host, capValue := range bpPistonCapValues {
|
||||
roundedCapValue := int(math.Floor(capValue + 0.5))
|
||||
roundedCapValue := float64(int(math.Floor(capValue + 0.5)))
|
||||
// has the cap value changed
|
||||
if prevRoundedCap, ok := bpPistonPreviousRoundedCapValues[host]; ok {
|
||||
if prevRoundedCap != roundedCapValue {
|
||||
|
|
|
@ -157,7 +157,7 @@ var bpMaxMinPistonCappingMutex sync.Mutex
|
|||
var bpMaxMinPistonCappingCapValues = make(map[string]float64)
|
||||
|
||||
// Storing the previous cap value for each host so as to not repeatedly cap the nodes to the same value. (reduces overhead)
|
||||
var bpMaxMinPistonCappingPreviousRoundedCapValues = make(map[string]int)
|
||||
var bpMaxMinPistonCappingPreviousRoundedCapValues = make(map[string]float64)
|
||||
|
||||
func (s *BPSWMaxMinPistonCapping) startCapping() {
|
||||
go func() {
|
||||
|
@ -167,7 +167,7 @@ func (s *BPSWMaxMinPistonCapping) startCapping() {
|
|||
// Need to cap each node
|
||||
bpMaxMinPistonCappingMutex.Lock()
|
||||
for host, capValue := range bpMaxMinPistonCappingCapValues {
|
||||
roundedCapValue := int(math.Floor(capValue + 0.5))
|
||||
roundedCapValue := float64(int(math.Floor(capValue + 0.5)))
|
||||
// has the cap value changed
|
||||
if previousRoundedCap, ok := bpMaxMinPistonCappingPreviousRoundedCapValues[host]; ok {
|
||||
if previousRoundedCap != roundedCapValue {
|
||||
|
|
|
@ -164,7 +164,7 @@ func (s *BPSWMaxMinProacCC) startCapping() {
|
|||
if bpMaxMinProacCCCapValue > 0.0 {
|
||||
for _, host := range constants.Hosts {
|
||||
// Rounding cap value to nearest int
|
||||
if err := rapl.Cap(host, "rapl", int(math.Floor(bpMaxMinProacCCCapValue+0.5))); err != nil {
|
||||
if err := rapl.Cap(host, "rapl", float64(int(math.Floor(bpMaxMinProacCCCapValue+0.5)))); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func (s *BPSWMaxMinProacCC) startRecapping() {
|
|||
if s.isRecapping && bpMaxMinProacCCRecapValue > 0.0 {
|
||||
for _, host := range constants.Hosts {
|
||||
// Rounding the recap value to the nearest int
|
||||
if err := rapl.Cap(host, "rapl", int(math.Floor(bpMaxMinProacCCRecapValue+0.5))); err != nil {
|
||||
if err := rapl.Cap(host, "rapl", float64(int(math.Floor(bpMaxMinProacCCRecapValue+0.5)))); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ func (s *FirstFitProacCC) startCapping() {
|
|||
if fcfsCurrentCapValue > 0.0 {
|
||||
for _, host := range constants.Hosts {
|
||||
// Rounding curreCapValue to the nearest int.
|
||||
if err := rapl.Cap(host, "rapl", int(math.Floor(fcfsCurrentCapValue+0.5))); err != nil {
|
||||
if err := rapl.Cap(host, "rapl", float64(int(math.Floor(fcfsCurrentCapValue+0.5)))); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func (s *FirstFitProacCC) startRecapping() {
|
|||
if s.isRecapping && fcfsRecapValue > 0.0 {
|
||||
for _, host := range constants.Hosts {
|
||||
// Rounding curreCapValue to the nearest int.
|
||||
if err := rapl.Cap(host, "rapl", int(math.Floor(fcfsRecapValue+0.5))); err != nil {
|
||||
if err := rapl.Cap(host, "rapl", float64(int(math.Floor(fcfsRecapValue+0.5)))); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ func (s *FirstFitSortedWattsProacCC) startCapping() {
|
|||
if rankedCurrentCapValue > 0.0 {
|
||||
for _, host := range constants.Hosts {
|
||||
// Rounding currentCapValue to the nearest int.
|
||||
if err := rapl.Cap(host, "rapl", int(math.Floor(rankedCurrentCapValue+0.5))); err != nil {
|
||||
if err := rapl.Cap(host, "rapl", float64(int(math.Floor(rankedCurrentCapValue+0.5)))); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ func (s *FirstFitSortedWattsProacCC) startRecapping() {
|
|||
if s.isRecapping && rankedRecapValue > 0.0 {
|
||||
for _, host := range constants.Hosts {
|
||||
// Rounding currentCapValue to the nearest int.
|
||||
if err := rapl.Cap(host, "rapl", int(math.Floor(rankedRecapValue+0.5))); err != nil {
|
||||
if err := rapl.Cap(host, "rapl", float64(int(math.Floor(rankedRecapValue+0.5)))); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue