提交 fe03b0b2 编写于 作者: X Xiaoguang Li

atune: add noise and sel_feature configs

上级 075aaa7a
...@@ -64,7 +64,9 @@ class Optimizer(Resource): ...@@ -64,7 +64,9 @@ class Optimizer(Resource):
engine = optimizer.Optimizer(task_id, args["knobs"], child_conn, engine=args.get("engine"), engine = optimizer.Optimizer(task_id, args["knobs"], child_conn, engine=args.get("engine"),
max_eval=args.get("max_eval"), max_eval=args.get("max_eval"),
n_random_starts=args.get("random_starts"), n_random_starts=args.get("random_starts"),
x0=x_ref, y0=y_ref, split_count=args.get("split_count")) x0=x_ref, y0=y_ref, split_count=args.get("split_count"),
noise=args.get("noise"),
sel_feature=args.get("feature_filter") or args.get("sel_feature"))
engine.start() engine.start()
value = {} value = {}
......
...@@ -36,6 +36,10 @@ OPTIMIZER_POST_PARSER.add_argument('feature_filter', type=bool, location='json', ...@@ -36,6 +36,10 @@ OPTIMIZER_POST_PARSER.add_argument('feature_filter', type=bool, location='json',
help="the feature_filter enabled") help="the feature_filter enabled")
OPTIMIZER_POST_PARSER.add_argument('split_count', type=int, location='json', OPTIMIZER_POST_PARSER.add_argument('split_count', type=int, location='json',
help="split_count cannot be null") help="split_count cannot be null")
OPTIMIZER_POST_PARSER.add_argument('sel_feature', type=bool, location='json',
help="enable the feature selection or not")
OPTIMIZER_POST_PARSER.add_argument('noise', type=float, location='json',
help="the noise can not be null")
OPTIMIZER_PUT_PARSER = reqparse.RequestParser() OPTIMIZER_PUT_PARSER = reqparse.RequestParser()
OPTIMIZER_PUT_PARSER.add_argument('iterations', type=int, required=True, OPTIMIZER_PUT_PARSER.add_argument('iterations', type=int, required=True,
......
...@@ -114,6 +114,12 @@ var ( ...@@ -114,6 +114,12 @@ var (
TLSHTTPCACertFile string TLSHTTPCACertFile string
) )
// the tuning configs
var (
Noise float64
SelFeature bool
)
// the system config in atuned.cnf // the system config in atuned.cnf
var ( var (
Network string Network string
...@@ -188,6 +194,10 @@ func (c *Cfg) Load() error { ...@@ -188,6 +194,10 @@ func (c *Cfg) Load() error {
Network = net Network = net
} }
section = cfg.Section("tuning")
Noise = section.Key("noise").MustFloat64(0.000000001)
SelFeature = section.Key("sel_feature").MustBool(false)
if err := initLogging(cfg); err != nil { if err := initLogging(cfg); err != nil {
return err return err
} }
......
...@@ -31,6 +31,8 @@ type OptimizerPostBody struct { ...@@ -31,6 +31,8 @@ type OptimizerPostBody struct {
Yref []string `json:"y_ref,omitempty"` Yref []string `json:"y_ref,omitempty"`
FeatureFilter bool `json:"feature_filter"` FeatureFilter bool `json:"feature_filter"`
SplitCount int32 `json:"split_count"` SplitCount int32 `json:"split_count"`
Noise float64 `json:"noise"`
SelFeature bool `json:"sel_feature"`
} }
// Knob body store the tuning properties // Knob body store the tuning properties
......
...@@ -131,7 +131,9 @@ func (o *Optimizer) createOptimizerTask(ch chan *PB.TuningMessage, iters int32, ...@@ -131,7 +131,9 @@ func (o *Optimizer) createOptimizerTask(ch chan *PB.TuningMessage, iters int32,
optimizerBody.Engine = engine optimizerBody.Engine = engine
optimizerBody.RandomStarts = o.RandomStarts optimizerBody.RandomStarts = o.RandomStarts
optimizerBody.FeatureFilter = o.FeatureFilter optimizerBody.FeatureFilter = o.FeatureFilter
optimizerBody.SelFeature = config.SelFeature
optimizerBody.SplitCount = o.SplitCount optimizerBody.SplitCount = o.SplitCount
optimizerBody.Noise = config.Noise
optimizerBody.Knobs = make([]models.Knob, 0) optimizerBody.Knobs = make([]models.Knob, 0)
for _, item := range o.Prj.Object { for _, item := range o.Prj.Object {
if item.Info.Skip { if item.Info.Skip {
...@@ -361,6 +363,9 @@ func (o *Optimizer) matchRelations(optStr string) bool { ...@@ -361,6 +363,9 @@ func (o *Optimizer) matchRelations(optStr string) bool {
func (o *Optimizer) filterParams() (string, error) { func (o *Optimizer) filterParams() (string, error) {
log.Infof("params importance weight is: %s", o.RespPutIns.Rank) log.Infof("params importance weight is: %s", o.RespPutIns.Rank)
if strings.TrimSpace(o.RespPutIns.Rank) == "" {
return "", nil
}
sortedParams := make(utils.SortedPair, 0) sortedParams := make(utils.SortedPair, 0)
paramList := strings.Split(o.RespPutIns.Rank, ",") paramList := strings.Split(o.RespPutIns.Rank, ",")
......
...@@ -79,3 +79,9 @@ disk = sda ...@@ -79,3 +79,9 @@ disk = sda
network = enp189s0f0 network = enp189s0f0
user = root user = root
#################################### tuning ###############################
# tuning configs
[tuning]
noise = 0.000000001
sel_feature = false
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册