1 | #!/usr/bin/awk -f |
---|
2 | # IGCM_add_out - filter of output of the job : |
---|
3 | # command : |
---|
4 | # IGCM_add_out.awk job_output.out REALTIME USERTIME SYSTIME |
---|
5 | |
---|
6 | #************************************************************** |
---|
7 | # Author: Martial.Mancip |
---|
8 | # Contact: Martial.Mancip@ipsl.jussieu.fr |
---|
9 | # $Date$ |
---|
10 | # $Author$ |
---|
11 | # $Revision$ |
---|
12 | # IPSL (2006) |
---|
13 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
14 | # History: |
---|
15 | # Modification: |
---|
16 | # |
---|
17 | #************************************************************** |
---|
18 | |
---|
19 | #========================== |
---|
20 | function myprint(str) { |
---|
21 | if (debug) { |
---|
22 | print str |
---|
23 | } |
---|
24 | } |
---|
25 | |
---|
26 | |
---|
27 | #========================== |
---|
28 | BEGIN { |
---|
29 | # print "traitement de " ARGV[1] |
---|
30 | |
---|
31 | nbarg=ARGC |
---|
32 | if (match(ARGV[1],"-d")) { |
---|
33 | debug=1 |
---|
34 | file=ARGV[2] |
---|
35 | delete ARGV[1] |
---|
36 | nbarg-- |
---|
37 | } else { |
---|
38 | debug=0 |
---|
39 | file=ARGV[1] |
---|
40 | } |
---|
41 | |
---|
42 | # When exit statement, 'END' rule is always executed, so defined a exit_value to manage this |
---|
43 | exit_value=0 |
---|
44 | if (nbarg != 2) { |
---|
45 | print "Usage: IGCM_add_out.awk [-d] file.output" |
---|
46 | print |
---|
47 | print "Args:" |
---|
48 | print " file.output = output file of at Job to be parsed" |
---|
49 | print |
---|
50 | print "Options:" |
---|
51 | print " -d = debug mode" |
---|
52 | print |
---|
53 | exit_value=1 |
---|
54 | exit |
---|
55 | } |
---|
56 | |
---|
57 | Information_found=0 |
---|
58 | |
---|
59 | RealTime=0. |
---|
60 | UserTime=-1. |
---|
61 | SysTime=0. |
---|
62 | VectorTime=0. |
---|
63 | InstCount=0. |
---|
64 | VInstCount=0. |
---|
65 | VElementCount=0. |
---|
66 | FLOPCount=0. |
---|
67 | MOPS=0. |
---|
68 | MFLOPS=0. |
---|
69 | AVLength=0. |
---|
70 | VOpRatio=0. |
---|
71 | MemorySize=0. |
---|
72 | MIPS=0. |
---|
73 | ICache=0. |
---|
74 | OCache=0. |
---|
75 | Bank=0. |
---|
76 | |
---|
77 | counter=0 |
---|
78 | # StartTime=[] |
---|
79 | # EndTime=[] |
---|
80 | Date_found=0 |
---|
81 | |
---|
82 | |
---|
83 | # print ENVIRON["LC_ALL"] |
---|
84 | # ENVIRON["LC_ALL"]="fr_FR" |
---|
85 | # print ENVIRON["LC_ALL"] |
---|
86 | } |
---|
87 | |
---|
88 | #========================== |
---|
89 | { |
---|
90 | myprint($0) |
---|
91 | |
---|
92 | # Get information with MPI Program Information output on NEC |
---|
93 | if (match($0, " \\*\\*\\*\\*\\*\\* Program Information \\*\\*\\*\\*\\*\\*")) |
---|
94 | { |
---|
95 | Information_found=1 |
---|
96 | counter=counter+1 |
---|
97 | # print $0 |
---|
98 | # print counter |
---|
99 | next |
---|
100 | } |
---|
101 | else if (Information_found == 1 && (match($0, ".*:.*"))) |
---|
102 | { |
---|
103 | where=(match($0,"[a-zA-Z]")) |
---|
104 | Length=(match($0, " *:"))-where |
---|
105 | whereDot=(match($0, ":")) |
---|
106 | info=substr($0,where,Length) |
---|
107 | whereNum=(match($0, "[0-9]")) |
---|
108 | Res=substr($0,whereNum) |
---|
109 | # print where "," Length "," whereDot "," whereNum " '" info "' :" Res |
---|
110 | |
---|
111 | if( info=="Real Time (sec)" ) { |
---|
112 | # print "|" Res "|" |
---|
113 | # printf("RealTime = %10.5f\n",0.037600) |
---|
114 | # printf("RealTime = %10.5f\n",Res) |
---|
115 | if ( Res > RealTime ) { |
---|
116 | RealTime=Res |
---|
117 | } |
---|
118 | next |
---|
119 | } |
---|
120 | |
---|
121 | if( info=="User Time (sec)" ) { |
---|
122 | UserTime=UserTime+Res |
---|
123 | next |
---|
124 | } |
---|
125 | |
---|
126 | if( info=="Sys Time (sec)" ) { |
---|
127 | SysTime=SysTime+Res |
---|
128 | next |
---|
129 | } |
---|
130 | |
---|
131 | if( info=="Vector Time (sec)" ) { |
---|
132 | VectorTime=VectorTime+Res |
---|
133 | next |
---|
134 | } |
---|
135 | |
---|
136 | if( info=="Inst. Count" ) { |
---|
137 | InstCount=InstCount+Res |
---|
138 | next |
---|
139 | } |
---|
140 | |
---|
141 | if( info=="V. Element Count" ) { |
---|
142 | VInstCount=VInstCount+Res |
---|
143 | next |
---|
144 | } |
---|
145 | |
---|
146 | if( info=="V. Element Count" ) { |
---|
147 | VElementCount=VElementCount+Res |
---|
148 | next |
---|
149 | } |
---|
150 | |
---|
151 | if( info=="FLOP Count" ) { |
---|
152 | FLOPCount=FLOPCount+Res |
---|
153 | next |
---|
154 | } |
---|
155 | |
---|
156 | if( info=="MOPS" ) { |
---|
157 | MOPS=MOPS+Res |
---|
158 | next |
---|
159 | } |
---|
160 | |
---|
161 | if( info=="MFLOPS" ) { |
---|
162 | MFLOPS=MFLOPS+Res |
---|
163 | next |
---|
164 | } |
---|
165 | |
---|
166 | if( info=="A.V. Length" ) { |
---|
167 | AVLength=AVLength+Res |
---|
168 | next |
---|
169 | } |
---|
170 | |
---|
171 | if( info=="V. Op. Ratio (%)" ) { |
---|
172 | VOpRatio=VOpRatio+Res |
---|
173 | next |
---|
174 | } |
---|
175 | |
---|
176 | if( info=="Memory Size (MB)" ) { |
---|
177 | MemorySize=MemorySize+Res |
---|
178 | next |
---|
179 | } |
---|
180 | |
---|
181 | if( info=="MIPS" ) { |
---|
182 | MIPS=MIPS+Res |
---|
183 | next |
---|
184 | } |
---|
185 | |
---|
186 | if( info=="I-Cache (sec)" ) { |
---|
187 | ICache=ICache+Res |
---|
188 | next |
---|
189 | } |
---|
190 | |
---|
191 | if( info=="O-Cache (sec)" ) { |
---|
192 | OCache=OCache+Res |
---|
193 | next |
---|
194 | } |
---|
195 | |
---|
196 | if( info=="Bank (sec)" ) { |
---|
197 | Bank=Bank+Res |
---|
198 | next |
---|
199 | } |
---|
200 | |
---|
201 | if( info=="Start Time (date)" ) { |
---|
202 | StartTime[counter]=Res |
---|
203 | next |
---|
204 | } |
---|
205 | |
---|
206 | if( info=="End Time (date)" ) { |
---|
207 | EndTime[counter]=Res |
---|
208 | Information_found=0 |
---|
209 | next |
---|
210 | } |
---|
211 | |
---|
212 | } |
---|
213 | # Get information with time output on other hosts |
---|
214 | # ksh time |
---|
215 | else if (match($0, ".*s real .*s user .*s system")) |
---|
216 | { |
---|
217 | myprint( "ksh" ) |
---|
218 | counter=counter+1 |
---|
219 | |
---|
220 | RealTime=(substr($1,1,match($1, "s")-1)) |
---|
221 | UserTime=(substr($3,1,match($3, "s")-1)) |
---|
222 | SysTime=(substr($5,1,match($5, "s")-1)) |
---|
223 | |
---|
224 | } |
---|
225 | # csh time |
---|
226 | else if (match($0, "[0-9.]+u [0-9.]+s .+")) |
---|
227 | { |
---|
228 | myprint( "csh" ) |
---|
229 | counter=counter+1 |
---|
230 | |
---|
231 | UserTime=(substr($1,1,match($1, "u")-1)) |
---|
232 | SysTime=(substr($2,1,match($2, "s")-1)) |
---|
233 | RealTime=(substr($3,1,match($3, ":")-1)*60. + substr($3,match($3, ":")+1)) |
---|
234 | |
---|
235 | } |
---|
236 | # linux system time |
---|
237 | else if (match($0, ".*user .*system .*elapsed .*CPU .*")) |
---|
238 | { |
---|
239 | myprint( "linux" ) |
---|
240 | counter=counter+1 |
---|
241 | |
---|
242 | UserTime=(substr($1,1,match($1, "user")-1)) |
---|
243 | SysTime=(substr($2,1,match($2, "system")-1)) |
---|
244 | RealTime=(substr($3,1,match($3, ":")-1)*60.+substr($3, match($3, ":")+1, match($3, "elapsed"))) |
---|
245 | |
---|
246 | } |
---|
247 | # date end |
---|
248 | # date begin |
---|
249 | else if (Date_found == 0 && (match($0, "[a-z]+ *[a-z]+ *[0-9]+ *[0-9][0-9]:[0-9][0-9]:[0-9][0-9] *CET *[0-9]+"))) |
---|
250 | { |
---|
251 | myprint( "start date" ) |
---|
252 | |
---|
253 | Date_found=1 |
---|
254 | StartTime[counter]=$0 |
---|
255 | |
---|
256 | } |
---|
257 | else if (Date_found == 1 && (match($0, "[a-z]+ *[a-z]+ *[0-9]+ *[0-9][0-9]:[0-9][0-9]:[0-9][0-9] *CET *[0-9]+"))) |
---|
258 | { |
---|
259 | myprint( "end date" ) |
---|
260 | |
---|
261 | EndTime[counter]=$0 |
---|
262 | |
---|
263 | exit |
---|
264 | |
---|
265 | } |
---|
266 | |
---|
267 | } |
---|
268 | |
---|
269 | #========================== |
---|
270 | END { |
---|
271 | |
---|
272 | if (! exit_value ) { |
---|
273 | if (counter > 0) { |
---|
274 | myprint("=============================================") |
---|
275 | myprint("Additionnal results on Program Informations for " ARGV[1]) |
---|
276 | myprint("Real Time (sec) :" RealTime) |
---|
277 | myprint("User Time (sec) :" UserTime) |
---|
278 | myprint("Sys Time (sec) :" SysTime) |
---|
279 | myprint("Vector Time (sec) :" VectorTime) |
---|
280 | myprint("Inst. Count :" InstCount) |
---|
281 | myprint("V. Inst. Count :" VInstCount) |
---|
282 | myprint("V. Element Count :" VElementCount) |
---|
283 | myprint("FLOP Count :" FLOPCount) |
---|
284 | myprint("MOPS :" MOPS) |
---|
285 | myprint("MFLOPS :" MFLOPS) |
---|
286 | myprint("A.V. Length :" AVLength) |
---|
287 | myprint("V. Op. Ratio (%) :" VOpRatio) |
---|
288 | myprint("Memory Size (MB) :" MemorySize) |
---|
289 | myprint("MIPS :" MIPS) |
---|
290 | myprint("I-Cache (sec) :" ICache) |
---|
291 | myprint("O-Cache (sec) :" OCache) |
---|
292 | myprint("Bank (sec) :" Bank) |
---|
293 | |
---|
294 | myprint("Date of executables :") |
---|
295 | for (i=1; i<=counter; i++) { |
---|
296 | myprint("Start Time (date) :" StartTime[i]) |
---|
297 | myprint("End Time (date) :" EndTime[i]) |
---|
298 | } |
---|
299 | printf("%s , %s , %.5f , %.5f , %.5f", StartTime[counter], EndTime[counter], RealTime, UserTime, SysTime) |
---|
300 | exit(0) |
---|
301 | } |
---|
302 | else |
---|
303 | { |
---|
304 | exit(1) |
---|
305 | } |
---|
306 | } |
---|
307 | else |
---|
308 | { |
---|
309 | exit(2) |
---|
310 | } |
---|
311 | |
---|
312 | } |
---|