-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_all.py
More file actions
235 lines (193 loc) · 12.7 KB
/
run_all.py
File metadata and controls
235 lines (193 loc) · 12.7 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
import subprocess
import os
from multiprocessing.pool import ThreadPool
from datetime import datetime
import concurrent.futures
exps = [
# ("32CUPerGPU_withoutCache", "atax", []),
# ("32CUPerGPU_withoutCache", "bicg", []),
# ("32CUPerGPU_withoutCache", "bitonicsort", []),
# ("32CUPerGPU_withoutCache", "fastwalshtransform", []),
# ("32CUPerGPU_withoutCache", "fir", []),
# ("32CUPerGPU_withoutCache", "fft", []),
# ("32CUPerGPU_withoutCache", "im2col", []),
# ("32CUPerGPU_withoutCache", "kmeans", []),
# ("32CUPerGPU_withoutCache", "matrixmultiplication", []),
# ("32CUPerGPU_withoutCache", "matrixtranspose", []),
# ("32CUPerGPU_withoutCache", "nbody", []),
# ("32CUPerGPU_withoutCache", "nw", []),
# ("32CUPerGPU_withoutCache", "pagerank", []),
# ("32CUPerGPU_withoutCache", "relu", []),
# ("32CUPerGPU_withoutCache", "spmv", []),
# ("64CUPerGPU_withCache", "atax", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "bicg", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "bitonicsort", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "fastwalshtransform", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "fir", ["-analyzer-Name=firport -analyzer-period=1e-6"]),
# ("64CUPerGPU_withoutCache", "fft", []),
# ("64CUPerGPU_withoutCache", "im2col", []),
# ("64CUPerGPU_withCache", "kmeans", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "matrixtranspose", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withoutCache", "nbody", []),
# ("64CUPerGPU_withoutCache", "nw", []),
# ("64CUPerGPU_withCache", "pagerank", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "relu", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "spmv", [" -num-memory-banks=16 -bandwidth=96"]),
# ("4CUPerGPU_withCache", "fft", [" -num-memory-banks=1 -bandwidth=6"]),
# ("4CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=1 -bandwidth=6"]),
# ("4CUPerGPU_withCache", "atax", [" -num-memory-banks=1 -bandwidth=6"]),
# ("4CUPerGPU_withCache", "bicg", ["-num-memory-banks=1 -bandwidth=6"]),
# ("4CUPerGPU_withCache", "bitonicsort", ["-num-memory-banks=1 -bandwidth=6"]),
# ("4CUPerGPU_withCache", "kmeans", [" -num-memory-banks=1 -bandwidth=6"]),
# ("4CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=1 -bandwidth=6"]),
# ("4CUPerGPU_withCache", "spmv", [" -num-memory-banks=1 -bandwidth=6"]),
# ("8CUPerGPU_withCache", "fft", [" -num-memory-banks=2 -bandwidth=12"]),
# ("8CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=2 -bandwidth=12"]),
# ("8CUPerGPU_withCache", "atax", [" -num-memory-banks=2 -bandwidth=12"]),
# ("8CUPerGPU_withCache", "bicg", ["-num-memory-banks=2 -bandwidth=12"]),
# ("8CUPerGPU_withCache", "bitonicsort", ["-num-memory-banks=2 -bandwidth=12"]),
# ("8CUPerGPU_withCache", "kmeans", [" -num-memory-banks=2 -bandwidth=12"]),
# ("8CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=2 -bandwidth=12"]),
# ("8CUPerGPU_withCache", "spmv", [" -num-memory-banks=2 -bandwidth=12"]),
# ("16CUPerGPU_withCache", "fft", [" -num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "atax", [" -num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "bicg", ["-num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "bitonicsort", ["-num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "kmeans", [" -num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "spmv", [" -num-memory-banks=4 -bandwidth=24"]),
# ("32CUPerGPU_withCache", "fft", [" -num-memory-banks=8 -bandwidth=48"]),
# ("32CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=8 -bandwidth=48"]),
# ("32CUPerGPU_withCache", "atax", [" -num-memory-banks=8 -bandwidth=48"]),
# ("32CUPerGPU_withCache", "bicg", ["-num-memory-banks=8 -bandwidth=48"]),
# ("32CUPerGPU_withCache", "bitonicsort", ["-num-memory-banks=8 -bandwidth=48"]),
# ("32CUPerGPU_withCache", "kmeans", [" -num-memory-banks=8 -bandwidth=48"]),
# ("32CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=8 -bandwidth=48"]),
# ("32CUPerGPU_withCache", "spmv", [" -num-memory-banks=8 -bandwidth=48"]),
("64CUPerGPU_withCache", "fft", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "im2col", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "atax", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "bicg", ["-num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "bitonicsort", ["-num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "kmeans", [" -num-memory-banks=16 -bandwidth=96"]),
("64CUPerGPU_withCache", "matrixtranspose", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "spmv", [" -num-memory-banks=16 -bandwidth=96"]),
# ("128CUPerGPU_withCache", "fft", [" -num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "atax", [" -num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "bicg", [" -num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "bitonicsort", [" -num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "kmeans", [" -num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "spmv", [" -num-memory-banks=32 -bandwidth=192"]),
# ("256CUPerGPU_withCache", "fft", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "atax", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "bicg", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "bitonicsort", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "kmeans", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "pagerank", [" -num-memory-banks=64 -bandwidth=384"]),
# ("16CUPerGPU_withCache", "fastwalshtransform", [" -num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "im2col", ["-num-memory-banks=4 -bandwidth=24 "]),
# ("8CUPerGPU_withCache", "im2col", ["-num-memory-banks=2 -bandwidth=12 "]),
# ("32CUPerGPU_withCache", "relu", ["-num-memory-banks=8 -bandwidth=48 "]),
# ("16CUPerGPU_withCache", "matrixtranspose", [" -num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "pagerank", [" -num-memory-banks=4 -bandwidth=24"]),
# ("16CUPerGPU_withCache", "relu", [" -num-memory-banks=4 -bandwidth=24"]),
# ("32CUPerGPU_withCache", "fastwalshtransform", [" -num-memory-banks=8 -bandwidth=48"]),
# # ("64CUPerGPU_withCache", "im2col", [" -num-memory-banks=16 -bandwidth=96"]),
# ("32CUPerGPU_withCache", "matrixtranspose", [" -num-memory-banks=8 -bandwidth=48"]),
# # ("64CUPerGPU_withCache", "pagerank", [" -num-memory-banks=16 -bandwidth=96"]),
# # ("64CUPerGPU_withCache", "relu", [" -num-memory-banks=16 -bandwidth=96"]),
# ("64CUPerGPU_withCache", "fastwalshtransform", [" -num-memory-banks=16 -bandwidth=96"]),
("64CUPerGPU_withCache", "im2col", [" -num-memory-banks=16 -bandwidth=96"]),
("64CUPerGPU_withCache", "matrixtranspose", [" -num-memory-banks=16 -bandwidth=96"]),
("64CUPerGPU_withCache", "pagerank", [" -num-memory-banks=16 -bandwidth=96"]),
("64CUPerGPU_withCache", "fir", [" -num-memory-banks=16 -bandwidth=96"]),
("64CUPerGPU_withCache", "relu", [" -num-memory-banks=16 -bandwidth=96"]),
("64CUPerGPU_withCache", "spmv", [" -num-memory-banks=16 -bandwidth=96"]),
# ("128CUPerGPU_withCache", "fastwalshtransform", [" -num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "im2col", ["-num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "matrixtranspose", ["-num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "pagerank", ["-num-memory-banks=32 -bandwidth=192"]),
# ("128CUPerGPU_withCache", "relu", ["-num-memory-banks=32 -bandwidth=192"]),
# ("256CUPerGPU_withCache", "fastwalshtransform", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "im2col", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "matrixtranspose", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "pagerank", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "relu", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "atax", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "bicg", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "bitonicsort", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "fastwalshtransform", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "fir", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "fft", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "im2col", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "kmeans", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "matrixmultiplication", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "matrixtranspose", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "nbody", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "nw", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "pagerank", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "relu", [" -num-memory-banks=64 -bandwidth=384"]),
# ("256CUPerGPU_withCache", "spmv", [" -num-memory-banks=64 -bandwidth=384"]),
# ("32CUPerGPU_withCache", "matrixtranspose", [" -num-memory-banks=8 -bandwidth=48"]),
# ("16CUPerGPU_withCache", "fft", [" -num-memory-banks=4 -bandwidth=24"]),
# ("8CUPerGPU_withCache", "stencil2d", [" -num-memory-banks=2 -bandwidth=12"]),
]
output_dir = ""
def run_exp(exp):
try:
cwd = os.getcwd()
file_name = f'{output_dir}/{exp[0]}_{exp[1]}_{"_".join(exp[2])}'
metic_file_name = file_name + ' _metrics'
cmd = f"{cwd}/{exp[0]}/{exp[0]} -benchmark={exp[1]} -timing " + \
"-magic-memory-copy -report-all " + \
" ".join(exp[2]) + " " + \
f"-metric-file-name={metic_file_name}" + \
"".join(exp[2])
print(cmd)
out_file_name = file_name+'_out.stdout'
out_file = open(out_file_name, "w")
out_file.write(f'Executing {cmd}\n')
start_time = datetime.now()
out_file.write(f'Start time: {start_time}\n')
out_file.flush()
process = subprocess.Popen(
cmd, shell=True, stdout=out_file, stderr=out_file, cwd=cwd)
process.wait()
end_time = datetime.now()
out_file.write(f'End time: {end_time}\n')
elapsed_time = end_time - start_time
out_file.write(f'Elapsed time: {elapsed_time}\n')
if process.returncode != 0:
print("Error executing ", cmd)
else:
print("Executed ", cmd, ", time ", elapsed_time)
out_file.close()
except Exception as e:
print(e)
def create_output_dir():
global output_dir
output_dir = f'results/{datetime.now().strftime("%Y-%m-%d-%H-%M-%S-64CUFinal")}'
if not os.path.exists('results'):
os.makedirs('results')
if not os.path.exists(output_dir):
os.makedirs(output_dir)
def main():
cwd = os.getcwd()
create_output_dir()
process = subprocess.Popen("cd 64CUPerGPU_withCache && go build", shell=True, cwd=cwd)
process.wait()
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
future = [executor.submit(run_exp, exp) for exp in exps]
for future in concurrent.futures.as_completed(future):
print(future.result())
tp.close()
tp.join()
if __name__ == "__main__":
main()