Пример #1
0
def load_experiment(sched_file, scheduler, duration, param_file, out_dir):
    if not os.path.isfile(sched_file):
        raise IOError("Cannot find schedule file: %s" % sched_file)

    dir_name, fname = os.path.split(sched_file)
    exp_name = os.path.split(dir_name)[1] + "/" + fname

    params = {}
    kernel = copts = ""

    param_file = param_file or \
      "%s/%s" % (dir_name, conf.DEFAULTS['params_file'])

    if os.path.isfile(param_file):
        params = com.load_params(param_file)
        scheduler = scheduler or params[conf.PARAMS['sched']]
        duration  = duration  or params[conf.PARAMS['dur']]

        # Experiments can specify required kernel name
        if conf.PARAMS['kernel'] in params:
            kernel = params[conf.PARAMS['kernel']]
        # Or required config options
        if conf.PARAMS['copts'] in params:
            copts = params[conf.PARAMS['copts']]

    duration = duration or conf.DEFAULTS['duration']

    if not scheduler:
        raise IOError("Parameter scheduler not specified in %s" % (param_file))

    # Parse schedule file's intentions
    schedule = load_schedule(sched_file)
    work_dir = "%s/tmp" % dir_name

    fix_paths(schedule, os.path.split(sched_file)[0], sched_file)

    verify_environment(kernel, copts)

    run_exp(exp_name, schedule, scheduler, kernel, duration, work_dir, out_dir)

    # Save parameters used to run experiment in out_dir
    out_params = dict(params.items() +
                      [(conf.PARAMS['sched'],  scheduler),
                       (conf.PARAMS['tasks'],  len(schedule['spin'])),
                       (conf.PARAMS['dur'],    duration)])

    # Feather-trace clock frequency saved for accurate overhead parsing
    ft_freq = com.ft_freq()
    if ft_freq:
        out_params[conf.PARAMS['cycles']] = ft_freq

    with open("%s/%s" % (out_dir, conf.DEFAULTS['params_file']), 'w') as f:
        f.write(str(out_params))
Пример #2
0
def load_experiment(sched_file, cmd_scheduler, cmd_duration,
                    param_file, out_dir, ignore, jabber):
    '''Load and parse data from files and run result.'''
    if not os.path.isfile(sched_file):
        raise IOError("Cannot find schedule file: %s" % sched_file)

    dir_name, fname = os.path.split(sched_file)
    exp_name = os.path.split(dir_name)[1] + "/" + fname
    work_dir = "%s/tmp" % dir_name

    # Load parameter file
    param_file = param_file or \
      "%s/%s" % (dir_name, conf.DEFAULTS['params_file'])
    if os.path.isfile(param_file):
        file_params = com.load_params(param_file)
    else:
        file_params = {}

    # Create input needed by Experiment
    exp_params = get_exp_params(cmd_scheduler, cmd_duration, file_params)
    procs, execs = load_schedule(exp_name, sched_file, exp_params.duration)

    exp = Experiment(exp_name, exp_params.scheduler, work_dir, out_dir,
                     procs, execs, exp_params.tracers)

    if not ignore:
        verify_environment(exp_params)

    run_parameter(dir_name, work_dir, file_params, 'pre')

    exp.run_exp()

    run_parameter(dir_name, out_dir, file_params, 'post')

    if jabber:
        jabber.send("Completed '%s'" % exp_name)

    # Save parameters used to run experiment in out_dir
    out_params = dict(file_params.items() +
                      [(conf.PARAMS['sched'],  exp_params.scheduler),
                       (conf.PARAMS['tasks'],  len(execs)),
                       (conf.PARAMS['dur'],    exp_params.duration)])

    # Feather-trace clock frequency saved for accurate overhead parsing
    ft_freq = com.ft_freq()
    if ft_freq:
        out_params[conf.PARAMS['cycles']] = ft_freq

    with open("%s/%s" % (out_dir, conf.DEFAULTS['params_file']), 'w') as f:
        f.write(str(out_params))
Пример #3
0
def run_experiment(data, start_message, ignore, jabber):
    '''Load and parse data from files and run result.'''
    if not os.path.isfile(data.sched_file):
        raise IOError("Cannot find schedule file: %s" % data.sched_file)

    dir_name, fname = os.path.split(data.sched_file)
    work_dir = "%s/tmp" % dir_name

    procs, execs = load_schedule(data.name, data.sched_file, data.params.duration)

    pre_executables = []
    #Load QPS executables to pass as parameter to Experiment class
    if data.params.scheduler == 'QPS':
        pre_executables += load_sets(os.path.join(dir_name, FILES['sets_file']))
        pre_executables += load_masters(os.path.join(dir_name, FILES['masters_file']))

    if data.params.scheduler == 'RUN':
        pre_executables += load_nodes(os.path.join(dir_name, FILES['nodes_file']))

    exp = Experiment(data.name, data.params.scheduler, work_dir,
                     data.out_dir, procs, execs, data.params.tracers, pre_executables)

    exp.log(start_message)

    if not ignore:
        verify_environment(data.params)

    run_script(data.params.pre_script, exp, dir_name, work_dir)

    exp.run_exp()

    run_script(data.params.post_script, exp, dir_name, data.out_dir)

    if jabber:
        jabber.send("Completed '%s'" % data.name)

    # Save parameters used to run dataeriment in out_dir
    out_params = dict([(PARAMS['sched'],  data.params.scheduler),
                       (PARAMS['tasks'],  len(execs)),
                       (PARAMS['dur'],    data.params.duration)] +
                       data.params.file_params.items())

    # Feather-trace clock frequency saved for accurate overhead parsing
    ft_freq = com.ft_freq()
    if ft_freq:
        out_params[PARAMS['cycles']] = ft_freq

    out_param_f = "%s/%s" % (data.out_dir, FILES['params_file'])
    with open(out_param_f, 'w') as f:
        pprint.pprint(out_params, f)
