diff --git a/tests/population/scaling/plot_amdahl.py b/tests/population/scaling/plot_amdahl.py new file mode 100644 index 0000000000000000000000000000000000000000..240d7fa1c285c7a827faac51f87f4db56bb3af55 --- /dev/null +++ b/tests/population/scaling/plot_amdahl.py @@ -0,0 +1,19 @@ +import matplotlib.pyplot as plt +import numpy as np + +def amdahl(f,n): + return 1.0/((1-f) + (f/n)) + +cores = np.arange(1, 10, 0.1) +values_list = [] +par_vals = np.arange(0, 1.1, 0.1) + + +for par_val in par_vals: + values = amdahl(par_val, cores) + values_list.append(values) + + +for values in values_list: + plt.plot(cores, values, 'b-') +plt.show() \ No newline at end of file diff --git a/tests/population/scaling/plot_scaling_new.py b/tests/population/scaling/plot_scaling_new.py index d758102e19204e934c0860beca6719c947177bc3..e739b3323b10471169c4eb268470d7799d9a3d69 100644 --- a/tests/population/scaling/plot_scaling_new.py +++ b/tests/population/scaling/plot_scaling_new.py @@ -6,19 +6,22 @@ import numpy as np import json import math -scaling_result_dir = 'scaling_results' +def amdahl(f,n): + return 1.0/((1-f) + (f/n)) +################################# +# Files +scaling_result_dir = 'scaling_results' filenames = [ 'astro2_2500_systems.json', 'astro2_3000_systems.json', ] - result_jsons = [] 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')) +################################# +# Plotting of the scaling results fig, ax1 = plt.subplots() ax2 = ax1.twinx() for jsonfile in result_jsons: @@ -32,11 +35,7 @@ for jsonfile in result_jsons: linear_mean = np.mean(linear_data) linear_stdev = np.std(linear_data) - cpus = [] - speedups = [] - efficiencies = [] - stddev_speedups = [] - + cpus, speedups, efficiencies, stddev_speedups = [], [], [], [] for amt_cpus in result_data['mp']: # Get mp data mp_data = result_data['mp'][amt_cpus] @@ -69,6 +68,25 @@ for jsonfile in result_jsons: # x_position_shift += 0.1 + +# Do Amdahls law fitting +# cores = np.arange(1, 48, 0.1) +# values_list = [] +# par_step = 0.005 +# par_vals = np.arange(.95, 1, par_step) + + +# for par_val in par_vals: +# values = amdahl(par_val, cores) +# values_list.append(values) + +# for i, values in enumerate(values_list): +# ax1.plot(cores, values, label="par_val={}".format(par_vals[i])) + + + +################################# +# Adding plot make up ax1.set_title( "Speed up ratio vs amount of cores for different amounts of systems on {}".format( 'name_testcase' @@ -83,6 +101,15 @@ ax1.set_ylabel("Speed up ratio (time_linear/time_parallel)") # ax1.set_xlim(0, max(cpus) + 4) # ax2.set_ylim(0, 1) + + + + + + + + + ax1.grid() ax1.legend(loc=4) ax1.set_xscale('log')