Skip to content

Commit be1a7b0

Browse files
committed
paper: add calculation of costs by environment
also adding missing plots for previous work. Signed-off-by: vsoch <vsoch@users.noreply.github.com>
1 parent 4d8c2c8 commit be1a7b0

34 files changed

Lines changed: 17915 additions & 2304 deletions

paper/amg2023/1-run-analysis.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def parse_data(indir, outdir, files):
114114
"""
115115
# metrics here will be figures of merit, and seconds runtime
116116
p = ps.ResultParser("amg2023")
117-
117+
118118
# For flux we can save jobspecs and other event data
119119
data = {}
120120

@@ -170,14 +170,24 @@ def parse_data(indir, outdir, files):
170170

171171
# If this is a flux run, we have a jobspec and events here
172172
if "JOBSPEC" in item:
173-
item, _, metadata = ps.parse_flux_metadata(item)
173+
item, duration, metadata = ps.parse_flux_metadata(item)
174174
data[exp.prefix].append(metadata)
175175

176+
elif "on-premises" in filename:
177+
# Get the runtime from the err file
178+
err_file = ps.read_file(result.replace(".out", ".err"))
179+
duration = float(
180+
[x for x in err_file.split("\n") if "real" in x][0].split(" ")[-1]
181+
)
182+
else:
183+
duration = ps.parse_slurm_duration(item)
184+
176185
# Parse the FOM from the item - I see three.
177186
# This needs to throw an error if we can't find it - indicates the result file is wonky
178187
# Figure of Merit (FOM): nnz_AP / (Setup Phase Time + 3 * Solve Phase Time) 1.148604e+09
179188
fom_overall = get_fom_line(item, "Figure of Merit (FOM)")
180189
p.add_result("fom_overall", fom_overall)
190+
p.add_result("duration", duration)
181191

182192
print("Done parsing amg2023 results!")
183193

@@ -197,6 +207,8 @@ def plot_results(df, outdir, non_anon=False, log=True):
197207
if not os.path.exists(img_outdir):
198208
os.makedirs(img_outdir)
199209

210+
ps.print_experiment_cost(df, outdir)
211+
200212
# For anonymization
201213
if not non_anon:
202214
df["experiment"] = df["experiment"].str.replace(
@@ -240,7 +252,7 @@ def plot_results(df, outdir, non_anon=False, log=True):
240252
x="nodes",
241253
y="value",
242254
hue="experiment",
243-
err_kws={'color': 'darkred'},
255+
err_kws={"color": "darkred"},
244256
hue_order=[
245257
"google/gke/cpu",
246258
"google/compute-engine/cpu",
@@ -269,7 +281,7 @@ def plot_results(df, outdir, non_anon=False, log=True):
269281
ax=axes[1],
270282
x="gpu_count",
271283
y="value",
272-
err_kws={'color': 'darkred'},
284+
err_kws={"color": "darkred"},
273285
hue="experiment",
274286
hue_order=[
275287
"google/compute-engine/gpu",
@@ -308,5 +320,6 @@ def plot_results(df, outdir, non_anon=False, log=True):
308320
print(f'Total number of CPU datum: {data_frames["cpu"].shape[0]}')
309321
print(f'Total number of GPU datum: {data_frames["gpu"].shape[0]}')
310322

323+
311324
if __name__ == "__main__":
312325
main()

paper/amg2023/2-compare-topology.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def parse_data(indir, outdir, files):
8080
Parse filepaths for environment, etc., and results files for data.
8181
"""
8282
# metrics here will be figures of merit, and seconds runtime
83-
p = ps.ProblemSizeParser('amg2023')
83+
p = ps.ProblemSizeParser("amg2023")
8484

8585
# For flux we can save jobspecs and other event data
8686
data = {}
@@ -129,8 +129,13 @@ def parse_data(indir, outdir, files):
129129
item, duration, metadata = ps.parse_flux_metadata(item)
130130
data[exp.prefix].append(metadata)
131131

132-
pline = ' '.join(metadata['jobspec']['tasks'][0]['command']).split('-P')[-1].split('-problem')[0].split(' ')
133-
pline = ' '.join([x for x in pline if x.strip()])
132+
pline = (
133+
" ".join(metadata["jobspec"]["tasks"][0]["command"])
134+
.split("-P")[-1]
135+
.split("-problem")[0]
136+
.split(" ")
137+
)
138+
pline = " ".join([x for x in pline if x.strip()])
134139
fom_overall = get_fom_line(item, "Figure of Merit (FOM)")
135140
p.add_result("fom_overall", fom_overall, pline)
136141

@@ -147,6 +152,7 @@ def plot_results(df, outdir):
147152
Plot analysis results
148153
"""
149154
import IPython
155+
150156
IPython.embed()
151157
sys.exit()
152158
# Let's get some shoes! Err, plots.
@@ -176,7 +182,7 @@ def plot_results(df, outdir):
176182
for metric in exp_df.metric.unique():
177183
metric_df = exp_df[exp_df.metric == metric]
178184
title = " ".join([x.capitalize() for x in metric.split("_")])
179-
185+
180186
# Make sure fom is always capitalized
181187
title = title.replace("Fom", "FOM")
182188
ps.make_plot(

paper/amg2023/data/amg2023-results.csv

Lines changed: 853 additions & 426 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)