1 import os.path, glob, sys
17 g = ROOT.TFile(
'benchmark_'+arch+
'_'+sample+
'.root',
'update')
20 vuvals = [
'1',
'2',
'4',
'8']
23 if arch ==
'KNL' or arch ==
'SKL-SP' or arch ==
'LNX-G' or arch ==
'LNX-S':
25 vuvals.append(
'16int')
29 print arch,
'is not a valid architecture! Exiting...' 34 makeplots(arch,sample,build,vuvals,nth,
'VU')
39 thvals = [
'1',
'2',
'4',
'8',
'16',
'32',
'64',
'96',
'128',
'160',
'192',
'224',
'256']
42 thvals = [
'1',
'2',
'4',
'6',
'8',
'12',
'16',
'20',
'24']
43 elif arch ==
'SKL-SP' :
45 thvals = [
'1',
'2',
'4',
'8',
'16',
'32',
'48',
'64']
46 elif arch ==
'LNX-G' :
48 thvals = [
'1',
'2',
'4',
'8',
'16',
'32',
'48',
'64']
49 elif arch ==
'LNX-S' :
51 thvals = [
'1',
'2',
'4',
'8',
'16',
'32',
'48',
'64']
53 print arch,
'is not a valid architecture! Exiting...' 58 makeplots(arch,sample,build,thvals,nvu,
'TH')
65 if build ==
'BH' : pos = 8
66 elif build ==
'STD' : pos = 11
67 elif build ==
'CE' : pos = 14
68 elif build ==
'FV' : pos = 17
70 print build,
'is not a valid test! Exiting...' 74 print arch,sample,build,text
77 g_time = ROOT.TGraphErrors(len(vals)-1)
78 g_speedup = ROOT.TGraphErrors(len(vals)-1)
82 g_time_int = ROOT.TGraphErrors(1)
83 g_speedup_int = ROOT.TGraphErrors(1)
87 if val
is '16int': xval = 16.0
88 elif val
is '8int' : xval = 8.0
89 else : xval =
float(val)
92 yvals = array.array(
'd');
98 if text
is 'VU' : os.system(
'grep Matriplex log_'+arch+
'_'+sample+
'_'+build+
'_NVU'+val+
'_NTH'+nC +
'.txt >& log_'+arch+
'_'+sample+
'_'+build+
'_'+text+
'.txt')
99 elif text
is 'TH' : os.system(
'grep Matriplex log_'+arch+
'_'+sample+
'_'+build+
'_NVU'+nC +
'_NTH'+val+
'.txt >& log_'+arch+
'_'+sample+
'_'+build+
'_'+text+
'.txt')
101 print 'VU or TH are the only options for extra text! Exiting...' 105 with open(
'log_'+arch+
'_'+sample+
'_'+build+
'_'+text+
'.txt')
as f :
107 if 'Matriplex' not in line :
continue 108 if 'Total' in line :
continue 112 lsplit = line.split()
113 yvals.append(
float(lsplit[pos]))
117 for yval
in range(0,len(yvals)):
118 sum = sum + yvals[yval]
120 mean = sum/len(yvals)
124 for yval
in range(0,len(yvals)):
125 emean = emean + ((yvals[yval] - mean) * (yvals[yval] - mean))
127 emean = math.sqrt(emean / (len(yvals) - 1))
128 emean = emean/math.sqrt(len(yvals))
133 print val,mean,
'+/-',emean
136 if 'int' not in val :
137 g_time.SetPoint(point,xval,mean)
138 g_time.SetPointError(point,0,emean)
141 g_time_int.SetPoint(0,xval,mean)
142 g_time_int.SetPointError(0,0,emean)
145 g_time.Write(
'g_'+build+
'_'+text+
'_time')
149 g_time_int.Write(
'g_'+build+
'_'+text+
'_time_int')
152 xval0 = array.array(
'd',[0])
153 yval0 = array.array(
'd',[0])
154 yerr0 = array.array(
'd',[0])
157 g_time.GetPoint(0,xval0,yval0)
158 yerr0.append(g_time.GetErrorY(0))
163 xval = array.array(
'd',[0])
164 yval = array.array(
'd',[0])
165 yerr = array.array(
'd',[0])
168 if 'int' not in val :
169 g_time.GetPoint(point,xval,yval)
170 yerr.append(g_time.GetErrorY(point))
172 g_time_int.GetPoint(0,xval,yval)
173 yerr.append(g_time_int.GetErrorY(0))
177 if yval[0] > 0.
and yval0[0] > 0. :
178 speedup = yval0[0]/yval[0]
179 espeedup = speedup * math.sqrt(math.pow(yerr0[0]/yval0[0],2) + math.pow(yerr[0]/yval[0],2))
182 if 'int' not in val :
183 g_speedup.SetPoint(point,xval[0],speedup)
184 g_speedup.SetPointError(point,0,espeedup)
187 g_speedup_int.SetPoint(0,xval[0],speedup)
188 g_speedup_int.SetPointError(0,0,espeedup)
191 g_speedup.Write(
'g_'+build+
'_'+text+
'_speedup')
195 g_speedup_int.Write(
'g_'+build+
'_'+text+
'_speedup_int')
200 if __name__ ==
"__main__":
def makeplots(arch, sample, build, vals, nC, text)