Exemplo n.º 1
0
def performance(parameter_name, values, config=CONFIG):
    save_folder = generate_folder_name()
    print("\n\nPerformance test for parameter '{}' with values {}".format(parameter_name, values))

    results = np.empty((len(values), 2), dtype=float)
    drop = np.empty((len(values), 2), dtype=float)

    for index, v in enumerate(values):
        print("Run {} with value {} on GPU".format(index+1, v))
        results[index, 0], drop[index, 0] = run((parameter_name, v), ('gpu', True))
        utils.clear_current_line()

        # print("Run {} with value {} on CPU".format(index+1, v))
        # results[index, 1], drop[index, 1] = run((parameter_name, v), ('gpu', False))
        # utils.clear_current_line()

    # print("Results: \n{}".format(results))
    print("Number of dropped solutions: \n " + "GPU: " + format(drop[:, 0]))
    gpu_results = tuple(results[:, 0])
    # cpu_results = tuple(results[:, 1])
    cpu_results = 0
    exp_name = tuple(values)
    utils.save_dict(config, save_folder, 'config_' + parameter_name + '.txt')

    acoc_plotter.plot_bar_graph(gpu_results, cpu_results, exp_name, save=True, show=True, save_folder=SAVE_DIR)
Exemplo n.º 2
0
def performance(parameter_name, values, config=CONFIG):
    save_folder = generate_folder_name()
    print("\n\nPerformance test for parameter '{}' with values {}".format(
        parameter_name, values))

    results = np.empty((len(values), 2), dtype=float)
    drop = np.empty((len(values), 2), dtype=float)

    for index, v in enumerate(values):
        print("Run {} with value {} on GPU".format(index + 1, v))
        results[index, 0], drop[index, 0] = run((parameter_name, v),
                                                ('gpu', True))
        utils.clear_current_line()

        # print("Run {} with value {} on CPU".format(index+1, v))
        # results[index, 1], drop[index, 1] = run((parameter_name, v), ('gpu', False))
        # utils.clear_current_line()

    # print("Results: \n{}".format(results))
    print("Number of dropped solutions: \n " + "GPU: " + format(drop[:, 0]))
    gpu_results = tuple(results[:, 0])
    # cpu_results = tuple(results[:, 1])
    cpu_results = 0
    exp_name = tuple(values)
    utils.save_dict(config, save_folder, 'config_' + parameter_name + '.txt')

    acoc_plotter.plot_bar_graph(gpu_results,
                                cpu_results,
                                exp_name,
                                save=True,
                                show=True,
                                save_folder=SAVE_DIR)
Exemplo n.º 3
0
def benchmark(parameter_name, values, config=CONFIG):
    save_folder = generate_folder_name()
    print("\n\nBenchmark for parameter '{}' with values {}".format(parameter_name, values))

    results = np.empty((len(values), 2), dtype=float)
    for index, v in enumerate(values):
        print("Run {} with value {} on GPU".format(index+1, v))
        results[index, 0] = run((parameter_name, v), ('gpu', True))
        utils.clear_current_line()

        print("Run {} with value {} on CPU".format(index+1, v))
        results[index, 1] = run((parameter_name, v), ('gpu', False))
        utils.clear_current_line()

    result_str = "Results: \n{}".format(results)
    print(result_str)
    utils.save_dict(config, save_folder, 'config_' + parameter_name + '.txt')
    utils.save_string_to_file(result_str, save_folder, 'results.txt')
Exemplo n.º 4
0
def benchmark(parameter_name, values, config=CONFIG):
    save_folder = generate_folder_name()
    print("\n\nBenchmark for parameter '{}' with values {}".format(
        parameter_name, values))

    results = np.empty((len(values), 2), dtype=float)
    for index, v in enumerate(values):
        print("Run {} with value {} on GPU".format(index + 1, v))
        results[index, 0] = run((parameter_name, v), ('gpu', True))
        utils.clear_current_line()

        print("Run {} with value {} on CPU".format(index + 1, v))
        results[index, 1] = run((parameter_name, v), ('gpu', False))
        utils.clear_current_line()

    result_str = "Results: \n{}".format(results)
    print(result_str)
    utils.save_dict(config, save_folder, 'config_' + parameter_name + '.txt')
    utils.save_string_to_file(result_str, save_folder, 'results.txt')