예제 #1
0
def write_generic_summary(data_dir,
                          output_dir,
                          title,
                          devices,
                          networks=None,
                          use_networks=False):
    """
    Given a data directory and output directory, this function writes
    a generic summary assuming that the data has a field keyed by device
    (cpu/gpu) and optionally by network. It writes a summary and status to the output dir.
    """
    try:
        all_data = sort_data(data_dir)
        most_recent = all_data[-1]

        summary = None
        if use_networks:
            summary = summary_by_dev_and_network(most_recent, devices,
                                                 networks)
        else:
            summary = summary_by_dev(most_recent, devices)
        write_summary(output_dir, title, summary)
        write_status(output_dir, True, 'success')

        # TODO do something about comparisons to previous days
    except Exception as e:
        write_status(output_dir, False,
                     'Exception encountered:\n' + render_exception(e))
예제 #2
0
def main(data_dir, config_dir, output_dir):
    config, msg = validate(config_dir)
    if config is None:
        write_status(output_dir, False, msg)
        return 1

    all_data = sort_data(data_dir)
    most_recent = all_data[-1]
    most_recent = {k: v for (k, v) in most_recent.items() if k not in METADATA_KEYS}
    summary = ''

    for (model, targets) in most_recent.items():
        # simulated target summary
        sim_targets = {target: targets[target] for target in targets if target in SIM_TARGETS}
        for (target, devices) in sim_targets.items():
            for (device, stats) in devices.items():
                summary += '_Stats on ({}, {}, {}) & _\n'.format(model, target.upper(), device.upper())
                for (stat, val) in stats.items():
                    summary += '{}: {:.2E}\n'.format(stat, Decimal(val))
        # physical target summary
        phys_targets = {target: v for (target, v) in targets.items() if target in PHYS_TARGETS}
        for (target, devices) in phys_targets.items():
            for (device, mean_time) in devices.items():
                summary += 'Time on ({}, {}, {}): {:.2f}\n'.format(
                        model, target.upper(), device.upper(), mean_time)

    write_summary(output_dir, config['title'], summary)
    write_status(output_dir, True, 'success')
예제 #3
0
def main(data_dir, config_dir, output_dir):
    try:
        config, msg = validate_trials_config(config_dir)
        if config is None:
            write_status(output_dir, False, msg)
            return 1

        all_data = sort_data(data_dir)
        most_recent = all_data[-1]

        summary = summarize(config, most_recent)
        write_summary(output_dir, 'Pareto Curve Trial', summary)
        write_status(output_dir, True, 'success')

    except Exception as e:
        write_status(output_dir, False, 'Exception encountered: ' + render_exception(e))
        return 1