Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build:
pre_build:
# Rust 1.90 required but not available yet
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.90.0
- pip install -U pip

mkdocs:
configuration: mkdocs.yml
Expand Down
150 changes: 62 additions & 88 deletions benches/bench_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,7 @@ def _plot_normalized_vs_nobs(
title: str,
output_path: Path,
) -> None:
fig = make_subplots(
rows=2,
cols=1,
subplot_titles=["Linear", "Cubic"],
horizontal_spacing=0.08,
)
for row, kind in enumerate(["Linear", "Cubic"], start=1):
for kind in ["Linear", "Cubic"]:
baseline_vals = throughputs.get(f"Scipy RegularGridInterpolator {kind}")
if not baseline_vals:
continue
Expand All @@ -108,14 +102,20 @@ def _plot_normalized_vs_nobs(
for name, values in throughputs.items()
if kinds.get(name) == kind and values
]

fig = make_subplots(rows=1, cols=1)
for idx, (label, values) in enumerate(series):
min_len = min(len(values), len(baseline_arr))
if min_len == 0:
continue
x_vals = np.array(ns[:min_len])
ratios = values[:min_len] / baseline_arr[:min_len]
is_baseline = label.startswith("Scipy RegularGridInterpolator")
legend_name = "Scipy" if is_baseline else "InterpN"
showlegend = True
for trace in fig.data:
if trace.name == legend_name:
showlegend = False
break
fig.add_trace(
go.Scatter(
x=x_vals,
Expand All @@ -129,13 +129,9 @@ def _plot_normalized_vs_nobs(
size=8,
),
opacity=1.0,
name=label if not is_baseline else f"{label}<br>(baseline)",
showlegend=True,
legendgroup=kind,
legendgrouptitle_text=kind,
),
row=row,
col=1,
name=legend_name,
showlegend=showlegend,
)
)
if not is_baseline and label.startswith("InterpN"):
ones = np.ones_like(ratios)
Expand All @@ -146,81 +142,59 @@ def _plot_normalized_vs_nobs(
x=x_vals,
upper=upper,
lower=lower,
row=row,
row=1,
col=1,
)

fig.update_xaxes(
type="log",
row=1,
col=1,
showline=True,
linecolor="black",
linewidth=1,
mirror=True,
ticks="outside",
tickcolor="black",
showgrid=False,
zeroline=False,
)
fig.update_xaxes(
type="log",
title_text="Number of Observation Points",
row=2,
col=1,
showline=True,
linecolor="black",
linewidth=1,
mirror=True,
ticks="outside",
tickcolor="black",
showgrid=False,
zeroline=False,
)
fig.update_yaxes(
title_text="Speedup vs. Scipy",
row=1,
col=1,
showline=True,
linecolor="black",
linewidth=1,
mirror=True,
ticks="outside",
tickcolor="black",
showgrid=False,
zeroline=False,
)
fig.update_yaxes(
row=2,
col=1,
showline=True,
linecolor="black",
linewidth=1,
mirror=True,
ticks="outside",
tickcolor="black",
showgrid=False,
zeroline=False,
)
fig.update_layout(
title=dict(text=title, y=0.97, yanchor="top"),
height=450,
margin=dict(t=80, l=60, r=200, b=90),
legend=dict(
orientation="v",
yanchor="top",
y=1.0,
x=1.02,
xanchor="left",
),
plot_bgcolor="rgba(0,0,0,0)",
paper_bgcolor="rgba(0,0,0,0)",
)
fig.write_image(str(output_path))
fig.write_html(
str(output_path.with_suffix(".html")), include_plotlyjs="cdn", full_html=False
)
fig.show()
fig.update_xaxes(
type="log",
title_text="Number of Observation Points",
row=1,
col=1,
showline=True,
linecolor="black",
linewidth=1,
mirror=True,
ticks="outside",
tickcolor="black",
showgrid=False,
zeroline=False,
)
fig.update_yaxes(
title_text="Normalized Throughput",
row=1,
col=1,
showline=True,
linecolor="black",
linewidth=1,
mirror=True,
ticks="outside",
tickcolor="black",
showgrid=False,
zeroline=False,
)
fig.update_layout(
title=dict(text=f"{title}, {kind}", y=0.97, yanchor="top"),
height=400,
margin=dict(t=60, l=60, r=60, b=110),
legend=dict(
orientation="h",
yanchor="top",
y=1.0,
x=1.0,
xanchor="right",
),
plot_bgcolor="rgba(0,0,0,0)",
paper_bgcolor="rgba(0,0,0,0)",
font=dict(color="black"),
)
per_kind_output = output_path.with_stem(output_path.stem + f"_{kind.lower()}")
fig.write_image(str(per_kind_output))
fig.write_html(
str(per_kind_output.with_suffix(".html")),
include_plotlyjs="cdn",
full_html=False,
)
fig.show()


def _plot_throughput_vs_dims(
Expand Down
2 changes: 1 addition & 1 deletion docs/1d_quality_of_fit_Rectilinear.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1d_quality_of_fit_Rectilinear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/1d_quality_of_fit_Regular.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/1d_quality_of_fit_Regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/2d_quality_of_fit_Rectilinear.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/2d_quality_of_fit_Rectilinear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/2d_quality_of_fit_Regular.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/2d_quality_of_fit_Regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading