Skip to content

Commit e05d89f

Browse files
committed
add netmark analysis
Signed-off-by: vsoch <[email protected]>
1 parent 09128bb commit e05d89f

26 files changed

+85704
-0
lines changed

analysis/netmark/1-run-analysis.py

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
import os
5+
import sys
6+
import re
7+
import pandas
8+
9+
import matplotlib.pylab as plt
10+
import seaborn as sns
11+
12+
here = os.path.dirname(os.path.abspath(__file__))
13+
analysis_root = os.path.dirname(here)
14+
root = os.path.dirname(analysis_root)
15+
sys.path.insert(0, analysis_root)
16+
17+
import performance_study as ps
18+
19+
sns.set_theme(style="whitegrid", palette="muted")
20+
21+
# These are files I found erroneous - no result, or incomplete result
22+
# Details included with each, and more exploration is likely needed to quantify
23+
# error types
24+
errors = []
25+
error_regex = "(%s)" % "|".join(errors)
26+
27+
28+
def get_parser():
29+
parser = argparse.ArgumentParser(
30+
description="Run analysis",
31+
formatter_class=argparse.RawTextHelpFormatter,
32+
)
33+
parser.add_argument(
34+
"--root",
35+
help="root directory with experiments",
36+
default=os.path.join(root, "experiments"),
37+
)
38+
parser.add_argument(
39+
"--non-anon",
40+
help="Generate non-anon",
41+
action="store_true",
42+
default=False,
43+
)
44+
parser.add_argument(
45+
"--out",
46+
help="directory to save parsed results",
47+
default=os.path.join(here, "data"),
48+
)
49+
return parser
50+
51+
52+
def main():
53+
"""
54+
Find application result files to parse.
55+
"""
56+
parser = get_parser()
57+
args, _ = parser.parse_known_args()
58+
59+
# Output images and data
60+
outdir = os.path.abspath(args.out)
61+
indir = os.path.abspath(args.root)
62+
63+
# We absolutely want on premises results here
64+
if not os.path.exists(outdir):
65+
os.makedirs(outdir)
66+
67+
# Find input files (skip anything with test)
68+
files = ps.find_inputs(indir, "RTT.csv")
69+
if not files:
70+
raise ValueError(f"There are no input files in {indir}")
71+
72+
parse_data(indir, outdir, files)
73+
74+
75+
def parse_data(indir, outdir, files):
76+
"""
77+
Parse filepaths for environment, etc., and results files for data.
78+
"""
79+
# metrics here will be figures of merit, and seconds runtime
80+
p = ps.ProblemSizeParser("netmark")
81+
82+
# For flux we can save jobspecs and other event data
83+
data = {}
84+
img_outdir = os.path.join(outdir, "img")
85+
if not os.path.exists(img_outdir):
86+
os.makedirs(img_outdir)
87+
88+
# It's important to just parse raw data once, and then use intermediate
89+
for filename in files:
90+
exp = ps.ExperimentNameParser(filename, indir)
91+
if exp.prefix not in data:
92+
data[exp.prefix] = []
93+
exp.show()
94+
95+
hosts_file = os.path.join(os.path.dirname(filename), "hosts.csv")
96+
hosts = list(pandas.read_csv(hosts_file))
97+
df = pandas.read_csv(filename, header=None, names=hosts)
98+
df.index = hosts
99+
100+
plt.figure(figsize=(20, 18))
101+
sns.heatmap(df, vmin=0, vmax=70, cmap="crest")
102+
plt.title(
103+
f" Netmark Latency Google Kubernetes Size {exp.size}",
104+
fontsize=16,
105+
)
106+
plt.tight_layout()
107+
plt.savefig(os.path.join(img_outdir, f"netmark-size-{exp.size}-heatmap.svg"))
108+
plt.savefig(os.path.join(img_outdir, f"netmark-size-{exp.size}-heatmap.png"))
109+
110+
plt.close()
111+
plt.clf()
112+
sns.clustermap(df, cmap="crest")
113+
plt.savefig(os.path.join(img_outdir, f"netmark-size-{exp.size}-cluster.svg"))
114+
plt.savefig(os.path.join(img_outdir, f"netmark-size-{exp.size}-cluster.png"))
115+
plt.close()
116+
plt.clf()
117+
118+
print("Done parsing netmark results!")
119+
120+
121+
if __name__ == "__main__":
122+
main()
Loading

0 commit comments

Comments
 (0)