From f24bac781b120b030fef8b7f2effce9a5a20bf4d Mon Sep 17 00:00:00 2001 From: Silas Theinen Date: Wed, 21 Aug 2024 12:08:59 +0200 Subject: [PATCH 1/7] initial commit --- bennchplot/bennchplot.py | 73 ++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 37 deletions(-) mode change 100644 => 100755 bennchplot/bennchplot.py diff --git a/bennchplot/bennchplot.py b/bennchplot/bennchplot.py old mode 100644 new mode 100755 index c9b8985..3f394df --- a/bennchplot/bennchplot.py +++ b/bennchplot/bennchplot.py @@ -62,7 +62,8 @@ def __init__(self, x_axis, color_params=pp.color_params, additional_params=pp.additional_params, label_params=pp.label_params, - time_scaling=1): + time_scaling=1, + df=None): self.x_axis = x_axis self.x_ticks = x_ticks @@ -72,6 +73,7 @@ def __init__(self, x_axis, self.label_params = label_params self.time_scaling = time_scaling + self.df = df self.load_data(data_file) self.compute_derived_quantities() @@ -90,11 +92,12 @@ def load_data(self, data_file): ------ ValueError """ - try: - self.df = pd.read_csv(data_file, delimiter=',') - except FileNotFoundError: - print('File could not be found') - quit() + if self.df is None: + try: + self.df = pd.read_csv(data_file, delimiter=',') + except FileNotFoundError: + print('File could not be found') + quit() for py_timer in ['py_time_create', 'py_time_connect']: if py_timer not in self.df: @@ -107,27 +110,24 @@ def load_data(self, data_file): 'threads_per_task': 'first', 'tasks_per_node': 'first', 'model_time_sim': 'first', - 'wall_time_create': ['mean', 'std'], - 'wall_time_connect': ['mean', 'std'], - 'wall_time_sim': ['mean', 'std'], - 'wall_time_phase_collocate': ['mean', 'std'], - 'wall_time_phase_communicate': ['mean', 'std'], - 'wall_time_phase_deliver': ['mean', 'std'], - 'wall_time_phase_update': ['mean', 'std'], - 'wall_time_communicate_target_data': ['mean', 'std'], - 'wall_time_gather_spike_data': ['mean', 'std'], - 'wall_time_gather_target_data': ['mean', 'std'], - 'wall_time_communicate_prepare': ['mean', 'std'], + 'time_construction_create': ['mean', 'std'], + 'time_construction_connect': ['mean', 'std'], + 'time_simulate': ['mean', 'std'], + 'time_collocate_spike_data': ['mean', 'std'], + 'time_communicate_spike_data': ['mean', 'std'], + 'time_deliver_spike_data': ['mean', 'std'], + 'time_update': ['mean', 'std'], + 'time_communicate_target_data': ['mean', 'std'], + 'time_gather_spike_data': ['mean', 'std'], + 'time_gather_target_data': ['mean', 'std'], + 'time_communicate_prepare': ['mean', 'std'], 'py_time_create': ['mean', 'std'], 'py_time_connect': ['mean', 'std'], 'base_memory': ['mean', 'std'], 'network_memory': ['mean', 'std'], 'init_memory': ['mean', 'std'], 'total_memory': ['mean', 'std'], - 'num_connections': ['mean', 'std'], - 'local_spike_counter': ['mean', 'std'], - - } + 'num_connections': ['mean', 'std']} col = ['num_nodes', 'threads_per_task', 'tasks_per_node', 'model_time_sim', 'wall_time_create', @@ -152,14 +152,14 @@ def load_data(self, data_file): 'network_memory', 'network_memory_std', 'init_memory', 'init_memory_std', 'total_memory', 'total_memory_std', - 'num_connections', 'num_connections_std', - 'local_spike_counter', 'local_spike_counter_std'] + 'num_connections', 'num_connections_std'] self.df = self.df.drop('rng_seed', axis=1).groupby( ['num_nodes', 'threads_per_task', 'tasks_per_node', 'model_time_sim'], as_index=False).agg(dict_) + print(self.df) self.df.columns = col def compute_derived_quantities(self): @@ -244,9 +244,9 @@ def plot_fractions(self, axis, fill_variables, fill_height = 0 for fill in fill_variables: - axis.fill_between(np.squeeze(self.df[self.x_axis]), + axis.fill_between(self.df[self.x_axis].to_numpy().squeeze(axis=1), fill_height, - np.squeeze(self.df[fill]) + fill_height, + self.df[fill].to_numpy() + fill_height, label=self.label_params[fill], facecolor=self.color_params[fill], interpolate=interpolate, @@ -255,18 +255,17 @@ def plot_fractions(self, axis, fill_variables, linewidth=0.5, edgecolor='#444444') if error: - axis.errorbar(np.squeeze(self.df[self.x_axis]), - np.squeeze(self.df[fill]) + fill_height, - yerr=np.squeeze(self.df[fill + '_std']), + axis.errorbar(self.df[self.x_axis].to_numpy().squeeze(axis=1), + self.df[fill].to_numpy() + fill_height, + yerr=self.df[fill + '_std'].to_numpy(), capsize=3, capthick=1, color='k', - fmt='none' - ) + fmt='none') fill_height += self.df[fill].to_numpy() if self.x_ticks == 'data': - axis.set_xticks(np.squeeze(self.df[self.x_axis])) + axis.set_xticks(self.df[self.x_axis].to_numpy().squeeze(axis=1)) else: axis.set_xticks(self.x_ticks) @@ -297,17 +296,17 @@ def plot_main(self, quantities, axis, log=(False, False), for y in quantities: if not error: - axis.plot(self.df[self.x_axis], - self.df[y], + axis.plot(self.df[self.x_axis].to_numpy().squeeze(axis=1), + self.df[y].to_numpy(), marker=None, label=self.label_params[y], color=self.color_params[y], linewidth=2) else: axis.errorbar( - self.df[self.x_axis].values, - self.df[y].values, - yerr=self.df[y + '_std'].values, + self.df[self.x_axis].to_numpy().squeeze(axis=1), + self.df[y].to_numpy(), + yerr=self.df[y + '_std'].to_numpy(), marker=None, capsize=3, capthick=1, @@ -316,7 +315,7 @@ def plot_main(self, quantities, axis, log=(False, False), fmt=fmt) if self.x_ticks == 'data': - axis.set_xticks(self.df[self.x_axis].values) + axis.set_xticks(self.df[self.x_axis].to_numpy().squeeze(axis=1)) else: axis.set_xticks(self.x_ticks) From 7caa0014c3e4b1384904cb0c1dff612da4fab403 Mon Sep 17 00:00:00 2001 From: Silas Theinen Date: Wed, 21 Aug 2024 12:31:17 +0200 Subject: [PATCH 2/7] add simulator_version and completion time to dict --- bennchplot/bennchplot.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bennchplot/bennchplot.py b/bennchplot/bennchplot.py index 3f394df..d84a700 100755 --- a/bennchplot/bennchplot.py +++ b/bennchplot/bennchplot.py @@ -110,6 +110,8 @@ def load_data(self, data_file): 'threads_per_task': 'first', 'tasks_per_node': 'first', 'model_time_sim': 'first', + 'completion_time': 'first', + 'simulator_version': 'first', 'time_construction_create': ['mean', 'std'], 'time_construction_connect': ['mean', 'std'], 'time_simulate': ['mean', 'std'], @@ -130,8 +132,8 @@ def load_data(self, data_file): 'num_connections': ['mean', 'std']} col = ['num_nodes', 'threads_per_task', 'tasks_per_node', - 'model_time_sim', 'wall_time_create', - 'wall_time_create_std', 'wall_time_connect', + 'model_time_sim', 'completion_time', 'simulator_version' + 'wall_time_create', 'wall_time_create_std', 'wall_time_connect', 'wall_time_connect_std', 'wall_time_sim', 'wall_time_sim_std', 'wall_time_phase_collocate', 'wall_time_phase_collocate_std', 'wall_time_phase_communicate', @@ -158,7 +160,9 @@ def load_data(self, data_file): ['num_nodes', 'threads_per_task', 'tasks_per_node', - 'model_time_sim'], as_index=False).agg(dict_) + 'model_time_sim', + 'completion_time', + 'simulator_version'], as_index=False).agg(dict_) print(self.df) self.df.columns = col From c936f8076279e84a2ab59e919a0a657a209027d9 Mon Sep 17 00:00:00 2001 From: Silas Theinen Date: Wed, 21 Aug 2024 12:37:35 +0200 Subject: [PATCH 3/7] add simulator_version and completion time to dict --- bennchplot/bennchplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bennchplot/bennchplot.py b/bennchplot/bennchplot.py index d84a700..bdc2ea4 100755 --- a/bennchplot/bennchplot.py +++ b/bennchplot/bennchplot.py @@ -132,7 +132,7 @@ def load_data(self, data_file): 'num_connections': ['mean', 'std']} col = ['num_nodes', 'threads_per_task', 'tasks_per_node', - 'model_time_sim', 'completion_time', 'simulator_version' + 'model_time_sim', 'completion_time', 'simulator_version', 'wall_time_create', 'wall_time_create_std', 'wall_time_connect', 'wall_time_connect_std', 'wall_time_sim', 'wall_time_sim_std', 'wall_time_phase_collocate', From 5b8ebe549f2b64a4534b7f869192426c8496122e Mon Sep 17 00:00:00 2001 From: Silas Theinen Date: Wed, 21 Aug 2024 13:27:20 +0200 Subject: [PATCH 4/7] handle empty cells --- bennchplot/bennchplot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bennchplot/bennchplot.py b/bennchplot/bennchplot.py index bdc2ea4..9304606 100755 --- a/bennchplot/bennchplot.py +++ b/bennchplot/bennchplot.py @@ -105,6 +105,8 @@ def load_data(self, data_file): raise ValueError('Warning! Python timers are not found. ' + 'Construction time measurements will not ' + 'be accurate.') + + df.fillna(0, inplace=True) dict_ = {'num_nodes': 'first', 'threads_per_task': 'first', From 0787fc88c747eb064d9f34279481d7ee69caad9c Mon Sep 17 00:00:00 2001 From: Silas Theinen Date: Wed, 21 Aug 2024 14:21:38 +0200 Subject: [PATCH 5/7] handle empty cells --- bennchplot/bennchplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bennchplot/bennchplot.py b/bennchplot/bennchplot.py index 9304606..ef63a3f 100755 --- a/bennchplot/bennchplot.py +++ b/bennchplot/bennchplot.py @@ -106,7 +106,7 @@ def load_data(self, data_file): 'Construction time measurements will not ' + 'be accurate.') - df.fillna(0, inplace=True) + self.df.fillna(0, inplace=True) dict_ = {'num_nodes': 'first', 'threads_per_task': 'first', From 78d56df32688ad4c3bf704e41abb848845d05bb2 Mon Sep 17 00:00:00 2001 From: Silas Theinen Date: Sat, 28 Sep 2024 13:42:43 +0200 Subject: [PATCH 6/7] fix name for annotation time --- bennchplot/bennchplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bennchplot/bennchplot.py b/bennchplot/bennchplot.py index ef63a3f..2cf1d83 100755 --- a/bennchplot/bennchplot.py +++ b/bennchplot/bennchplot.py @@ -163,7 +163,7 @@ def load_data(self, data_file): 'threads_per_task', 'tasks_per_node', 'model_time_sim', - 'completion_time', + 'annotation_time', 'simulator_version'], as_index=False).agg(dict_) print(self.df) self.df.columns = col From 11c3a1384fb3925ece55d5de2656bb313acdef43 Mon Sep 17 00:00:00 2001 From: Silas Theinen Date: Sat, 28 Sep 2024 15:04:41 +0200 Subject: [PATCH 7/7] add annotation time --- bennchplot/bennchplot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bennchplot/bennchplot.py b/bennchplot/bennchplot.py index 2cf1d83..87aba85 100755 --- a/bennchplot/bennchplot.py +++ b/bennchplot/bennchplot.py @@ -112,7 +112,7 @@ def load_data(self, data_file): 'threads_per_task': 'first', 'tasks_per_node': 'first', 'model_time_sim': 'first', - 'completion_time': 'first', + 'annotation_time': 'first', 'simulator_version': 'first', 'time_construction_create': ['mean', 'std'], 'time_construction_connect': ['mean', 'std'], @@ -134,7 +134,7 @@ def load_data(self, data_file): 'num_connections': ['mean', 'std']} col = ['num_nodes', 'threads_per_task', 'tasks_per_node', - 'model_time_sim', 'completion_time', 'simulator_version', + 'model_time_sim', 'annotation_time', 'simulator_version', 'wall_time_create', 'wall_time_create_std', 'wall_time_connect', 'wall_time_connect_std', 'wall_time_sim', 'wall_time_sim_std', 'wall_time_phase_collocate',