Skip to content
Snippets Groups Projects
Commit 6fd2f46a authored by Christoph Alt's avatar Christoph Alt
Browse files

reworked the plotting a bit

parent 24b3256d
Branches
Tags
1 merge request!3Devel/plotting
Pipeline #50752 passed with stages
in 24 seconds
...@@ -16,27 +16,35 @@ SKYLAKE = CPUInfo("Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz", ...@@ -16,27 +16,35 @@ SKYLAKE = CPUInfo("Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
DEFAULT_MARKER = dict(size=10, color='green') DEFAULT_MARKER = dict(size=10, color='green')
def add_compute_roofline(fig, peak_perf: float, ridge_point: float, max_x: float):
fig.add_trace(
go.Scatter(x=[ridge_point, max_x],
y=[peak_perf, peak_perf],
mode='lines+text',
name=f'Peak Performance: {peak_perf/1e9} GFlop/s',
textposition="top right",
line=dict(color='blue', width=2))
)
return fig
def add_memory_roofline(fig, peak_perf: float, ridge_point: float, max_bw: float):
fig.add_trace(
go.Scatter(x=[0, ridge_point],
y=[0, peak_perf],
mode='lines+text',
name=f"Maximum Memory bandwidth: {max_bw/1e9} GB/s",
textposition="bottom left",
line=dict(color='green', width=2))
)
return fig
def add_rooflines(fig, peak_perf, max_bw, max_x): def add_rooflines(fig, peak_perf, max_bw, max_x):
# Calculate maximum flops/byte value # Calculate oi where oi*max_bw == peak_perf
ridge_point = peak_perf / max_bw ridge_point = peak_perf / max_bw
fig = add_compute_roofline(fig, peak_perf, ridge_point, max_x)
# Add horizontal bandwidth roofline fig = add_memory_roofline(fig, peak_perf, ridge_point, max_bw)
x_bw = [ridge_point, max_x]
y_bw = [peak_perf, peak_perf]
fig.add_trace(go.Scatter(x=x_bw, y=y_bw, mode='lines+text',
name="Compute Roofline",
text=[f'Peak Performance {peak_perf/1e9} GFlop/s',],
textposition="top right",
line=dict(color='blue', width=2)))
# Add diagonal compute roofline
x_compute = [0, ridge_point]
y_compute = [0, peak_perf]
fig.add_trace(go.Scatter(x=x_compute, y=y_compute, mode='lines+text',
name="Memory Roofline",
text=["", f"Memory bandwidth : {max_bw/1e9} GB/s",],
textposition="bottom left",
line=dict(color='green', width=2)))
return fig return fig
...@@ -50,32 +58,37 @@ def add_data_point(fig, x, y, *, ...@@ -50,32 +58,37 @@ def add_data_point(fig, x, y, *,
y=[y], y=[y],
mode='markers', mode='markers',
marker=marker, marker=marker,
name=name name=name,
text=name,
)) ))
return fig return fig
def set_axis(fig): def set_axis(fig):
# Add roofline axes labels # Add roofline axes labels
common_config = dict(
type='log',
zeroline=True,
exponentformat="SI"
)
fig.update_layout( fig.update_layout(
xaxis=dict( xaxis={
type='log', 'title': 'Operational Intensity (Flop/Byte)',
title='Operational Intensity (Flop/Byte)', **common_config,
zeroline=True },
), yaxis={
yaxis=dict( 'title': 'Performance (Flop/s)',
type='log', **common_config,
title='Performance (Flop/s)', },
zeroline=True
)
) )
return fig return fig
def create_plot(peak_perf, max_band): def create_plot(peak_perf, max_band, title):
fig = go.Figure() fig = go.Figure()
fig = add_rooflines(fig, peak_perf, max_band, 100) fig = add_rooflines(fig, peak_perf, max_band, 100)
fig = set_axis(fig) fig = set_axis(fig)
fig.update_layout(title=title)
return fig return fig
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment