Ejemplo n.º 1
0
def replot(csv=None, rm=False, show_out=None):
    # Load csv graph data
    data = np.loadtxt(csv, delimiter=',')

    # Re-plot graph
    if 'atoms_per_core_vs_running_time' in csv:
        do_plot_1(*data, show_graph=show_out)

    if 'graph_size_vs_running_time' in csv:
        do_plot_2(*data, show_graph=show_out)

    if 'packet_drop_vs_time_scale_factor' in csv:
        do_plot_3(*data, show_graph=show_out)

    # If demanded, remove original graph
    if rm:
        os.unlink(csv)
        os.unlink(csv[:-4] + '.png')


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='Plots graph size vs. Python / SpiNNaker running times.')
    parser.add_argument('csv', help='CSV data file to recompute from')
    parser.add_argument('-r', '--rm', action='store_true')
    parser.add_argument('-o', '--show-out', action='store_true')

    # Recreate the same graphs for the same arguments
    random.seed(42)
    setup_cli_and_run(parser, replot)
Ejemplo n.º 2
0
def run(runs=None, **kwargs):
    import tqdm

    results = [runner(_mk_sim_run, **kwargs)
               for _ in tqdm.tqdm(range(runs), total=runs)]
    correct = sum(map(int, results))
    print('Finished robustness test with %d/%d passed.' % (correct, runs))


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Run random Page Rank graphs')
    parser.add_argument('-r', '--runs', type=int, default=1,
                        help='# runs. Default is 1.')
    parser.add_argument('node_count', metavar='NODES', type=int,
                        help='# nodes per graph')
    parser.add_argument('edge_count', metavar='EDGES', type=int,
                        help='# edges per graph')
    parser.add_argument('-v', '--verify', action='store_true',
                        help='Verify sim w/ Python PR impl')
    parser.add_argument('-p', '--pause', action='store_true',
                        help='Pause after each runs')
    parser.add_argument('-o', '--show-out', action='store_true',
                        help='Display ranks curves output')
    parser.add_argument('-l', '--log-level', type=int, default=25,
                        help='The integer log level to set')

    # Recreate the same graphs for the same arguments
    random.seed(42)
    setup_cli_and_run(parser, run)
Ejemplo n.º 3
0
                        help='# nodes per graph')
    parser.add_argument('edge_count',
                        metavar='EDGES',
                        type=int,
                        help='# edges per graph')
    parser.add_argument('tsf_min',
                        metavar='TSF_MIN',
                        type=int,
                        help='min time_scale_factor')
    parser.add_argument('tsf_res',
                        metavar='TSF_res',
                        type=int,
                        default=10,
                        help='time_scale_factor resolution. Default is 10.')
    parser.add_argument('tsf_max',
                        metavar='TSF_MAX',
                        type=int,
                        help='max time_scale_factor')
    parser.add_argument('-v',
                        '--verify',
                        action='store_true',
                        help='Verify sim w/ Python PR impl')
    parser.add_argument('-p',
                        '--pause',
                        action='store_true',
                        help='Pause after each runs')

    # Recreate the same graphs for the same arguments
    random.seed(42)
    setup_cli_and_run(parser, sim_worker)