Skip to content

Commit

Permalink
plugins: mpi_benchmark: improve plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
kpouget committed Feb 7, 2022
1 parent a9c28f8 commit 6144b34
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 12 deletions.
36 changes: 30 additions & 6 deletions plugins/mpi_benchmark/plot/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import matrix_view.table_stats
from common import Matrix
from matrix_view import COLORS

class Hello():
def __init__(self):
Expand Down Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -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),
Expand All @@ -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, ""
10 changes: 8 additions & 2 deletions plugins/mpi_benchmark/plot/osu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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),
Expand Down Expand Up @@ -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, ""
20 changes: 16 additions & 4 deletions plugins/mpi_benchmark/plot/osu_collective.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand All @@ -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,
Expand All @@ -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),
Expand All @@ -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, ""
3 changes: 3 additions & 0 deletions plugins/mpi_benchmark/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6144b34

Please sign in to comment.