-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprocess-table-2.py
37 lines (30 loc) · 1.19 KB
/
process-table-2.py
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
apps = ['CU', 'ST', 'CP', 'MM', 'UT', 'UT-A', 'SC']
def get_mean(data):
return round(float(sum(data)/len(data)), 3)
def get_data(file_name):
data_file = open(file_name, 'r')
data = []
for line in data_file.readlines():
data.append(float(line.rstrip()))
return get_mean(data)
table = {}
for app in apps:
# each app has a file for optimized and original runtimes. Fetch the data
opt = get_data('./' + app + '/opt.out')
og = get_data('./' + app + '/og.out')
table[app] = {}
table[app]['perf_improv'] = round(float((og - opt)/og) * 100, 2)
table[app]['og_nsight_cycles'] = get_data('./' + app + '/og-nsight.out')
table[app]['opt_nsight_cycles'] = get_data('./' + app + '/opt-nsight.out')
output_lines = []
# For each app, list content in CSV format
output_lines.append("Application,PerformanceImprovement(%),Stalls(Original),Stalls(Modified)\n")
for app in table.keys():
output_lines.append(f"{app},{table[app]['perf_improv']},{table[app]['og_nsight_cycles']},{table[app]['opt_nsight_cycles']}\n")
f = open('result.csv', 'w')
for line in output_lines:
# write to terminal
print(line, end="")
# write to results file
f.write(line)
f.close()