Пример #4
0
def run_experiment(data, start_message, ignore, jabber):
    '''Load and parse data from files and run result.'''
    if not os.path.isfile(data.sched_file):
        raise IOError("Cannot find schedule file: %s" % data.sched_file)

    dir_name, fname = os.path.split(data.sched_file)
    work_dir = "%s/tmp" % dir_name

    procs, execs = load_schedule(data.name, data.sched_file, data.params.duration)
    
    pre_executables = []
    #Load QPS executables to pass as parameter to Experiment class
    if data.params.scheduler == 'QPS':
        pre_executables += load_sets(os.path.join(dir_name, FILES['sets_file'])) 
        pre_executables += load_masters(os.path.join(dir_name, FILES['masters_file']))
        
    if data.params.scheduler == 'RUN':
        pre_executables += load_nodes(os.path.join(dir_name, FILES['nodes_file']))
        
    exp = Experiment(data.name, data.params.scheduler, work_dir,
                     data.out_dir, procs, execs, data.params.tracers, pre_executables)

    exp.log(start_message)

    if not ignore:
        verify_environment(data.params)

    run_script(data.params.pre_script, exp, dir_name, work_dir)

    exp.run_exp()

    run_script(data.params.post_script, exp, dir_name, data.out_dir)

    if jabber:
        jabber.send("Completed '%s'" % data.name)

    # Save parameters used to run dataeriment in out_dir
    out_params = dict([(PARAMS['sched'],  data.params.scheduler),
                       (PARAMS['tasks'],  len(execs)),
                       (PARAMS['dur'],    data.params.duration)] +
                       data.params.file_params.items())

    # Feather-trace clock frequency saved for accurate overhead parsing
    ft_freq = com.ft_freq()
    if ft_freq:
        out_params[PARAMS['cycles']] = ft_freq

    out_param_f = "%s/%s" % (data.out_dir, FILES['params_file'])
    with open(out_param_f, 'w') as f:
        pprint.pprint(out_params, f)
Пример #5
0
         'sched_data' : 'st-{}.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
          'copts'   : 'config-options',  # Required kernel configuration options
          '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.'''
DEFAULTS = {'params_file' : 'params.py',
            'sched_file'  : 'sched.py',
            'duration'    : 10,
            'spin'        : 'rtspin',
            'cycles'      : ft_freq() or 2000}

'''Default sched_trace events (this is all of them).'''
SCHED_EVENTS = range(501, 513)

'''Overhead events.'''
OVH_BASE_EVENTS  = ['SCHED', 'RELEASE', 'SCHED2', 'TICK', 'CXS']
OVH_ALL_EVENTS   = ["%s_%s" % (e, t) for (e,t) in
                    itertools.product(OVH_BASE_EVENTS, ["START","END"])]
OVH_ALL_EVENTS  += ['RELEASE_LATENCY']
# This event doesn't have a START and END
OVH_BASE_EVENTS += ['RELEASE_LATENCY']
Пример #6
0
    'cycles': 'clock-frequency',  # Frequency run_exps was run with
    'tasks': 'tasks',  # Number of tasks
    'trial': 'trial',  # For multiple exps with same config
    'pre': 'pre-experiment',  # Run before each experiment
    'post': 'post-experiment',  # Run after each experiment
    'trace': 'tracers'  # Tracers to run with an experiment
}
'''Default values for program options.'''
DEFAULTS = {
    'duration': 10,
    'prog': 'rtspin',
    'out-gen': 'exps',
    'out-run': 'run-data',
    'out-parse': 'parse-data',
    'out-plot': 'plot-data',
    'cycles': ft_freq() or 2000
}
'''Default sched_trace events (this is all of them).'''
SCHED_EVENTS = range(501, 513)
'''Overhead events.'''
OVH_BASE_EVENTS = [
    'SCHED', 'RELEASE', 'SCHED2', 'TICK', 'CXS', 'LOCK', 'UNLOCK'
]
OVH_ALL_EVENTS = [
    "%s_%s" % (e, t)
    for (e, t) in itertools.product(OVH_BASE_EVENTS, ["START", "END"])
]
OVH_ALL_EVENTS += ['RELEASE_LATENCY']
# This event doesn't have a START and END
OVH_BASE_EVENTS += ['RELEASE_LATENCY']