From 7200ba40d1283f56891697cd40df7a118f37d05e Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Mon, 18 Mar 2013 10:52:47 -0400 Subject: Automatically merge experiments with the trial parameter. --- config/config.py | 11 ++++++----- gen/generator.py | 8 ++++---- parse/col_map.py | 3 ++- parse_exps.py | 2 ++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/config/config.py b/config/config.py index 31ef7c7..ec35ea6 100644 --- a/config/config.py +++ b/config/config.py @@ -20,11 +20,12 @@ FILES = {'ft_data' : 'ft.bin', 'log_data' : 'trace.slog'} '''Default parameter names in params.py.''' -PARAMS = {'sched' : 'scheduler', # Scheduler used by run_exps - 'dur' : 'duration', # Duration of tests in run_exps - 'kernel' : 'uname', # Regex of required OS name in run_exps - 'cycles' : 'clock-frequency', # Frequency run_exps was run with - 'tasks' : 'tasks' # Number of tasks +PARAMS = {'sched' : 'scheduler', # Scheduler used by run_exps + 'dur' : 'duration', # Duration of tests in run_exps + 'kernel' : 'uname', # Regex of required OS name in run_exps + 'cycles' : 'clock-frequency', # Frequency run_exps was run with + 'tasks' : 'tasks', # Number of tasks + 'trial' : 'trial' # For multiple exps with same config } '''Default values for program options.''' diff --git a/gen/generator.py b/gen/generator.py index 73ccf45..dbf2a7b 100644 --- a/gen/generator.py +++ b/gen/generator.py @@ -6,7 +6,7 @@ import shutil as sh from Cheetah.Template import Template from collections import namedtuple from common import get_config_option -from config.config import DEFAULTS +from config.config import DEFAULTS,PARAMS from gen.dp import DesignPointGenerator from parse.col_map import ColMapBuilder @@ -199,14 +199,14 @@ class Generator(object): os.mkdir(dir_path) if trials > 1: - dp['trial'] = trial + dp[PARAMS['trial']] = trial self.out_dir = dir_path self._create_exp(dict(dp)) del(self.out_dir) - if 'trial' in dp: - del dp['trial'] + if PARAMS['trial'] in dp: + del dp[PARAMS['trial']] def print_help(self): diff --git a/parse/col_map.py b/parse/col_map.py index 8132639..15e1d64 100644 --- a/parse/col_map.py +++ b/parse/col_map.py @@ -14,7 +14,8 @@ class ColMapBuilder(object): self.value_map[column].add( value ) def try_remove(self, column): - del(self.value_map[column]) + if column in self.value_map: + del(self.value_map[column]) class ColMap(object): def __init__(self, col_list, values = None): diff --git a/parse_exps.py b/parse_exps.py index 4cdc0a1..7dfc9cd 100755 --- a/parse_exps.py +++ b/parse_exps.py @@ -131,6 +131,8 @@ def main(): if opts.ignore: for param in opts.ignore.split(","): builder.try_remove(param) + # Always average multiple trials + builder.try_remove(conf.PARAMS['trial']) col_map = builder.build() result_table = TupleTable(col_map) -- cgit v1.2.2