Skip to content

Commit 986e4e0

Browse files
authored
Merge pull request #10 from converged-computing/add-mape
Add model comparison script / images
2 parents c7f0268 + 875f8f1 commit 986e4e0

File tree

224 files changed

+984203
-961839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+984203
-961839
lines changed

analysis/hpcg-ebpf/1-run-analysis.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from scipy.cluster.hierarchy import linkage, dendrogram
1010
from scipy.spatial.distance import pdist
1111
import matplotlib.pylab as plt
12+
from matplotlib.colors import ListedColormap
1213
import seaborn as sns
1314

1415
here = os.path.dirname(os.path.abspath(__file__))
@@ -209,7 +210,7 @@ def parse_data(indir, outdir, files):
209210
if "test" in filename or "/models" in filename:
210211
continue
211212
p = add_hpcg_result(p, indir, filename)
212-
p.df = p.df[p.df.metric.isin(['compatible', 'fom', 'duration'])]
213+
p.df = p.df[p.df.metric.isin(["compatible", "fom", "duration"])]
213214

214215
# Save stuff to file first
215216
p.df.to_csv(os.path.join(outdir, "hpcg-results.csv"))
@@ -320,9 +321,9 @@ def parse_metrics(indir, outdir, files):
320321
# Parse the "science per unit cost" and remove from fom df
321322
if metric == "fom":
322323
cost_df = p.df.copy()
323-
cost_df[cost_df.metric.isin(['compatible', 'fom_per_dollar'])]
324+
cost_df[cost_df.metric.isin(["compatible", "fom_per_dollar"])]
324325
cost_df.to_csv(os.path.join(data_outdir, "csv", f"hpcg_fom_per_dollar.csv"))
325-
p.df = p.df[p.df.metric.isin(['fom', 'compatible'])]
326+
p.df = p.df[p.df.metric.isin(["fom", "compatible"])]
326327

327328
print(metric)
328329
print(p.df.metric.unique())
@@ -337,8 +338,10 @@ def parse_metrics(indir, outdir, files):
337338
if row.metric == "compatible":
338339
continue
339340
# Divide by the number of procs of the instance type
341+
# Talked to Dan
340342
if metric in divide_by_n:
341-
value = float(row.value) / ps.core_lookup[row.env]
343+
value = ps.core_lookup[row.env]
344+
# value = float(row.value) / ps.core_lookup[row.env]
342345
elif metric in raw_values:
343346
value = float(row.value)
344347
elif metric in divide_by_iterations:
@@ -363,15 +366,20 @@ def parse_metrics(indir, outdir, files):
363366
idx += 1
364367

365368
print(f"Metric {metric} has {p.df.shape[0]} datums.")
369+
print(p.df.metric.unique())
366370
p.df.to_csv(os.path.join(data_outdir, "csv", f"hpcg_{metric}_normalized.csv"))
367371
fig = plt.figure(figsize=(24, 24))
368372
axes = []
369373
gs = plt.GridSpec(1, 2, width_ratios=[7, 0])
370374
axes.append(fig.add_subplot(gs[0, 0]))
371375
sns.set_style("whitegrid")
376+
mask = df == 0.0
377+
cmap = plt.get_cmap("crest")
378+
cmap.set_bad("#F7F7F7")
372379
g1 = sns.clustermap(
373380
df,
374-
cmap="crest",
381+
mask=mask,
382+
cmap=cmap,
375383
annot=False,
376384
)
377385
title = " ".join([x.capitalize() for x in metric.split("_")])
@@ -427,6 +435,7 @@ def plot_results(df, outdir):
427435
for metric, instances in frames.items():
428436
# Only plot fom, compatible, and duration here
429437
# We will show the rest in the interactive plot
438+
if metric not in ["fom", "duration", "compatible"]:
430439
if metric not in ["fom", "duration", "compatible"]:
431440
continue
432441
for instance, data_frame in instances.items():
@@ -500,9 +509,11 @@ def plot_results(df, outdir):
500509
# Now we want to calculate the cost per unit of science.
501510
# Add cost per hour
502511
data_outdir = os.path.join(outdir, "heatmap")
503-
cost_df = pandas.read_csv(os.path.join(data_outdir, "csv", f"hpcg_fom_per_dollar.csv"), index_col=0)
512+
cost_df = pandas.read_csv(
513+
os.path.join(data_outdir, "csv", f"hpcg_fom_per_dollar.csv"), index_col=0
514+
)
504515
cost_df.index = cost_df.problem_size.tolist()
505-
516+
506517
fom_cost_df = pandas.DataFrame(0.0, columns=instances, index=list(build_config))
507518
fom_df = pandas.DataFrame(0.0, columns=instances, index=list(build_config))
508519
idx = 0

0 commit comments

Comments
 (0)