diff --git a/analysis/engine/optimizer.py b/analysis/engine/optimizer.py index 02f71e444e2ddc9cc158ccbca45967519b8f86be..46dedb8ec9d17c4488e04cb2aaddc893d5e86ffa 100644 --- a/analysis/engine/optimizer.py +++ b/analysis/engine/optimizer.py @@ -64,7 +64,9 @@ class Optimizer(Resource): engine = optimizer.Optimizer(task_id, args["knobs"], child_conn, engine=args.get("engine"), max_eval=args.get("max_eval"), 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() value = {} diff --git a/analysis/engine/parser.py b/analysis/engine/parser.py index aad41f1657197c8bfb98adbd4f3c8fc8cbcf6ab8..6a21748bde78b1e71bd5850bc1812419090698f3 100644 --- a/analysis/engine/parser.py +++ b/analysis/engine/parser.py @@ -36,6 +36,10 @@ OPTIMIZER_POST_PARSER.add_argument('feature_filter', type=bool, location='json', help="the feature_filter enabled") OPTIMIZER_POST_PARSER.add_argument('split_count', type=int, location='json', 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.add_argument('iterations', type=int, required=True, diff --git a/common/config/config.go b/common/config/config.go index dcc3a406c4641e5b280c64fed31d7f2698abb150..a65c6a70627519841e228a005945afa3aa1d164f 100644 --- a/common/config/config.go +++ b/common/config/config.go @@ -114,6 +114,12 @@ var ( TLSHTTPCACertFile string ) +// the tuning configs +var ( + Noise float64 + SelFeature bool +) + // the system config in atuned.cnf var ( Network string @@ -188,6 +194,10 @@ func (c *Cfg) Load() error { 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 { return err } diff --git a/common/models/optimizer.go b/common/models/optimizer.go index 418fd007ebb9cc774374e388e4cb5ef474e66e4b..abc227075cbfcb7f040641c4f05da26bb9e08ec9 100644 --- a/common/models/optimizer.go +++ b/common/models/optimizer.go @@ -31,6 +31,8 @@ type OptimizerPostBody struct { Yref []string `json:"y_ref,omitempty"` FeatureFilter bool `json:"feature_filter"` SplitCount int32 `json:"split_count"` + Noise float64 `json:"noise"` + SelFeature bool `json:"sel_feature"` } // Knob body store the tuning properties diff --git a/common/tuning/optimizer.go b/common/tuning/optimizer.go index adc891683ef6123cc62d8ab5703507ec18c14ba6..782d52bfaa1a4efd0459232121c57bb24492d6ed 100644 --- a/common/tuning/optimizer.go +++ b/common/tuning/optimizer.go @@ -131,7 +131,9 @@ func (o *Optimizer) createOptimizerTask(ch chan *PB.TuningMessage, iters int32, optimizerBody.Engine = engine optimizerBody.RandomStarts = o.RandomStarts optimizerBody.FeatureFilter = o.FeatureFilter + optimizerBody.SelFeature = config.SelFeature optimizerBody.SplitCount = o.SplitCount + optimizerBody.Noise = config.Noise optimizerBody.Knobs = make([]models.Knob, 0) for _, item := range o.Prj.Object { if item.Info.Skip { @@ -361,6 +363,9 @@ func (o *Optimizer) matchRelations(optStr string) bool { func (o *Optimizer) filterParams() (string, error) { log.Infof("params importance weight is: %s", o.RespPutIns.Rank) + if strings.TrimSpace(o.RespPutIns.Rank) == "" { + return "", nil + } sortedParams := make(utils.SortedPair, 0) paramList := strings.Split(o.RespPutIns.Rank, ",") diff --git a/misc/atuned.cnf b/misc/atuned.cnf index 7875f0960dec106ce518ce4f1f6f5af539532e55..51f0eb08fe118c5e4ea4b15a549aa7dea3accf7c 100755 --- a/misc/atuned.cnf +++ b/misc/atuned.cnf @@ -79,3 +79,9 @@ disk = sda network = enp189s0f0 user = root + +#################################### tuning ############################### +# tuning configs +[tuning] +noise = 0.000000001 +sel_feature = false