Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
middleware
/
rtm_services
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
243bc267
authored
Apr 05, 2019
by
Tomasz Ciesielczyk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
evaluation bug fix
parent
2eb84ad9
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
38 deletions
+47
-38
m2dc-powercapping/src/main/kotlin/psnc/m2dc/rtm/CurrentState.kt
+1
-1
m2dc-powercapping/src/main/kotlin/psnc/m2dc/rtm/pcm/PCMApi.kt
+4
-0
m2dc-powercapping/src/main/kotlin/psnc/m2dc/rtm/pcm/algorithm/Evaluation.kt
+17
-11
m2dc-powercapping/src/main/kotlin/psnc/m2dc/rtm/pcm/algorithm/Solver.kt
+13
-14
m2dc-rtm-rest/src/main/kotlin/psnc/m2dc/rtm/commands/java/Version.kt
+2
-2
m2dc-rtm-restclient/src/main/kotlin/psnc/m2dc/rtm/client/Version.kt
+2
-2
m2dc-rtm-utils/src/main/kotlin/psnc/m2dc/mock/rtm/rpm/RECSApiMock.kt
+7
-7
m2dc-rtm-utils/src/main/kotlin/psnc/m2dc/rtm/properties/keys/RTM.kt
+1
-1
No files found.
m2dc-powercapping/src/main/kotlin/psnc/m2dc/rtm/CurrentState.kt
View file @
243bc267
...
...
@@ -40,7 +40,7 @@ class CurrentState(val powerUsage: Double) {
private
var
activeMachines
:
ArrayList
<
NodeUtil
>
=
ArrayList
()
fun
getNodeUtil
(
resourceId
:
String
):
NodeUtil
?
{
return
activeMachines
.
find
{
it
.
nodeId
==
resourceId
}
?:
this
.
unusedMachines
.
find
{
it
.
nodeId
==
resourceId
}
?:
null
?:
this
.
unusedMachines
.
find
{
it
.
nodeId
==
resourceId
}
}
/**
...
...
m2dc-powercapping/src/main/kotlin/psnc/m2dc/rtm/pcm/PCMApi.kt
View file @
243bc267
...
...
@@ -15,6 +15,7 @@ import psnc.m2dc.rtm.rpm.RPMApi
import
psnc.m2dc.rtm.utils.Timer
import
psnc.m2dc.rtm.utils.printConsole
import
psnc.m2dc.rtm.utils.sum
import
psnc.m2dc.rtm.utils.toJson
class
PCMApi
()
{
//#region initialize INSTANCE
...
...
@@ -194,6 +195,9 @@ class PCMApi() {
}
else
{
this
.
getMaxPowerUsageList
()
}
printConsole
(
"test0:"
+
this
.
getPowerCappingStrategy
())
printConsole
(
"test1:"
+
map
.
toJson
())
printConsole
(
"test2:"
+
map
.
sum
())
if
(
totalLimit
==
null
)
{
totalLimit
=
this
.
getMaxPowerUsageList
().
sum
()
}
...
...
m2dc-powercapping/src/main/kotlin/psnc/m2dc/rtm/pcm/algorithm/Evaluation.kt
View file @
243bc267
...
...
@@ -70,7 +70,7 @@ class Evaluation(initialPowerToReduce: Double, tradeOff: Double = 0.4, private v
open
class
PowerMode
(
val
alpha
:
Double
/*,val beta: Double=1.0*/
)
{
companion
object
{
fun
valueOf
(
s
:
String
)
=
when
(
s
)
{
"MAX_PERFOR
RMANCE"
->
MAX_PERFOR
RMANCE
"MAX_PERFOR
MANCE"
->
MAX_PERFO
RMANCE
"PERFORMANCE"
->
PERFORMANCE
"BALANCED"
->
BALANCED
"EFFICIENCY"
->
EFFICIENCY
...
...
@@ -81,11 +81,11 @@ class Evaluation(initialPowerToReduce: Double, tradeOff: Double = 0.4, private v
override
fun
toString
()
=
this
::
class
.
java
.
simpleName
object
MAX_PERFOR
RMANCE
:
PowerMode
(
0
.0
)
object
PERFORMANCE
:
PowerMode
(
0.
2
)
object
BALANCED
:
PowerMode
(
0.
5
5
)
object
EFFICIENCY
:
PowerMode
(
0.
8
5
)
object
MAX_EFFICIENCY
:
PowerMode
(
1
.0
)
object
MAX_PERFOR
MANCE
:
PowerMode
(
1
.0
)
object
PERFORMANCE
:
PowerMode
(
0.
75
)
object
BALANCED
:
PowerMode
(
0.
4
5
)
object
EFFICIENCY
:
PowerMode
(
0.
1
5
)
object
MAX_EFFICIENCY
:
PowerMode
(
0
.0
)
class
CUSTOM
(
alpha
:
Double
)
:
PowerMode
(
alpha
)
{
override
fun
toString
():
String
{
return
this
.
toJson
()
...
...
@@ -239,11 +239,17 @@ class Evaluation(initialPowerToReduce: Double, tradeOff: Double = 0.4, private v
val
power
=
model
.
getPower
(
MAX_PERFORMANCE_LVL
,
util_0
)
//TODO: czy na pewno skalować przez utylizacje
val
r_i
=
if
(
currentState
.
priority
>
0.0
&&
currentState
.
priority
<
1.0
)
(
currentState
.
priority
)
/
(
1
-
currentState
.
priority
)
else
1.0
val
performanceImpact
=
Math
.
pow
(
model
.
getPerformance
(
perfLvlx
),
alpha
)
val
efficiencyImpact
=
Math
.
pow
(
model
.
getEfficiency
(
perfLvlx
),
1
-
alpha
)
val
eval
=
power
*
r_i
*
performanceImpact
*
efficiencyImpact
return
eval
val
perfValue
=
model
.
getPerformance
(
perfLvlx
)
val
effValue
=
model
.
getEfficiency
(
perfLvlx
)
if
(
perfValue
>
0
&&
effValue
>
0
)
{
val
performanceImpact
=
Math
.
pow
(
perfValue
,
alpha
)
val
efficiencyImpact
=
Math
.
pow
(
effValue
,
1
-
alpha
)
val
eval
=
power
*
r_i
*
performanceImpact
*
efficiencyImpact
return
eval
}
else
{
return
0.0
}
}
...
...
m2dc-powercapping/src/main/kotlin/psnc/m2dc/rtm/pcm/algorithm/Solver.kt
View file @
243bc267
...
...
@@ -6,6 +6,7 @@ import org.ojalgo.optimisation.Variable
import
org.slf4j.LoggerFactory
import
psnc.m2dc.rtm.model.rpm.StateDefinition
import
psnc.m2dc.rtm.utils.logInfo
import
psnc.m2dc.rtm.utils.printConsole
import
java.util.*
import
java.util.concurrent.atomic.AtomicInteger
...
...
@@ -19,7 +20,7 @@ import java.util.concurrent.atomic.AtomicInteger
* https://github.com/optimatika/ojAlgo/wiki/Using-MPS
*
*/
open
class
Solver
(
e
:
Evaluation
,
var
mode
:
SolverMode
,
val
powerBuffer
:
Double
,
val
algorithm
:
Algorithm
)
:
Algorithm
(
e
)
{
open
class
Solver
(
e
:
Evaluation
,
var
mode
:
SolverMode
,
val
powerBuffer
:
Double
,
val
algorithm
:
Algorithm
)
:
Algorithm
(
e
)
{
enum
class
SolverMode
{
pcm
,
esm
}
...
...
@@ -29,7 +30,6 @@ open class Solver(e: Evaluation, var mode: SolverMode, val powerBuffer: Double,v
}
private
var
currentBudget
:
Double
...
...
@@ -145,18 +145,19 @@ open class Solver(e: Evaluation, var mode: SolverMode, val powerBuffer: Double,v
// }
return
sum
}
fun
solve
():
HashMap
<
String
,
Double
>?{
return
when
(
this
.
algorithm
){
fun
solve
():
HashMap
<
String
,
Double
>?
{
printConsole
(
"Solve via: "
+
this
.
algorithm
)
return
when
(
this
.
algorithm
)
{
Algorithm
.
milp
->
exactAlgo
()
Algorithm
.
greedy
->
approximateAlgo
()
Algorithm
.
random
->
randomAlgo
()
Algorithm
.
simple
->
simpleAlgo
()
Algorithm
.
proportional
->
proportionalAlgo
()
Algorithm
.
random
->
randomAlgo
()
Algorithm
.
simple
->
simpleAlgo
()
Algorithm
.
proportional
->
proportionalAlgo
()
}
}
private
fun
exactAlgo
():
HashMap
<
String
,
Double
>?
{
if
(
upperBoundCheck
(
null
)
<
-
currentBudget
)
{
/**impossible to fulfil requirements*/
...
...
@@ -213,7 +214,7 @@ open class Solver(e: Evaluation, var mode: SolverMode, val powerBuffer: Double,v
return
result
}
private
fun
proportionalAlgo
():
HashMap
<
String
,
Double
>?
{
private
fun
proportionalAlgo
():
HashMap
<
String
,
Double
>?
{
if
(
upperBoundCheck
(
null
)
<
-
currentBudget
)
{
/**impossible to fulfil requirements*/
return
null
...
...
@@ -281,7 +282,7 @@ open class Solver(e: Evaluation, var mode: SolverMode, val powerBuffer: Double,v
return
null
}
private
fun
randomAlgo
():
HashMap
<
String
,
Double
>?
{
private
fun
randomAlgo
():
HashMap
<
String
,
Double
>?
{
if
(
upperBoundCheck
(
null
)
<
-
currentBudget
)
{
/**impossible to fulfil requirements*/
return
null
...
...
@@ -343,7 +344,7 @@ open class Solver(e: Evaluation, var mode: SolverMode, val powerBuffer: Double,v
return
null
}
private
fun
simpleAlgo
():
HashMap
<
String
,
Double
>?
{
private
fun
simpleAlgo
():
HashMap
<
String
,
Double
>?
{
if
(
upperBoundCheck
(
null
)
<
-
currentBudget
)
{
/**impossible to fulfil requirements*/
return
null
...
...
@@ -398,7 +399,7 @@ open class Solver(e: Evaluation, var mode: SolverMode, val powerBuffer: Double,v
return
result
}
private
fun
approximateAlgo
():
HashMap
<
String
,
Double
>?
{
private
fun
approximateAlgo
():
HashMap
<
String
,
Double
>?
{
if
(
upperBoundCheck
(
null
)
<
-
currentBudget
)
{
/**impossible to fulfil requirements*/
return
null
...
...
@@ -476,8 +477,6 @@ open class Solver(e: Evaluation, var mode: SolverMode, val powerBuffer: Double,v
}
}
data class
PerformanceSetting
(
val
settingIndex
:
Int
,
val
solver
:
Solver
)
{
...
...
m2dc-rtm-rest/src/main/kotlin/psnc/m2dc/rtm/commands/java/Version.kt
View file @
243bc267
package
psnc.m2dc.rtm.commands.java
val
APP_VERSION
=
"1.0.550_64170"
\ No newline at end of file
val
APP_VERSION
=
"1.0.551_50237"
\ No newline at end of file
m2dc-rtm-restclient/src/main/kotlin/psnc/m2dc/rtm/client/Version.kt
View file @
243bc267
package
psnc.m2dc.rtm.client
const
val
APP_VERSION
=
"1.1.550_64170"
\ No newline at end of file
const
val
APP_VERSION
=
"1.1.551_50237"
\ No newline at end of file
m2dc-rtm-utils/src/main/kotlin/psnc/m2dc/mock/rtm/rpm/RECSApiMock.kt
View file @
243bc267
...
...
@@ -115,13 +115,13 @@ class RECSApiMock(parser: XStream) : RECSApi(parser) {
return
Pair
(
putXML
?:
""
,
headers
)
}
@Suppress
(
"UNCHECKED_CAST"
)
override
fun
<
T
>
postXML
(
url
:
String
,
body
:
String
?,
headers
:
HashMap
<
String
,
String
>):
Pair
<
T
,
Map
<
String
,
String
>>
{
val
res
=
this
.
put
(
url
,
body
,
headers
).
first
println
(
"recs post output: ${res}"
)
return
Pair
(
XMLParser
.
fromXML
(
res
)
as
T
,
headers
)
}
//
@Suppress("UNCHECKED_CAST")
//
override fun <T> postXML(url: String, body: String?, headers: HashMap<String, String>):
//
Pair<T, Map<String, String>> {
//
val res = this.put(url, body, headers).first
//
println("recs post output: ${res}")
//
return Pair(XMLParser.fromXML(res) as T, headers)
//
}
@Suppress
(
"UNCHECKED_CAST"
)
override
fun
loadRECSHosts
():
List
<
String
>
/*List<LDAPRECSNode>*/
{
...
...
m2dc-rtm-utils/src/main/kotlin/psnc/m2dc/rtm/properties/keys/RTM.kt
View file @
243bc267
...
...
@@ -42,7 +42,7 @@ class RTM {
// val online_data_timeout = RTMProperty(RTM + "online_data_timeout", 15000L /* 1000L*/)
val
debug_actions
=
RTMProperty
(
RTM
+
"debug_actions"
,
false
)
val
power_setting_evaluation_mode
=
RTMProperty
(
RTM
+
"power_setting_evaluation_mode"
,
"BALANCED"
,
description
=
"""
MAX_PERFORRMANCE(
0.0), PERFORMANCE(0.2) ,BALANCED(0.55), EFFICIENCY (0.85),MAX_EFFICIENCY (1
.0), CUSTOM: {"alpa":0.3}
MAX_PERFORRMANCE(
1.0), PERFORMANCE(0.75) ,BALANCED(0.45), EFFICIENCY (0.15),MAX_EFFICIENCY (0
.0), CUSTOM: {"alpa":0.3}
"""
.
trimIndent
())
val
management_threadpool_size
=
RTMProperty
(
RTM
+
"management_threadpool_size"
,
10
)
val
load_node_children
=
RTMProperty
(
RTM
+
"load_node_children"
,
false
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment