about summary refs log tree commit diff stats
path: root/archive/2024/winter/bsc_dichler/scripts/experiments.py
diff options
context:
space:
mode:
authorRaphael Dichler <raphael@dichler.com>2025-05-11 20:03:31 +0200
committerRaphael Dichler <raphael@dichler.com>2025-05-11 20:03:31 +0200
commit2370f0923f896623c279b005b96f51121fc29700 (patch)
tree23a1aea824148307c9d67e3e6ebaa230736bdf98 /archive/2024/winter/bsc_dichler/scripts/experiments.py
parente546f71869e32e88716c4ad05e0254ea3352a668 (diff)
downloadresearch-work-archive-artifacts-2370f0923f896623c279b005b96f51121fc29700.tar.gz
research-work-archive-artifacts-2370f0923f896623c279b005b96f51121fc29700.zip
add thesis
Diffstat (limited to 'archive/2024/winter/bsc_dichler/scripts/experiments.py')
-rw-r--r--archive/2024/winter/bsc_dichler/scripts/experiments.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/archive/2024/winter/bsc_dichler/scripts/experiments.py b/archive/2024/winter/bsc_dichler/scripts/experiments.py
new file mode 100644
index 000000000..0077dbad2
--- /dev/null
+++ b/archive/2024/winter/bsc_dichler/scripts/experiments.py
@@ -0,0 +1,50 @@
+from typing import Callable, Literal
+import matplotlib as mpl
+import matplotlib.pyplot as plt
+from pathlib import Path
+
+from plot import parallel_non_contiguous
+from plot import cas
+from plot import non_contiguous
+from plot import contiguous
+from plot import malloc
+from plot import contiguous_tagging
+
+Experiments = Literal[
+    "cas",
+    "contiguous",
+    "non_contiguous",
+    "contiguous_tagging",
+    "malloc",
+    "parallel_non_contiguous",
+]
+PlottingFunction = Callable[[Path, str], None]
+
+experiments: dict[str, PlottingFunction] = {
+    "cas": lambda r, t: cas.plot(r, t),
+    "contiguous": lambda r, t: contiguous.plot(r, t),
+    "non_contiguous": lambda r, t: non_contiguous.plot(r, t),
+    "contiguous_tagging": lambda r, t: contiguous_tagging.plot(r, t),
+    "malloc": lambda r, t: malloc.plot(r, t),
+    "parallel_non_contiguous": lambda r, t: parallel_non_contiguous.plot(r, t),
+}
+
+
+def experiment_choices() -> list[str]:
+    return list(experiments.keys())
+
+
+def plot(output_root: Path, experiment: Experiments, format: Literal["pdf", "png"]):
+    rcParams = {
+        "font.family": "serif",
+        "font.size": 11,
+        "pgf.rcfonts": False,
+    }
+
+    if format == "pdf":
+        mpl.use("pdf")
+        plt.rcParams["text.latex.preamble"] = r"\renewcommand{\mathdefault}[1][]{}"
+        rcParams["pgf.texsystem"] = "pdflatex"
+
+    mpl.rcParams.update(rcParams)
+    experiments[experiment](output_root, format)