From 1af889bda1a56a251836af91a45104133effc74d Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Mon, 24 Feb 2020 18:27:41 +0000 Subject: [PATCH] did scaling plot with astro2 data --- tests/population/scaling/plot_scaling_new.py | 18 ++++++++--- tests/population/scaling/scaling_script.py | 32 ++++++++++---------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/tests/population/scaling/plot_scaling_new.py b/tests/population/scaling/plot_scaling_new.py index b081d49c2..d758102e1 100644 --- a/tests/population/scaling/plot_scaling_new.py +++ b/tests/population/scaling/plot_scaling_new.py @@ -8,9 +8,16 @@ import math scaling_result_dir = 'scaling_results' +filenames = [ + 'astro2_2500_systems.json', + 'astro2_3000_systems.json', +] + result_jsons = [] -result_jsons.append(os.path.join(os.path.abspath(scaling_result_dir), 'david-Lenovo-IdeaPad-S340-14IWL_100_systems.json')) -result_jsons.append(os.path.join(os.path.abspath(scaling_result_dir), 'david-Lenovo-IdeaPad-S340-14IWL_2500_systems.json')) +for filename in filenames: + result_jsons.append(os.path.join(os.path.abspath(scaling_result_dir), filename)) +# result_jsons.append(os.path.join(os.path.abspath(scaling_result_dir), 'david-Lenovo-IdeaPad-S340-14IWL_100_systems.json')) +# result_jsons.append(os.path.join(os.path.abspath(scaling_result_dir), 'david-Lenovo-IdeaPad-S340-14IWL_2500_systems.json')) fig, ax1 = plt.subplots() ax2 = ax1.twinx() @@ -68,16 +75,19 @@ ax1.set_title( ) ) -ax1.plot([0, max(cpus)], [0, max(cpus)], label='100% scaling') +# ax1.plot([1, max(cpus)], [1, max(cpus)], label='100% scaling') ax1.set_xlabel("Amount of cores used") ax1.set_ylabel("Speed up ratio (time_linear/time_parallel)") -ax1.set_xlim(0, max(cpus) + 4) +# ax1.set_xlim(0, max(cpus) + 4) # ax2.set_ylim(0, 1) ax1.grid() ax1.legend(loc=4) +ax1.set_xscale('log') +ax2.set_xscale('log') + # fig.savefig(os.path.join(img_dir, "speedup_scaling_{}.{}".format(name_testcase, "png"))) # fig.savefig(os.path.join(img_dir, "speedup_scaling_{}.{}".format(name_testcase, "pdf"))) # fig.savefig(os.path.join(img_dir, "speedup_scaling_{}.{}".format(name_testcase, "eps"))) diff --git a/tests/population/scaling/scaling_script.py b/tests/population/scaling/scaling_script.py index b7b938f55..24d87a7a4 100644 --- a/tests/population/scaling/scaling_script.py +++ b/tests/population/scaling/scaling_script.py @@ -32,7 +32,7 @@ for i in range(1, int(amount_of_cpus/stepsize) + 1 ): # set some info amt_repeats = 5 -resolution = {'M_1': 5, 'per': 5} +resolution = {'M_1': 50, 'per': 60} total_systems = int(np.prod([el for el in resolution.values()])) result_dir = 'scaling_results' testcase = 'linear vs MP batched' @@ -98,27 +98,27 @@ for repeat in range(amt_repeats): result_dict['linear'] = linear_times -# ####################################################################################### -# # MP runs -# mp_dict = {} -# for cpu_amt in cpu_list: +####################################################################################### +# MP runs +mp_dict = {} +for cpu_amt in cpu_list: -# mp_times = [] + mp_times = [] -# test_pop.set(amt_cores=cpu_amt) + test_pop.set(amt_cores=cpu_amt) -# # -# for repeat in range(amt_repeats): -# total_mp_start = time.time() -# evolve_mp_time = test_pop.evolve_population_mp_chunks() -# total_mp = time.time() - total_mp_start + # + for repeat in range(amt_repeats): + total_mp_start = time.time() + evolve_mp_time = test_pop.evolve_population_mp_chunks() + total_mp = time.time() - total_mp_start -# print("MP ({} nodes) run with {} systems: {} of which {} spent on evolving the systems".format(cpu_amt, total_systems, total_mp, evolve_mp_time)) -# mp_times.append(total_mp) + print("MP ({} nodes) run with {} systems: {} of which {} spent on evolving the systems".format(cpu_amt, total_systems, total_mp, evolve_mp_time)) + mp_times.append(total_mp) -# mp_dict[cpu_amt] = mp_times + mp_dict[cpu_amt] = mp_times -# result_dict['mp'] = mp_dict +result_dict['mp'] = mp_dict # Write to file with open('scaling_results/{}_{}_systems.json'.format(hostname, total_systems), 'w') as f: -- GitLab