-
Notifications
You must be signed in to change notification settings - Fork 0
/
gather.py
421 lines (392 loc) · 14.7 KB
/
gather.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
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
import os, sys
TOTALTIME = "total_time_mean"
IOSIZE = "io_size"
NITR = "n_itr"
XSIZE = "size_x"
YSIZE = "size_y"
ZSIZE = "size_z"
IOMODE = "io_mode"
DRIVER = "io_driver"
NN = "number_of_nodes"
NP = "number_of_procs"
xname = {NP: "Number of Processes",
DRIVER: "IO Driver",
IOMODE: "IO Mode",
"dw_blocking_coll": "BB",
"dw_private_blocking_coll": "BB-P",
"dw_shared_blocking_coll": "BB-S",
"ncmpi_blocking_coll": "NC-BC",
"ncmpi_nonblocking_coll": "NC-NC",
"ncmpi_blocking_indep": "NC-BI",
"ncmpi_nonblocking_indep": "NC-NI",
"stage_blocking_coll": "DW-BC",
"stage_blocking_indep": "DW-BI",
"stage_nonblocking_coll": "DW-NC",
"stage_nonblocking_indep": "DW-NI",
"blocking_coll": "BC",
"blocking_indep": "BI",
"nonblocking_coll": "NC",
"nonblocking_indep": "NI",
256: "256",
512: "512",
1024: "1024",
2048: "2048",
4096: "4096",
8192: "8192",
}
def gather(dir:str):
recs = []
for filename in os.listdir(dir):
if filename.endswith(".txt"):
path = os.path.join(dir, filename)
rec = {}
currec = None
drop = False
with open(path, 'r') as fin:
stageouttime = 0
for line in fin:
if (line[:40] == '-----+-----++------------+++++++++--+---'):
if (rec[DRIVER] == "stage"):
if rec["stage_time"] == 0:
rec["stage_time"] = stageouttime
rec["total_time_mean"] = rec["btio_time_mean"] + stageouttime
rec["total_time_min"] = rec["btio_time_min"] + stageouttime
rec["total_time_max"] = rec["btio_time_max"] + stageouttime
else:
stageouttime = rec["stage_time"]
rec["total_time_mean"] = rec["btio_time_mean"] + stageouttime
rec["total_time_min"] = rec["btio_time_min"] + stageouttime
rec["total_time_max"] = rec["btio_time_max"] + stageouttime
recs.append(rec)
rec = {}
elif (line[:3] == '#%$'):
tokens = line.split(sep = ':')
val = tokens[2].strip()
try:
int(val)
val = int(val)
except ValueError:
try:
float(val)
val = float(val)
except ValueError:
val = val
rec[tokens[1].strip()] = val
elif (line[:5] == 'Error' or line[:7] == '#Error!'):
print(line)
drop = True
return recs
def plot_driver_np(fout, recs:list, filter:dict):
cnt = {}
time = {}
size = {}
xs = set()
ys = set()
for rec in recs:
drop = False
for k in filter:
if (k not in rec or rec[k] != filter[k]):
drop = True
break
if not drop:
x = rec[NP]
y = rec[DRIVER] + "_" + rec[IOMODE]
k = str(x) + "/" + str(y)
xs.add(x)
ys.add(y)
if k not in cnt:
cnt[k] = 1
time[k] = rec[TOTALTIME]
size[k] = rec[IOSIZE]
else:
cnt[k] += 1
if (time[k] > rec[TOTALTIME]):
time[k] = rec[TOTALTIME]
size[k] = rec[IOSIZE]
xs = sorted(list(xs))
ys = sorted(list(ys))
fout.write("End to End IO Time, Time (sec), ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", ")
for y in ys:
fout.write(str(xname[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(xname[x]) + ", ")
for y in ys:
k = str(x) + "/" + str(y)
if (k in time):
fout.write(str(time[k]))
fout.write(", ")
fout.write("\n")
fout.write("Total IO Size, Size (GiB), ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", ")
for y in ys:
fout.write(str(xname[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(xname[x]) + ", ")
for y in ys:
k = str(x) + "/" + str(y)
if (k in size):
fout.write(str(size[k]))
fout.write(", ")
fout.write("\n")
fout.write("End to End IO Bandwidth, Bandwidth (GiB/s), ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", ")
for y in ys:
fout.write(str(xname[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(xname[x]) + ", ")
for y in ys:
k = str(x) + "/" + str(y)
if (k in time and k in size):
fout.write(str(size[k] / time[k] / 1024 / 1024 / 1024))
fout.write(", ")
fout.write("\n")
fout.write("Runs, ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", ")
for y in ys:
fout.write(str(xname[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(xname[x]) + ", ")
for y in ys:
k = str(x) + "/" + str(y)
if (k in cnt):
fout.write(str(cnt[k]))
fout.write(", ")
fout.write("\n")
def plot_stage_np_mode(fout, recs:list, filter:dict):
table = {}
cnt = {}
xs = set()
x2s = set()
ys = set()
for rec in recs:
drop = False
for k in filter:
if (k not in rec or rec[k] != filter[k]):
drop = True
break
if not drop:
x = rec[NP]
x2 = rec[IOMODE]
xs.add(x)
x2s.add(x2)
k = str(x) + "_" + str(x2)
if k not in table:
table[k] = rec
cnt[k] = 1
else:
cnt[k] += 1
if (table[k][TOTALTIME] > rec[TOTALTIME]):
table[k] = rec
xs = sorted(list(xs))
x2s = sorted(list(x2s))
ys = ["total_time_mean", "btio_time_mean", "stage_time"]
xys = {"total_time_mean": "Total Time", "btio_time_mean": "Time Writting to BB", "stage_time": "Time Staging Out"}
fout.write("DW Stagin Time Breakdown, Time (Sec), ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", " + xname[IOMODE] + ", ")
for y in ys:
fout.write(str(xys[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(xname[x]))
for x2 in x2s:
fout.write(", " + str(xname[x2]) + ", ")
k = str(x) + "_" + str(x2)
if (k in table):
for y in ys:
if (y in table[k]):
fout.write(str(table[k][y]))
fout.write(", ")
fout.write("\n")
fout.write("Runs, ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", " + xname[IOMODE] + ", ")
for y in ys:
fout.write(str(xys[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(xname[x]))
for x2 in x2s:
fout.write(", " + str(xname[x2]) + ", ")
k = str(x) + "_" + str(x2)
if (k in table):
for y in ys:
if (y in table[k]):
fout.write(str(cnt[k]))
fout.write(", ")
fout.write("\n")
def plot_dw_np(fout, recs:list, filter:dict):
table = {}
cnt = {}
xs = set()
ys = set()
for rec in recs:
drop = False
for k in filter:
if (k not in rec or rec[k] != filter[k]):
drop = True
break
if not drop:
x = rec[NP]
xs.add(x)
if x not in table:
table[x] = rec
cnt[x] = 1
else:
cnt[x] += 1
if (table[x][TOTALTIME] > rec[TOTALTIME]):
table[x] = rec
xs = sorted(list(xs))
ys = ["dw_total_time_mean", "dw_create_time_mean", "dw_enddef_time_mean", "dw_put_time_mean", "dw_flush_time_mean", "dw_close_time_mean",
"dw_put_data_wr_time_mean", "dw_put_meta_wr_time_mean", "dw_put_num_wr_time_mean",
"dw_flush_replay_time_mean", "dw_flush_data_rd_time_mean", "dw_flush_put_time_mean", "dw_flush_wait_time_mean"]
xys = {"dw_total_time_mean": "Time in DW Driver", "dw_create_time_mean": "Time Creating Log", "dw_enddef_time_mean": "Time Enddef", "dw_put_time_mean": "Time Writing Log", "dw_flush_time_mean": "Time Flushing Log", "dw_close_time_mean": "Time Closing Log",
"dw_put_data_wr_time_mean": "Time Writing Data", "dw_put_meta_wr_time_mean": "Time Writing Metadata", "dw_put_num_wr_time_mean": "Time Updateing Num",
"dw_flush_replay_time_mean": "Time Replaying Log", "dw_flush_data_rd_time_mean": "Time Reading Data", "dw_flush_put_time_mean": "Time Calling Put", "dw_flush_wait_time_mean": "Time Waiting"}
fout.write("DW Driver Time Breakdown, Time (Sec), ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", ")
for y in ys:
fout.write(str(xys[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(x) + ", ")
for y in ys:
if (y in table[x]):
fout.write(str(table[x][y]))
fout.write(", ")
fout.write("\n")
fout.write("Runs, ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", ")
for y in ys:
fout.write(str(xys[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(x) + ", ")
for y in ys:
if (y in table[x]):
fout.write(str(cnt[x]))
fout.write(", ")
fout.write("\n")
def plot_dw_np_cmp(fout, recs:list, filter:dict):
table = {}
cnt = {}
xs = set()
x2s = set()
ys = set()
for rec in recs:
drop = False
for k in filter:
drop = True
if (k in rec):
for f in list(filter[k]):
if rec[k] == f:
drop = False
if drop:
break
if not drop:
x = rec[NP]
x2 = rec[DRIVER]
xs.add(x)
x2s.add(x2)
k = str(x) + "/" + str(x2)
if k not in table:
table[k] = rec
cnt[k] = 1
else:
cnt[k] += 1
if (table[k][TOTALTIME] > rec[TOTALTIME]):
table[k] = rec
xs = sorted(list(xs))
x2s = sorted(list(x2s))
ys = ["dw_total_time_mean", "dw_create_time_mean", "dw_enddef_time_mean", "dw_put_time_mean", "dw_flush_time_mean", "dw_close_time_mean",
"dw_put_data_wr_time_mean", "dw_put_meta_wr_time_mean", "dw_put_num_wr_time_mean",
"dw_flush_replay_time_mean", "dw_flush_data_rd_time_mean", "dw_flush_put_time_mean", "dw_flush_wait_time_mean"]
xys = {"dw_total_time_mean": "Time in DW Driver", "dw_create_time_mean": "Time Creating Log", "dw_enddef_time_mean": "Time Enddef", "dw_put_time_mean": "Time Writing Log", "dw_flush_time_mean": "Time Flushing Log", "dw_close_time_mean": "Time Closing Log",
"dw_put_data_wr_time_mean": "Time Writing Data", "dw_put_meta_wr_time_mean": "Time Writing Metadata", "dw_put_num_wr_time_mean": "Time Updateing Num",
"dw_flush_replay_time_mean": "Time Replaying Log", "dw_flush_data_rd_time_mean": "Time Reading Data", "dw_flush_put_time_mean": "Time Calling Put", "dw_flush_wait_time_mean": "Time Waiting"}
xx2s = {"dw": "BB",
"dw_shared": "BB-S",
"dw_private": "BB-P", }
fout.write("DW Driver Time Breakdown, Time (Sec), ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", " + xname[DRIVER] + ", ")
for y in ys:
fout.write(str(xys[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(xname[x]))
for x2 in x2s:
fout.write(", " + str(xx2s[x2]) + ", ")
k = str(x) + "/" + str(x2)
if k in table:
for y in ys:
if (y in table[k]):
fout.write(str(table[k][y]))
fout.write(", ")
fout.write("\n")
fout.write("Runs, ")
for k in filter:
fout.write(str(k) + ": " + str(filter[k]) + ",")
fout.write("\n")
fout.write(xname[NP] + ", " + xname[DRIVER] + ", ")
for y in ys:
fout.write(str(xys[y]) + ", ")
fout.write("\n")
for x in xs:
fout.write(str(xname[x]))
for x2 in x2s:
fout.write(", " + str(xx2s[x2]) + ", ")
k = str(x) + "/" + str(x2)
if k in table:
for y in ys:
if (y in table[k]):
fout.write(str(cnt[k]))
fout.write(", ")
fout.write("\n")
def main(argv:list):
dir = 'C:/Users/x3276/OneDrive/Research/Log io/Result/btio/theta'
if len(argv) > 1:
dir = argv[1]
recs = gather(dir)
with open('btio.csv', 'w') as fout:
filter = {}
plot_driver_np(fout, recs, filter)
filter = {DRIVER: 'dw'}
plot_dw_np(fout, recs, filter)
filter = {DRIVER: 'dw_shared'}
plot_dw_np(fout, recs, filter)
filter = {DRIVER: ['dw', 'dw_shared', 'dw_private']}
plot_dw_np_cmp(fout, recs, filter)
filter = {DRIVER: 'stage'}
plot_stage_np_mode(fout, recs, filter)
if __name__=='__main__':
main(sys.argv)