-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollect_data.py
133 lines (119 loc) · 3.93 KB
/
collect_data.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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import sys
import os
import pandas as pd
import dispatch_simeng
import yaml
RUN_INDEX = int(sys.argv[1])
PATH = dispatch_simeng.PATH
DB_NAME = os.path.join(PATH, sys.argv[2])
CONFIG_NO = int(sys.argv[3])
def get_inputs(index):
parameters = {
#Core
"Vector-Length" : -1,
"Streaming-Vector-Length" : -1,
#Fetch
"Fetch-Block-Size" : -1,
"Loop-Buffer-Size" : -1,
"Loop-Detection-Threshold" : -1,
#Process Image
"Heap-Size" : -1,
"Stack-Size" : -1,
#Register Set
"GeneralPurpose-Count" : -1,
"FloatingPoint/SVE-Count" : -1,
"Predicate-Count" : -1,
"Conditional-Count": -1,
#Pipeline Widths
"Commit" : -1,
"FrontEnd" : -1,
"LSQ-Completion": -1,
#Queue Sizes
"ROB" : -1,
"Load" : -1,
"Store" : -1,
#LSQ L1 Interface
"Access-Latency" : -1,
"Load-Bandwidth" : -1,
"Store-Bandwidth" : -1,
"Permitted-Requests-Per-Cycle" : -1,
"Permitted-Loads-Per-Cycle" : -1,
"Permitted-Stores-Per-Cycle" : -1,
"clw" : -1,
"core_clock" : -1,
"l1_latency" : -1,
"l1_clock" : -1,
"l1_associativity" : -1,
"l1_size": -1,
"l2_latency" : -1,
"l2_clock" : -1,
"l2_associativity" : -1,
"l2_size" : -1,
"ram_timing" : -1,
"ram_clock" : -1,
"ram_size" : -1
}
config = open(os.path.join(PATH, 'config-buffer', 'config-' + str(index) + '.yaml'))
for i in config.readlines():
for j in parameters:
if j + ":" in i:
parameters[j] = int(i.split()[-1])
with open(os.path.join(PATH, 'sst-buffer', 'sst-' + str(index) + '.yaml'), 'r') as stream:
data = yaml.load(stream, Loader=yaml.SafeLoader)
for i in data:
parameters[i] = data[i]
return parameters
def get_results(index, benchmark):
results = {
benchmark + "_branch_executed" : -1,
benchmark + "_branch_mispredict" : -1,
benchmark + "_branch_missrate" : -1,
benchmark + "_cycles" : -1,
benchmark + "_decode_earlyFlushes" : -1,
benchmark + "_dispatch_rsStalls" : -1,
benchmark + "_fetch_branchStalls" : -1,
benchmark + "_flushes" : -1,
benchmark + "_ipc" : -1,
benchmark + "_issue_backendStalls" : -1,
benchmark + "_issue_frontendStalls" : -1,
benchmark + "_issue_portBusyStalls" : -1,
benchmark + "_lsq_loadViolations" : -1,
benchmark + "_rename_allocationStalls" : -1,
benchmark + "_rename_lqStalls" : -1,
benchmark + "_rename_robStalls" : -1,
benchmark + "_rename_sqStalls" : -1,
benchmark + "_retired" : -1
}
result_file_name = os.path.join(PATH, "results-buffer", benchmark, "results-" + str(index) + ".txt")
print(result_file_name)
result_file = open(result_file_name)
for i in result_file.readlines():
if "Error from read_input" in i or "EMERGENCY SHUTDOWN" in i:
for j in range(len(results)):
results[j] = -1
break
for j in results:
if all(k in i for k in j.split('_')[1:]) and ("cycles." not in i):
try:
print(i)
results[j] = int(i.split()[-1].strip('%'))
except:
results[j] = float(i.split()[-1].strip('%'))
return results
columns = ["Config-no"]
data = [[CONFIG_NO]]
parameters = get_inputs(RUN_INDEX)
for j in parameters:
columns.append(j)
temp_data = []
for j in parameters:
temp_data.append(parameters[j])
for benchmark in dispatch_simeng.BENCHMARKS:
results = get_results(RUN_INDEX, benchmark)
for j in results:
temp_data.append(results[j])
columns.append(j)
data[0] += temp_data
df = pd.DataFrame(data, columns=columns)
#print(df)
df.to_csv(DB_NAME, mode='a', index=False, header=not os.path.isfile(DB_NAME))