Belle II Software light-2406-ragdoll
evaluation.py
1#!/usr/bin/env python3
2
3
10
11
12def fFileExist(filename):
13 '''Test if file exists'''
14
15 try:
16 oFile = open(filename)
17 except OSError:
18 return 0
19 else:
20 oFile.close()
21 return 1
22
23
24def read(optlevel):
25 '''read time from output files'''
26
27 filename = 'output/output-' + optlevel + '.dat'
28 if fFileExist(filename) == 0:
29 print('missing ' + filename)
30 else:
31 CDCLegendreTracking = []
32 fobj = open(filename)
33 # read output file
34 for line in fobj:
35 if line.startswith('CDCLegendreTracking'):
36 words = line.split()
37 CDCLegendreTracking.append(float(words[6]))
38 fobj.close()
39 print(optlevel + ' read')
40 # write CDCLegendreTracking times
41 fobj = open('out/' + optlevel + '.out', 'w')
42 for i in range(0, len(CDCLegendreTracking)):
43 fobj.write(str(CDCLegendreTracking[i]) + '\n')
44 i = i + 1
45 fobj.close()
46
47
48optlevel = ['gcc-O0', 'gcc-O3', 'gcc-O3-native']
49for i in optlevel:
50 read(i)