From 6144b349cf431c53cdaee3a747d41c6080632ba7 Mon Sep 17 00:00:00 2001 From: Kevin Pouget Date: Mon, 7 Feb 2022 14:51:39 +0100 Subject: [PATCH] plugins: mpi_benchmark: improve plotting --- plugins/mpi_benchmark/plot/hello.py | 36 ++++++++++++++++---- plugins/mpi_benchmark/plot/osu.py | 10 ++++-- plugins/mpi_benchmark/plot/osu_collective.py | 20 ++++++++--- plugins/mpi_benchmark/store.py | 3 ++ 4 files changed, 57 insertions(+), 12 deletions(-) diff --git a/plugins/mpi_benchmark/plot/hello.py b/plugins/mpi_benchmark/plot/hello.py index a521edc4..642a8460 100644 --- a/plugins/mpi_benchmark/plot/hello.py +++ b/plugins/mpi_benchmark/plot/hello.py @@ -5,6 +5,7 @@ import matrix_view.table_stats from common import Matrix +from matrix_view import COLORS class Hello(): def __init__(self): @@ -41,7 +42,7 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): y = stats.mean(y_values) y_err = stats.stdev(y_values) if len(y_values) > 2 else 0 - legend_name += " " + " ".join(entry.gathered_keys.keys()) + legend_name += " " + " ".join(entry.gathered_keys.keys()) + f" x{len(entry.results)}" XYerr_pos[legend_name][int(entry.params.node_count)] = y + y_err XYerr_neg[legend_name][int(entry.params.node_count)] = y - y_err @@ -52,12 +53,15 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): XY[legend_name][int(entry.params.node_count)] = y + y_max = 0 data = [] for legend_name in XY: x = list(sorted(XY[legend_name].keys())) y = list([XY[legend_name][_x] for _x in x]) + y_max = max(y + [y_max]) + + color = COLORS(list(XY.keys()).index(legend_name)) - color = None data.append(go.Scatter(name=legend_name, x=x, y=y, mode="markers+lines", @@ -71,6 +75,8 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): y_err_pos = list([XYerr_pos[legend_name][_x] for _x in x]) y_err_neg = list([XYerr_neg[legend_name][_x] for _x in x]) + y_max = max(y_err_pos + [y_max]) + data.append(go.Scatter(name=legend_name, x=x, y=y_err_pos, line=dict(color=color, width=0), @@ -87,11 +93,29 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): legendgroup=legend_name, )) - fig = go.Figure(data=data) - fig.update_layout(title="Pod launch time", title_x=0.5, + if legend_name: + x = list(sorted(XY[legend_name].keys())) + y_linear = [_x for _x in x] + + data.append(go.Scatter(name="linear", + x=x, y=y_linear, + mode="lines", + )) + + fig = go.Figure(data=data) + USE_LOG = True + if USE_LOG: + fig.update_xaxes(type="log") + fig.update_yaxes(type="log") + import math + # https://plotly.com/python/reference/layout/yaxis/#layout-yaxis-range + y_max = math.log(y_max, 10) + + fig.update_layout(title="'echo hello' MPI deployment time", title_x=0.5, showlegend=True, - xaxis_title="Number of Pods", - yaxis_title="Time (in seconds)") + yaxis_range=[0, y_max*1.05], + xaxis_title="Number of Pods/Nodes [log scale]", + yaxis_title="Time (in seconds, lower is better) [log scale]") return fig, "" diff --git a/plugins/mpi_benchmark/plot/osu.py b/plugins/mpi_benchmark/plot/osu.py index f4092b68..48c2a5cd 100644 --- a/plugins/mpi_benchmark/plot/osu.py +++ b/plugins/mpi_benchmark/plot/osu.py @@ -65,9 +65,11 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): return None, "Nothing to plot ..." data = [] + y_max = 0 for legend_name in XY: x = list(sorted(XY[legend_name].keys())) y = list([XY[legend_name][_x] for _x in x]) + y_max = max(y + [y_max]) color = COLORS(list(XY.keys()).index(legend_name)) @@ -83,6 +85,9 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): y_err_pos = list([XYerr_pos[legend_name][_x] for _x in x]) y_err_neg = list([XYerr_neg[legend_name][_x] for _x in x]) + + y_max = max(y_err_pos + [y_max]) + data.append(go.Scatter(name=legend_name, x=x, y=y_err_pos, line=dict(color=color, width=0), @@ -113,7 +118,8 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): # Edit the layout x_title, y_title = plot_legend fig.update_layout(title=plot_title, title_x=0.5, - xaxis_title="Message "+x_title, - yaxis_title=y_title) + xaxis_title="Message "+x_title, + yaxis_range=[0, y_max], + yaxis_title=y_title) return fig, "" diff --git a/plugins/mpi_benchmark/plot/osu_collective.py b/plugins/mpi_benchmark/plot/osu_collective.py index b32812cb..0f57160b 100644 --- a/plugins/mpi_benchmark/plot/osu_collective.py +++ b/plugins/mpi_benchmark/plot/osu_collective.py @@ -67,6 +67,7 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): print("Nothing to plot ...", params) return None, "Nothing to plot ..." + y_max = 0 data = [] for legend_name in XY: x = list(sorted(XY[legend_name].keys())) @@ -86,6 +87,7 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): y = y_collapsed color = COLORS(list(XY.keys()).index(legend_name)) + y_max = max(y + [y_max]) data.append(go.Scatter(name=legend_name, x=x, y=y, @@ -97,6 +99,8 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): if not is_gathered: continue + y_max = max(y_err_pos + [y_max]) + data.append(go.Scatter(name=legend_name, x=x, y=y_err_pos, line=dict(color=color, width=0), @@ -121,11 +125,19 @@ def do_plot(self, ordered_vars, params, param_lists, variables, cfg): plot_title = "OSU MPI AllReduce Latency Test (lower is better)" # Edit the layout - fig.update_xaxes(type="log") - fig.update_yaxes(type="log") + + USE_LOG = True + if USE_LOG: + fig.update_xaxes(type="log") + fig.update_yaxes(type="log") + import math + # https://plotly.com/python/reference/layout/yaxis/#layout-yaxis-range + y_max = math.log(y_max, 10) + x_title, y_title = plot_legend fig.update_layout(title=plot_title, title_x=0.5, - xaxis_title="Number of nodes", - yaxis_title=y_title) + yaxis_range=[0, y_max*1.05], + xaxis_title="Number of nodes", + yaxis_title=y_title) return fig, "" diff --git a/plugins/mpi_benchmark/store.py b/plugins/mpi_benchmark/store.py index 3091c053..718d8010 100644 --- a/plugins/mpi_benchmark/store.py +++ b/plugins/mpi_benchmark/store.py @@ -19,6 +19,9 @@ def mpi_benchmark_rewrite_settings(params_dict): if mode == "p2p": params_dict["node_count"] = "2" + # remove expe setting + expe = params_dict.pop("expe") + return params_dict store.custom_rewrite_settings = mpi_benchmark_rewrite_settings