-
Notifications
You must be signed in to change notification settings - Fork 1
/
parselog_gpu.py
executable file
·118 lines (97 loc) · 4.31 KB
/
parselog_gpu.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
#!/usr/bin/python
import sys, getopt
def main(argv):
input_file = open(argv[0], 'r')
alltimes = {}
allstatu = {}
allbegin = {}
allworke = {}
for line in input_file:
sl = line.split()
if len(sl)==0:
continue
if sl[0]=='7' :
# print sl[2].find('t', 0, 0), sl[2]
# if sl[2].find('t') == 0:
if sl[3] == 'W':
allworke[sl[2]] = sl[5]
if sl[2].find('w') == 0:
#if sl[2].find(argv[1]) == 0:
if not alltimes.has_key(sl[2]):
alltimes[sl[2]] = {} #{'I':0, 'D':0, 'Fi':0, 'Po':0, 'C':0, 'B':0, 'E':0, 'Sc':0, 'Sl':0, 'P':0, 'U':0}
allstatu[sl[2]] = 'no'
allbegin[sl[2]] = -1
if sl[2].find('t') == 0:
#if sl[2].find(argv[1]) == 0:
if not alltimes.has_key(sl[2]):
alltimes[sl[2]] = {} #{'I':0, 'D':0, 'Fi':0, 'Po':0, 'C':0, 'B':0, 'E':0, 'Sc':0, 'Sl':0, 'P':0, 'U':0}
allstatu[sl[2]] = 'no'
allbegin[sl[2]] = -1
elif sl[0]=='10':
if alltimes.has_key(sl[2]):
# print 'Fucking error 1 '+sl[2]
# else:
thread = sl[2]
t = float(sl[1])
if allstatu[thread] != 'no':
if alltimes[thread].has_key(allstatu[thread]):
alltimes[thread][allstatu[thread]] += t-float(allbegin[thread])
else:
alltimes[thread][allstatu[thread]] = t-float(allbegin[thread])
else:
alltimes[thread]['P'] = t-float(allbegin[thread])
allbegin[thread] = t
allstatu[thread] = sl[4]
# print 'Fucking error 1 '+sl[4]
elif sl[0]=='9':
if sl[4]=='stop_profiling':
stopt = float(sl[1])
# for th in alltimes:
# if alltimes[thread].has_key('Sl'):
# alltimes[th]['Sl'] += stopt-float(allbegin[th])
# else:
# alltimes[th]['Sl'] = stopt-float(allbegin[th])
glob_tt_time = 0
glob_ov_time = 0
glob_sl_time = 0
glob_ex_time = 0
glob_fi_time = 0
for th in alltimes:
if th.find('w') == 0:
if allworke[th].find('CUDA') == 0:
alltimes[th] = {}
# print th ,alltimes[th]
# for th in alltimes:
# print th, alltimes[th]
for th in alltimes:
if alltimes[th]:
# print th
th_tt_time = sum(alltimes[th].values())
th_ex_time = 0
th_fi_time = 0
# if(argv[1]=='w'):
if(alltimes[th].has_key('FACTO_BLK' )): th_ex_time += alltimes[th]['FACTO_BLK' ]
if(alltimes[th].has_key('SOLVE_BLK' )): th_ex_time += alltimes[th]['SOLVE_BLK' ]
if(alltimes[th].has_key('UPDATE_BLK' )): th_ex_time += alltimes[th]['UPDATE_BLK' ]
if(alltimes[th].has_key('UPDATE_BETWEEN')): th_ex_time += alltimes[th]['UPDATE_BETWEEN']
if (alltimes[th].has_key('E')):
th_ex_time = alltimes[th]['E']
if (alltimes[th].has_key('Sl')):
th_sl_time = alltimes[th]['Sl']
if (alltimes[th].has_key('Fi')):
th_fi_time = alltimes[th]['Fi']
#elif(argv[1]=='t'):
# th_ex_time = alltimes[th]['E']
th_ov_time = th_tt_time-th_sl_time-th_ex_time-th_fi_time
glob_tt_time += th_tt_time
glob_ex_time += th_ex_time
glob_ov_time += th_ov_time
glob_sl_time += th_sl_time
glob_fi_time += th_fi_time
# print th,' ',th_ex_time/th_tt_time,th_sl_time/th_tt_time,th_ov_time/th_tt_time
# else:
# print th
# print '\nGlobal: ',glob_ex_time/glob_tt_time,glob_sl_time/glob_tt_time,glob_ov_time/glob_tt_time
print("%-50s (exec., idle, ohead, finp): %10.0f (%6.3f), %10.0f (%6.3f), %10.0f (%6.3f), %10.0f (%6.3f) = %10.0f"%(argv[0],glob_ex_time,glob_ex_time/glob_tt_time,glob_sl_time,glob_sl_time/glob_tt_time,glob_ov_time,glob_ov_time/glob_tt_time,glob_fi_time,glob_fi_time/glob_tt_time,glob_tt_time))
if __name__ == "__main__":
main(sys.argv[1:])