forked from ANRGUSC/saga
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_benchmarking.py
More file actions
73 lines (64 loc) · 1.95 KB
/
Copy pathpost_benchmarking.py
File metadata and controls
73 lines (64 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Importing required libraries to load and examine the data
import logging
import pathlib
import pandas as pd
from saga.utils.draw import gradient_heatmap
DATASET_ORDER = [
"in_trees", "out_trees", "chains",
"blast", "bwa", "cycles", "epigenomics",
"genome", "montage", "seismology", "soykb",
"srasearch",
"etl", "predict", "stats", "train",
]
SCHEDULER_RENAMES = {
"Cpop": "CPoP",
"Heft": "HEFT",
}
def load_data(resultsdir, glob: str = None) -> pd.DataFrame:
data = None
glob = glob or "*.csv"
for path in resultsdir.glob(glob):
df_dataset = pd.read_csv(path, index_col=0)
df_dataset["dataset"] = path.stem
if data is None:
data = df_dataset
else:
data = pd.concat([data, df_dataset], ignore_index=True)
if data is None:
return pd.DataFrame()
return data
def run_analysis(resultsdir: pathlib.Path,
outputdir: pathlib.Path,
glob: str = None,
title: str = None,
upper_threshold: float = 5.0) -> None:
"""Analyze the results."""
outputdir.mkdir(parents=True, exist_ok=True)
data = load_data(resultsdir, glob)
if data.empty:
logging.info("No data found. Skipping.")
return
data["scheduler"] = data["scheduler"].str.replace("Scheduler", "")
data["scheduler"] = data["scheduler"].replace(SCHEDULER_RENAMES)
ax = gradient_heatmap(
data,
x="scheduler",
y="dataset",
color="makespan_ratio",
cmap="coolwarm",
upper_threshold=upper_threshold,
title=title,
x_label="Scheduler",
y_label="Dataset",
color_label="Maximum Makespan Ratio"
)
ax.get_figure().savefig(
outputdir.joinpath("benchmarking.pdf"),
dpi=300,
bbox_inches='tight'
)
ax.get_figure().savefig(
outputdir.joinpath("benchmarking.png"),
dpi=300,
bbox_inches='tight'
)