-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcombine_ROC_MGG_8GPU_GIN.py
executable file
·54 lines (43 loc) · 1.63 KB
/
combine_ROC_MGG_8GPU_GIN.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
import csv
import os
# Read the first CSV file and get a column
# with open('UVM_GCN_8GPU.csv', 'r') as file1:
# reader = csv.reader(file1)
# col0 = [row[0] for row in reader]
# check the existance of those .csv file
if not os.path.exists("roc-new/3_run_d64_it100.csv"):
print("ROC GCN has not been executed yet!")
exit(-1)
if not os.path.exists("MGG_8GPU_GIN.csv"):
print("MGG GCN has not been executed yet!")
exit(-1)
with open('roc-new/3_run_d64_it100.csv', 'r') as file1:
reader = csv.reader(file1)
col1 = []
for row in reader:
try:
col1.append(float(row[1]))
except:
continue
# print(col0)
# print(col1)
# Read the second CSV file and get a column
with open('MGG_8GPU_GIN.csv', 'r') as file2:
reader = csv.reader(file2)
col2 = [float(row[1]) for row in reader]
with open('MGG_8GPU_GIN.csv', 'r') as file1:
reader = csv.reader(file1)
col0 = [row[0] for row in reader]
# print(col2)
# Compute the ratio of the values in the two columns
ratio = [col1[i] / col2[i] for i in range(len(col1))]
# Write the result, along with the original two columns, to a third CSV file
with open('Fig_9_ROC_MGG_8GPU_GIN.csv', 'w', newline='') as result_file:
writer = csv.writer(result_file)
writer.writerow(['Dataset', 'ROC-8GPU(ms)', 'MGG-8GPU(ms)', 'Speedup (x)'])
for i in range(len(col1)):
writer.writerow([col0[i].rstrip("_beg_pos.bin"), col1[i], col2[i], "{:.3f}".format(ratio[i])])
print("\n\nPlease check the [Fig_9_ROC_MGG_8GPU_GIN.csv] file!\n\n")
# os.system("mv UVM_8GPU.csv csvs/")
# os.system("mv MGG_8GPU.csv csvs/")
os.system("mv *.err logs/")