forked from UVA-LavaLab/graphTango
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollect.py
More file actions
executable file
·356 lines (294 loc) · 11.1 KB
/
Copy pathcollect.py
File metadata and controls
executable file
·356 lines (294 loc) · 11.1 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
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
#!/usr/bin/env python3
import sys
import os
algoMap = {
"bfsfromscratch" : "bfs_fs",
"bfsdyn" : "bfs",
"prfromscratch" : "pr_fs",
"prdyn" : "pr",
"ssspfromscratch" : "sssp_fs",
"ssspdyn" : "sssp",
"sswpfromscratch" : "sswp_fs",
"sswpdyn" : "sswp",
"mcfromscratch" : "mc_fs",
"mcdyn" : "mc",
"ccfromscratch" : "cc_fs",
"ccdyn" : "cc"
}
datasetMap = {
"LiveJournal.csv" : "LiveJournal",
"WikiTalk.csv" : "Talk",
"orkut.csv" : "Orkut",
"wiki-topcats.csv" : "Wiki",
"rmat_1_1.csv" : "1",
"rmat_1_2.csv" : "2",
"rmat_1_4.csv" : "4",
"rmat_1_8.csv" : "8",
"rmat_1_16.csv" : "16",
"rmat_1_32.csv" : "32",
"rmat_1_64.csv" : "64",
"rmat_1_128.csv" : "128",
"rmat_1_256.csv" : "256",
}
dsMap = {
#"stinger" : "Stinger",
#"adListShared" : "AdListShared",
#"adListChunked" : "AdListChunked",
#"degAwareRHH" : "DegAwareRHH",
#"graphite" : "Ours",
#"graphite_2" : "Threshold 2",
#"graphite_4" : "Threshold 4",
#"graphite_8" : "Threshold 8",
#"graphite_16" : "Threshold 16",
#"graphite_32" : "Threshold 32",
#"graphite_64" : "Threshold 64",
#"graphite_128" : "Threshold 128",
#"graphite_256" : "Hybrid",
#"graphite_512" : "Threshold 512",
#"graphite_1024" : "Threshold 1024",
#"graphite_hash" : "Hash only",
#"graphite_linear" : "Linear only",
#"graphite_512_1" : "Th_512_Min_1",
#"graphite_512_2" : "Th_512_Min_2",
#"graphite_512_4" : "Th_512_Min_4",
#"graphite_512_8" : "Th_512_Min_8",
#"graphite_512_16" : "Th_512_Min_16",
#"graphite_512_32" : "Th_512_Min_32",
#"graphite_128_grp" : "Threshold 128 grp",
#"graphite_256_grp" : "Threshold 256 grp",
#"graphite_512_grp" : "Threshold 512 grp",
#"graphite_1024_grp" : "Threshold 1024 grp",
#"graphite_512_lock" : "Threshold 512 lock",
#"graphite_512_tight" : "Threshold 512 tight",
#"graphite_512_cfh" : "Threshold 512 cfh",
#"graphite_32_cfh" : "Threshold 32 cfh",
#"graphite_cfh_only" : "cfh only",
#"graphite_cfh_2cache" : "cfh 2 lines",
#"graphite_chf_2" : "CFH",
#"graphite_cfh_256" : "CFH + adjList (256)",
#"graphite_cfh_128" : "CFH + adjList (128)",
#"graphite_cfh_64" : "CFH + adjList",
#"graphite_cfh_32" : "CFH + adjList (32)",
#"graphite_cfh_16" : "CFH + adjList (16)",
#"del_graphite_cfh_64" : "CFH + adjList",
#"del_stinger" : "Stinger",
#"del_adListShared" : "AdListShared",
#"del_adListChunked" : "AdListChunked",
#"del_degAwareRHH" : "DegAwareRHH",
#"threads2_graphite" : "GraphTango 2Th",
#"threads2_stinger" : "Stinger 2Th",
#"threads2_adListShared" : "AdListShared 2Th",
#"threads2_adListChunked" : "AdListChunked 2Th",
#"threads4_graphite" : "GraphTango 4Th",
#"threads4_stinger" : "Stinger 4Th",
#"threads4_adListShared" : "AdListShared 4Th",
#"threads4_adListChunked" : "AdListChunked 4Th",
#"threads4_degAwareRHH" : "DegAwareRHH 4Th",
#"threads8_graphite" : "GraphTango 8Th",
#"threads8_stinger" : "Stinger 8Th",
#"threads8_adListShared" : "AdListShared 8Th",
#"threads8_adListChunked" : "AdListChunked 8Th",
#"threads8_degAwareRHH" : "DegAwareRHH 8Th",
#-------------------TH1 sweep for GTBalanced--------------
#"gtbalanced_th1_8" : "8",
#"gtbalanced_th1_16" : "16",
#"gtbalanced_th1_32" : "32",
#"gtbalanced_th1_64" : "64",
#"gtbalanced_th1_128" : "128",
#"gtbalanced_th1_256" : "256",
#"gtbalanced_th1_512" : "512",
#-------------------Core sweep for AdjListShared--------------
#"adListShared_cores_2" : "AdListShared 2",
#"adListShared_cores_4" : "AdListShared 4",
#"adListShared_cores_6" : "AdListShared 6",
#"adListShared_cores_8" : "AdListShared 8",
#"adListShared_cores_10" : "AdListShared 10",
#"adListShared_cores_12" : "AdListShared 12",
#-------------------Core sweep for AdjListChunked--------------
#"adListChunked_cores_2" : "AdListChunked 2",
#"adListChunked_cores_4" : "AdListChunked 4",
#"adListChunked_cores_6" : "AdListChunked 6",
#"adListChunked_cores_8" : "AdListChunked 8",
#"adListChunked_cores_10" : "AdListChunked 10",
#"adListChunked_cores_12" : "AdListChunked 12",
#-------------------Core sweep for Stinger--------------
#"stinger_cores_2" : "Stinger 2",
#"stinger_cores_4" : "Stinger 4",
#"stinger_cores_6" : "Stinger 6",
#"stinger_cores_8" : "Stinger 8",
#"stinger_cores_10" : "Stinger 10",
#"stinger_cores_12" : "Stinger 12",
#-------------------Core sweep for DAH--------------
#"degAwareRHH_cores_2" : "DAH 2",
#"degAwareRHH_cores_4" : "DAH 4",
#"degAwareRHH_cores_6" : "DAH 6",
#"degAwareRHH_cores_8" : "DAH 8",
#"degAwareRHH_cores_10" : "DAH 10",
#"degAwareRHH_cores_12" : "DAH 12",
#-------------------Core sweep for GTBalanced--------------
#"gtbalanced_th1_32_cores_2" : "TangoBalanced 2",
#"gtbalanced_th1_32_cores_4" : "TangoBalanced 4",
#"gtbalanced_th1_32_cores_6" : "TangoBalanced 6",
#"gtbalanced_th1_32_cores_8" : "TangoBalanced 8",
#"gtbalanced_th1_32_cores_10" : "TangoBalanced 10",
#"gtbalanced_th1_32" : "TangoBalanced 12",
#-------------------Main comparison---------------
#"adListShared_cores_12" : "AdListShared",
#"adListChunked_cores_12" : "AdListChunked",
#"stinger_cores_12" : "Stinger",
#"degAwareRHH_cores_12" : "DAH",
"gtbalanced_th1_32" : "GraphTango",
"graphTango" : "temp",
#-------------------Delete comparison---------------
#"adListShared_cores_12_del" : "AdListShared",
#"adListChunked_cores_12_del" : "AdListChunked",
#"stinger_cores_12_del" : "Stinger",
#"degAwareRHH_cores_12_del" : "DAH",
#"gtbalanced_th1_32_del" : "GraphTango",
#-------------------Comparison of sub-optimal versions---------------
#"gtbalanced_th1_32_type3" : "Type3 only",
#"gtbalanced_th1_32_abseil" : "Abseil",
#"gtbalanced_th1_32_RHH" : "GT RHH",
#"gtbalanced_th1_32_tsl_rhh" : "GT TSL",
"gtbalanced_th1_32_no_switch" : "GT No Switch",
"gtbalanced_th1_32_only_growth" : "GT Only Growth",
#"gtbalanced_th1_32_malloc_stdmap" : "Hybrid only",
#"gtbalanced_th1_32_stdmap" : "Hybrid + unordered_map",
#"gtbalanced_th1_32_malloc" : "Hybrid + malloc",
#"gtbalanced_th1_32" : "GraphTango",
#"degAwareCFH" : "degAwareCFH",
#"degAwareCFH_2" : "degAwareCFH2",
#"degAwareRHH_cores_12" : "DAH",
#"gtbalanced_th1_32_hugepage" : "GraphTango Hugepage",
#"graphite" : "GraphTango NN",
#--------------Impact of average degree-------------------------
#"adListShared_cores_12" : "AdListShared",
#"adListChunked_cores_12" : "AdListChunked",
#"stinger_cores_12" : "Stinger",
#"degAwareRHH_cores_12" : "DAH",
#"gtbalanced_th1_32" : "GraphTango",
}
#activeAlgoList = ["bfsdyn", "prdyn", "ssspdyn", "sswpdyn", "ccdyn", "mcdyn"]
#activeAlgoList = ["bfsdyn", "ssspdyn", "sswpdyn", "ccdyn", "mcdyn"]
activeAlgoList = ["bfsdyn"]
activeDatasetList = ["orkut.csv", "LiveJournal.csv", "wiki-topcats.csv", "WikiTalk.csv"]
#activeDatasetList = ["rmat_1_1.csv", "rmat_1_2.csv", "rmat_1_4.csv", "rmat_1_8.csv", "rmat_1_16.csv", "rmat_1_32.csv", "rmat_1_64.csv", "rmat_1_128.csv", "rmat_1_256.csv"]
def build_insert_csv(rootDir):
with open(rootDir + "/update.csv", "w") as outf:
for dataset in activeDatasetList:
headerPrinted = False
header = datasetMap[dataset] + ",batch,"
for ds in dsMap:
fname = rootDir + '/bfsdyn/' + ds + '/' + dataset + '/Update.csv'
print("Processing " + fname)
with open(fname, "r") as csvf:
lineCount = 0
currOut = datasetMap[dataset] + ',' + dsMap[ds] + ','
for line in csvf:
if headerPrinted == False:
lineCount = lineCount + 1
header = header + str(lineCount) + ','
currOut = currOut + line[:-1] + ','
currOut = currOut + '\n'
if headerPrinted == False:
header = header + '\n'
outf.write(header)
headerPrinted = True
outf.write(currOut)
outf.write(",\n,\n")
def build_algo_csv(rootDir):
for algo in activeAlgoList:
with open(rootDir + "/" + algoMap[algo] + ".csv", "w") as outf:
for dataset in activeDatasetList:
headerPrinted = False
header = datasetMap[dataset] + ",batch,"
for ds in dsMap:
fname = rootDir + '/' + algo + '/' + ds + '/' + dataset + '/Alg.csv'
print("Processing " + fname)
with open(fname, "r") as csvf:
lineCount = 0
currOut = datasetMap[dataset] + ',' + dsMap[ds] + ','
for line in csvf:
if headerPrinted == False:
lineCount = lineCount + 1
header = header + str(lineCount) + ','
currOut = currOut + line[:-1] + ','
currOut = currOut + '\n'
if headerPrinted == False:
header = header + '\n'
outf.write(header)
headerPrinted = True
outf.write(currOut)
outf.write(",\n,\n")
def build_summed_algo_csv(rootDir):
with open(rootDir + "/sum_algo.csv", "w") as outf:
for algo in activeAlgoList:
outf.write(",");
for dataset in activeDatasetList:
outf.write(',' + datasetMap[dataset])
outf.write('\n')
for ds in dsMap:
outf.write(algoMap[algo] + ',' + dsMap[ds])
for dataset in activeDatasetList:
fname = rootDir + '/' + algo + '/' + ds + '/' + dataset + '/Alg.csv'
print("Processing " + fname)
with open(fname, "r") as csvf:
tot = 0.0
for line in csvf:
tot = tot + float(line)
outf.write(',' + str(tot))
outf.write('\n')
outf.write('\n\n\n')
def build_summed_update_csv(rootDir):
with open(rootDir + "/sum_update.csv", "w") as outf:
for algo in activeAlgoList:
outf.write(",");
for dataset in activeDatasetList:
outf.write(',' + datasetMap[dataset])
outf.write('\n')
for ds in dsMap:
outf.write(algoMap[algo] + ',' + dsMap[ds])
for dataset in activeDatasetList:
fname = rootDir + '/' + algo + '/' + ds + '/' + dataset + '/Update.csv'
print("Processing " + fname)
with open(fname, "r") as csvf:
tot = 0.0
for line in csvf:
tot = tot + float(line)
outf.write(',' + str(tot))
outf.write('\n')
outf.write('\n\n\n')
def build_summed_tot_csv(rootDir):
with open(rootDir + "/total.csv", "w") as outf:
for algo in activeAlgoList:
outf.write(",");
for dataset in activeDatasetList:
outf.write(',' + datasetMap[dataset])
outf.write('\n')
for ds in dsMap:
outf.write(algoMap[algo] + ',' + dsMap[ds])
for dataset in activeDatasetList:
tot = 0.0
fname = rootDir + '/' + algo + '/' + ds + '/' + dataset + '/Update.csv'
print("Processing " + fname)
with open(fname, "r") as csvf:
for line in csvf:
tot = tot + float(line)
fname = rootDir + '/' + algo + '/' + ds + '/' + dataset + '/Alg.csv'
print("Processing " + fname)
with open(fname, "r") as csvf:
for line in csvf:
tot = tot + float(line)
outf.write(',' + str(tot))
outf.write('\n')
outf.write('\n\n\n')
if __name__ == "__main__":
if len(sys.argv) != 2:
print("usage: ./collect.py <result_root_dir>")
exit(-1)
rootDir = sys.argv[1]
# build_insert_csv(rootDir)
# build_algo_csv(rootDir)
build_summed_algo_csv(rootDir)
build_summed_update_csv(rootDir)
build_summed_tot_csv(rootDir)