Esempio n. 1
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))
Esempio n. 2
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)
Esempio n. 3
0
def run_exp(name, schedule, scheduler, kernel, duration, work_dir, out_dir):
    proc_entries = []
    executables  = []

    # Parse values for proc entries
    for entry_conf in schedule['proc']:
        path = entry_conf[0]
        data = entry_conf[1]

        if not os.path.exists(path):
            raise IOError("Invalid proc path %s: %s" % (path, name))

        proc_entries += [ProcEntry(path, data)]

    # Parse spinners
    for spin_conf in schedule['spin']:
        if isinstance(spin_conf, str):
            # Just a string defaults to default spin
            (spin, args) = (conf.DEFAULTS['spin'], spin_conf)
        else:
            # Otherwise its a pair, the type and the args
            if len(spin_conf) != 2:
                raise IOError("Invalid spin conf %s: %s" % (spin_conf, name))
            (spin, args) = (spin_conf[0], spin_conf[1])

        # if not conf.BINS[spin]:
        #     raise IndexError("No knowledge of program %s: %s" % (spin, name))

        real_spin = com.get_executable(spin, "")
        real_args = args.split()
        if re.match(".*spin", real_spin):
            real_args = ['-w'] + real_args + [duration]

        if not com.is_executable(real_spin):
            raise OSError("Cannot run spin %s: %s" % (real_spin, name))

        executables += [Executable(real_spin, real_args)]

    exp = Experiment(name, scheduler, work_dir, out_dir,
                     proc_entries, executables)

    exp.run_exp()
Esempio n. 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)