postprocess_base.py (d13e9b485390d2a242cbc549de647bb7b44f1cad) postprocess_base.py (dd839fb73dfd4a3191bf7b0eef12fe704a18a864)
1#!/usr/bin/env python3
2# Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
3# Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
4# All Rights reserved. See files LICENSE and NOTICE for details.
5#
6# This file is part of CEED, a collection of benchmarks, miniapps, software
7# libraries and APIs for efficient high-order finite element and spectral
8# element discretizations for exascale applications. For more information and

--- 12 unchanged lines hidden (view full) ---

21
22##### Read all input files specified on the command line, or stdin and parse
23##### the content, storing it as a pandas dataframe
24def read_logs(files=None):
25 it=fileinput.input(files)
26 state = 0
27 line=''
28 i=0
1#!/usr/bin/env python3
2# Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
3# Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
4# All Rights reserved. See files LICENSE and NOTICE for details.
5#
6# This file is part of CEED, a collection of benchmarks, miniapps, software
7# libraries and APIs for efficient high-order finite element and spectral
8# element discretizations for exascale applications. For more information and

--- 12 unchanged lines hidden (view full) ---

21
22##### Read all input files specified on the command line, or stdin and parse
23##### the content, storing it as a pandas dataframe
24def read_logs(files=None):
25 it=fileinput.input(files)
26 state = 0
27 line=''
28 i=0
29 mesh_p=0
30 config='unknown'
31 backend='unknown'
32 test='unknown'
33 num_procs=0
34 num_procs_node=0
35 lnfmt='%05i'
36 data={}
29 data = dict(
30 file='unknown',
31 backend='unknown',
32 test='unknown',
33 num_procs=0,
34 num_procs_node=0,
35 degree=0,
36 quadrature_pts=0,
37 code='libCEED',
38 )
39
37 runs=[]
38 while True:
39 ##
40 if state%2==0:
41 ##
42 try:
43 line=next(it)
44 i=i+1
45 except StopIteration:
46 break
47 state=state+1
48 ##
49 elif state==1:
50 ##
51 state=0
40 runs=[]
41 while True:
42 ##
43 if state%2==0:
44 ##
45 try:
46 line=next(it)
47 i=i+1
48 except StopIteration:
49 break
50 state=state+1
51 ##
52 elif state==1:
53 ##
54 state=0
52 if 'Reading configuration' in line:
53 ##
54 ## This is the beginning of a new file.
55 ##
56 config=line.split()[2]
57 num_procs=0
58 num_procs_node=0
59 ## Number of MPI tasks
60 elif 'Running the tests using a total of' in line:
61 num_procs=int(line.split('a total of ',1)[1].split(None,1)[0])
55 ## Legacy header contains number of MPI tasks
56 if 'Running the tests using a total of' in line:
57 data['num_procs'] = int(line.split('a total of ',1)[1].split(None,1)[0])
62 ## MPI tasks per node
63 elif 'tasks per node' in line:
58 ## MPI tasks per node
59 elif 'tasks per node' in line:
64 num_procs_node=int(line.split(' tasks per',1)[0].rsplit(None,1)[1])
65 elif line == 'Running test:\n':
66 ##
67 ## This is the beginning of a new run.
68 ##
69
70 ## Add last row
71 if 'cg_iteration_dps' in data:
72 runs.append(data)
73 ## New row
74 data={}
75 data['file']=fileinput.filename()
76 data['config']=config
77 data['backend']=backend
78 data['test']=test
79 data['num_procs']=num_procs
80 data['num_procs_node']=num_procs_node
81 data['degree']=mesh_p
82 data['quadrature_pts']=mesh_p
83 data['code']="libCEED"
84 test_=test.rsplit('/',1)[-1]
85 data['case']='scalar'
86 ## Benchmark Problem
60 data['num_procs_node'] = int(line.split(' tasks per',1)[0].rsplit(None,1)[1])
61 ## New Benchmark Problem
87 elif "CEED Benchmark Problem" in line:
62 elif "CEED Benchmark Problem" in line:
63 # Starting a new block
64 data = data.copy()
65 runs.append(data)
66 data['file'] = fileinput.filename()
88 data['test'] = line.split()[-2] + " " + line.split('-- ')[1]
89 data['case']='scalar' if (('Problem 1' in line) or ('Problem 3' in line)
90 or ('Problem 5' in line)) else 'vector'
67 data['test'] = line.split()[-2] + " " + line.split('-- ')[1]
68 data['case']='scalar' if (('Problem 1' in line) or ('Problem 3' in line)
69 or ('Problem 5' in line)) else 'vector'
70 elif "Hostname" in line:
71 data['hostname'] = line.split(':')[1].strip()
72 elif "Total ranks" in line:
73 data['num_procs'] = int(line.split(':')[1].strip())
74 elif "Ranks per node" in line:
75 data['num_procs_node'] = int(line.split(':')[1].strip())
91 ## Backend
92 elif 'libCEED Backend MemType' in line:
93 data['backend_memtype']=line.split(':')[1].strip()
94 elif 'libCEED Backend' in line:
95 data['backend']=line.split(':')[1].strip()
96 ## P
97 elif 'Basis Nodes' in line:
98 data['degree']=int(line.split(':')[1]) - 1

--- 14 unchanged lines hidden (view full) ---

113 data['ksp_its'] = int(line.split(':')[1].split()[0])
114 elif 'CG Solve Time' in line:
115 data['time_per_it'] = float(line.split(':')[1].split()[0]) / data['ksp_its']
116 ## CG DOFs/Sec
117 elif 'DoFs/Sec in CG' in line:
118 data['cg_iteration_dps']=1e6*float(line.split(':')[1].split()[0])
119 ## End of output
120
76 ## Backend
77 elif 'libCEED Backend MemType' in line:
78 data['backend_memtype']=line.split(':')[1].strip()
79 elif 'libCEED Backend' in line:
80 data['backend']=line.split(':')[1].strip()
81 ## P
82 elif 'Basis Nodes' in line:
83 data['degree']=int(line.split(':')[1]) - 1

--- 14 unchanged lines hidden (view full) ---

98 data['ksp_its'] = int(line.split(':')[1].split()[0])
99 elif 'CG Solve Time' in line:
100 data['time_per_it'] = float(line.split(':')[1].split()[0]) / data['ksp_its']
101 ## CG DOFs/Sec
102 elif 'DoFs/Sec in CG' in line:
103 data['cg_iteration_dps']=1e6*float(line.split(':')[1].split()[0])
104 ## End of output
105
121 ## Add last row
122 if 'cg_iteration_dps' in data:
123 runs.append(data)
124
125 return pd.DataFrame(runs)
126
127if __name__ == "__main__":
128 runs = read_logs()
129 print('Number of test runs read: %i'%len(runs))
106 return pd.DataFrame(runs)
107
108if __name__ == "__main__":
109 runs = read_logs()
110 print('Number of test runs read: %i'%len(runs))
111 print(runs)