From f575246e3b66ac7d01c7162cd00ba576d7022e6c Mon Sep 17 00:00:00 2001 From: k-dominik Date: Fri, 30 Aug 2024 10:15:02 +0200 Subject: [PATCH] add normalized runningtime plots --- Results.md.in | 12 +++++++ generate-results.py | 80 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/Results.md.in b/Results.md.in index c241702..89b7212 100644 --- a/Results.md.in +++ b/Results.md.in @@ -10,8 +10,15 @@ generated {{ now }}, from results of {{ n_hosts }} machines ### Time +#### Absolute + ![unique-runningtime](unique-runningtime.png) +#### Normalized to `numpy.unique` for each shape/host combination + +![unique-runningtime-normalized](unique-runningtime-normalized.png) + + ## Bincount ### Memory usage @@ -20,5 +27,10 @@ generated {{ now }}, from results of {{ n_hosts }} machines ### Time +#### Absolute + ![bincount-runningtime](bincount-runningtime.png) +#### Normalized to `numpy.bincount` for each shape/host combination + +![bincount-runningtime-normalized](bincount-runningtime-normalized.png) diff --git a/generate-results.py b/generate-results.py index 2244e4b..675fe09 100644 --- a/generate-results.py +++ b/generate-results.py @@ -38,6 +38,46 @@ def gen_plots(): p.clear() + # normalize data + # method shape t py_version npy_version pandas_version vigra_version host platform mem_min mem_max + np_unique = results_unique[results_unique["method"] == "numpy.unique(data)"] + + normalization_factors = {} + + for _, row in np_unique.iterrows(): + key = ( + row["host"], + row["platform"], + row["shape"], + row["py_version"], + row["npy_version"], + row["pandas_version"], + row["vigra_version"], + ) + normalization_factors[key] = row["t"] + + def normalize(row): + key = ( + row["host"], + row["platform"], + row["shape"], + row["py_version"], + row["npy_version"], + row["pandas_version"], + row["vigra_version"], + ) + return row["t"] / normalization_factors[key] + + results_unique["normalized_t"] = results_unique.apply(normalize, axis=1) + + p = sns.lineplot(x="shape_ind", y="normalized_t", hue="method", data=results_unique) + p.set(yscale="log") + fig = p.get_figure() + fig.savefig("unique-runningtime-normalized.png") + + p.clear() + + results_bincount = pandas.read_csv("results-bincount.csv", sep="\t") results_bincount["shape_ind"] = results_bincount["shape"].map(shape_index_mapping) @@ -56,6 +96,46 @@ def gen_plots(): p.clear() + # normalize data + # method shape t py_version npy_version pandas_version vigra_version host platform mem_min mem_max + np_bincount = results_bincount[results_bincount["method"] == "numpy.bincount(data.reshape(-1))"] + + normalization_factors = {} + + for _, row in np_bincount.iterrows(): + key = ( + row["host"], + row["platform"], + row["shape"], + row["py_version"], + row["npy_version"], + row["pandas_version"], + row["vigra_version"], + ) + normalization_factors[key] = row["t"] + + def normalize(row): + key = ( + row["host"], + row["platform"], + row["shape"], + row["py_version"], + row["npy_version"], + row["pandas_version"], + row["vigra_version"], + ) + return row["t"] / normalization_factors[key] + + results_bincount["normalized_t"] = results_bincount.apply(normalize, axis=1) + + p = sns.lineplot(x="shape_ind", y="normalized_t", hue="method", data=results_bincount) + p.set(yscale="log") + fig = p.get_figure() + fig.savefig("bincount-runningtime-normalized.png") + + p.clear() + + def main(): template = Template(Path("Results.md.in").read_text())