source: CONFIG_DEVT/IPSLCM6.2.2_ENSEMBLES/libIGCM/libIGCM_sys/IGCM_add_out.awk @ 6207

Last change on this file since 6207 was 6204, checked in by aclsce, 2 years ago

First import of IPSLCM6.2.2_work_ENSEMBLES working configuration

  • Property svn:executable set to *
File size: 10.6 KB
Line 
1# IGCM_add_out - filter of output of the job :
2# command :
3# IGCM_add_out.awk job_output.out REALTIME USERTIME SYSTIME
4
5#**************************************************************
6# Author: Martial.Mancip
7# Contact: Martial.Mancip__at__ipsl.jussieu.fr
8# $Revision:: 671                                      $ Revision of last commit
9# $Author:: mafoipsl                                   $ Author of last commit
10# $Date:: 2012-05-21 08:24:42 +0200 (Mon, 21 May 2012) $ Date of last commit
11# IPSL (2006)
12#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
13# Modification: Patrick.Brockmann@cea.fr
14#
15#**************************************************************
16
17#==========================
18function myprint(str) {
19  if (debug) {
20     print str
21  }
22}
23
24
25#==========================
26BEGIN {
27#  print "traitement de " ARGV[1]
28
29  nbarg=ARGC
30  if (ARGV[1] == "-d") {
31    debug=1
32    file=ARGV[2]
33    delete ARGV[1] 
34    nbarg--
35  } else {
36    debug=0
37    file=ARGV[1]
38  }
39
40# When exit statement, 'END' rule is always executed, so defined a exit_value to manage this
41  exit_value=0
42  if (nbarg != 2) {
43    print "Usage: IGCM_add_out.awk [-d] file.output" 
44    print 
45    print "Args:"
46    print "      file.output = output file of at Job to be parsed" 
47    print 
48    print "Options:" 
49    print "       -d = debug mode" 
50    print 
51    exit_value=1
52    exit
53  }
54
55  Information_found=0
56  Information_ksh_SX_found=0
57
58  RealTime=0.
59  UserTime=-1.
60  SysTime=0.
61  VectorTime=0.
62  InstCount=0.
63  VInstCount=0.
64  VElementCount=0.
65  FLOPCount=0.
66  MOPS=0.
67  MFLOPS=0.
68  AVLength=0.
69  VOpRatio=0.
70  MemorySize=0.
71  MIPS=0.
72  ICache=0.
73  OCache=0.
74  Bank=0.
75
76  counter=0
77
78  RunDateBegin="2000-01-01T00:00:00"
79  RunDateEnd="2000-01-01T00:00:00"
80
81}
82
83#==========================
84{
85  myprint($0) 
86
87# Get information with MPI Program Information output on NEC
88  if (match($0, "     \\*\\*\\*\\*\\*\\*  Program Information  \\*\\*\\*\\*\\*\\*")) 
89  {
90    Information_found=1
91    counter=counter+1
92#   print $0     
93#    print counter
94    next
95  }
96  else if (Information_found == 1 && (match($0, ".*:.*"))) 
97  {
98    where=(match($0,"[a-zA-Z]"))
99    Length=(match($0, " *:"))-where
100    whereDot=(match($0, ":"))
101    info=substr($0,where,Length)
102    whereNum=(match($0, "[0-9]"))
103    Res=substr($0,whereNum)
104#    print where "," Length "," whereDot "," whereNum " '" info "' :" Res
105
106    if( info=="Real Time (sec)" ) {
107#      print "|" Res "|"
108#      printf("RealTime = %10.5f\n",0.037600)
109#      printf("RealTime = %10.5f\n",Res)
110      if ( Res > RealTime ) {
111        myprint( "NEC Real Time updated" )
112            RealTime=Res
113      }
114      next
115    }
116         
117    if( info=="User Time (sec)" ) {
118      myprint( "NEC User Time " )
119      UserTime=UserTime+Res
120      next
121    }
122
123    if( info=="Sys  Time (sec)" ) {
124      SysTime=SysTime+Res
125      next
126    }
127
128    if( info=="Vector Time (sec)" ) {
129      VectorTime=VectorTime+Res
130      next 
131    }
132
133    if( info=="Inst. Count" ) {
134      InstCount=InstCount+Res
135      next
136    }
137
138    if( info=="V. Element Count" ) {
139      VInstCount=VInstCount+Res
140      next 
141    }
142
143    if( info=="V. Element Count" ) {
144      VElementCount=VElementCount+Res
145      next
146    }
147
148    if( info=="FLOP Count" ) {
149      FLOPCount=FLOPCount+Res
150      next 
151    }
152
153    if( info=="MOPS" ) {
154      MOPS=MOPS+Res
155      next
156    }
157
158    if( info=="MFLOPS" ) {
159      MFLOPS=MFLOPS+Res
160      next 
161    }
162
163    if( info=="A.V. Length" ) {
164      AVLength=AVLength+Res
165      next
166    }
167
168    if( info=="V. Op. Ratio (%)" ) {
169      VOpRatio=VOpRatio+Res
170      next 
171    }
172
173    if( info=="Memory Size (MB)" ) {
174      MemorySize=MemorySize+Res
175      next
176    }
177
178    if( info=="MIPS" ) {
179      MIPS=MIPS+Res
180      next 
181    }
182
183    if( info=="I-Cache (sec)" ) {
184      ICache=ICache+Res
185      next
186    }
187
188    if( info=="O-Cache (sec)" ) {
189      OCache=OCache+Res
190      next 
191    }
192
193    if( info=="Bank (sec)" ) {
194      Bank=Bank+Res
195      next
196    }
197
198  }
199# Get information with time output on other hosts
200# ksh time
201  else if (match($0, ".*s real .*s user .*s system"))
202  {
203    myprint( "ksh" )
204    counter=counter+1
205
206    RealTime=(substr($1,1,match($1, "s")-1))
207    UserTime=(substr($3,1,match($3, "s")-1))
208    SysTime=(substr($5,1,match($5, "s")-1))
209
210  }
211
212# csh time
213# 0.000+u 0.000+s 0:00.00 0.0%      0+0k 0+0io 0pf+0w
214  else if (match($0, "[0-9.]+u [0-9.]+s .+"))
215  {
216    myprint( "csh" )
217    counter=counter+1
218
219    UserTime=(substr($1,1,match($1, "u")-1))
220    SysTime=(substr($2,1,match($2, "s")-1))
221    # si hours ?
222    RealTime=(substr($3,1,match($3, ":")-1)*60. + substr($3,match($3, ":")+1))
223
224  }
225# linux system time
226### example :
227### 2.02user 6.60system 12:41.62elapsed 1%CPU (0avgtext+0avgdata 25520maxresident)k
228### 1.31user 5.33system 2:47:39elapsed 0%CPU (0avgtext+0avgdata 30400maxresident)k
229  else if (match($0, ".*user .*system .*elapsed .*CPU .*"))
230  {
231    myprint( "linux" )
232    counter=counter+1
233
234    UserTime=(substr($1,1,match($1, "user")-1))
235    SysTime=(substr($2,1,match($2, "system")-1))
236    ### RealTime=(substr($3,1,match($3, ":")-1)*60.+substr($3, match($3, ":")+1, match($3, "elapsed"))) what for hours????
237
238    RealTime=0
239    if (match($3, "[0-9]*:[0-9]*:[0-9]*elapsed"))
240    {
241      #### $3=2:47:39elapsed
242      myprint( "linux elapsed in hours " )
243      sub1=(match($3, ":")-1)
244      sub2=sub1+2
245      min=(substr($3,sub2))
246      sub3=(match(min, ":")-1)
247      sub4=sub3+2
248      fin=(substr(min,sub4))
249      sub5=(match(fin, "elapsed")-1)
250      RealTime=((substr($3,1,sub1))*60+substr(min,1,sub3))*60+(substr(min,sub4,sub5))
251      myprint( " real time seconds " RealTime )
252    }
253    else if (match($3, "[0-9]*:[0-9]*\\.[0-9]*elapsed"))
254    {
255      #### $3=12:41.62elapsed
256      myprint( "linux elapsed in minutes " )
257      sub1=(match($3, ":")-1)
258      sub2=sub1+2
259      fin=(substr($3,sub2))
260      sub3=(match(fin, "elapsed")-1)
261      RealTime=(substr($3,1,sub1))*60+(substr($3,sub2,sub3))
262      myprint( " real time seconds " RealTime )
263    }
264    else if (match($3, "[0-9]*\\.[0-9]*elapsed"))
265    {
266      #### $3=41.62elapsed
267      myprint( "linux elapsed in second " )
268      RealTime=(substr($3,1,match($3, "elapsed")-1))
269      myprint( " real time seconds " RealTime )
270    }
271    next
272  }
273# curie system time (if not linux) or vargas
274### curie (with tab)
275### real    9m38.96s
276### user    0m4.45s
277### sys     0m6.41s
278### vargas (with space)
279### real   2891.80
280### user   0.28
281### sys    0.45
282
283  else if (match($1, "real"))
284  {
285    myprint( "curie ou vargas ?" )
286
287    # real    9m38.96s or real   2891.80
288    if (match($2, ".*s.*"))
289    {
290      myprint( "curie" )
291      counter=counter+1
292      ### real    9m38.96s
293      ### real  5h9m38.96s
294      RealTime=((substr($2,1,match($2, "h")-1)*60.)+substr($2,match($2, "h")+1,match($2, "m")-1))*60.+substr($2,match($2, "m")+1,match($2, "s"))
295      next
296    }
297    else
298    {
299      myprint( "vargas" )
300      counter=counter+1
301   
302      ### real 2891.80
303      RealTime=$2
304    next
305    }
306  }
307  else if (match($1, "user"))
308  {
309    # user(tab)0m4.45s or user   0.28
310    if (match($2, ".*s.*"))
311    {
312       myprint( "curie user" )
313       UserTime=((substr($2,1,match($2, "h")-1)*60.)+substr($2,match($2, "h")+1,match($2, "m")-1))*60.+substr($2,match($2, "m")+1,match($2, "s"))
314       next
315    }
316    else
317    {
318      myprint( "vargas user" )
319      UserTime=$2
320      next
321    }
322  }
323  else if (match($1, "sys"))
324  {
325    # 0m6.41s or 0.45
326    if (match($2, ".*s.*"))
327    {
328      myprint( "curie sys" )
329      SysTime=((substr($2,1,match($2, "h")-1)*60.)+substr($2,match($2, "h")+1,match($2, "m")-1))*60.+substr($2,match($2, "m")+1,match($2, "s"))
330      next
331    }
332    else
333    {
334      myprint( "vargas sys" )
335      SysTime=$2
336      next
337    }
338  }
339
340# Get information with time output on SX hosts
341# ksh time
342  else if (match($0, "real *[0-9:.]*"))
343  {
344    myprint("ksh SX")
345    Information_ksh_SX_found=1
346    counter=counter+1
347
348    RealTime=0
349    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
350    {
351        sub1=(match($2, ":")-1)
352        sub2=sub1+2
353        fin=(substr($2,sub2))
354        sub3=(match(fin, ":")-1)+sub2
355        RealTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
356    }
357    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
358    {
359        RealTime=(substr($2,1,match($2, ":")-1))
360    }
361  }
362  else if (Information_ksh_SX_found == 1 && match($0, "user *[0-9:.]*"))
363  {
364    myprint("ksh SX ")
365
366    UserTime=0
367    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
368    {
369        sub1=(match($2, ":")-1)
370        sub2=sub1+2
371        fin=(substr($2,sub2))
372        sub3=(match(fin, ":")-1)+sub2
373        UserTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
374    }
375    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
376    {
377        UserTime=(substr($2,1,match($2, ":")-1))
378    }
379  }
380  else if (Information_ksh_SX_found == 1 && match($0, "sys *[0-9:.]*"))
381  {
382    myprint("ksh SX ")
383
384    SysTime=0
385    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
386    {
387        sub1=(match($2, ":")-1)
388        sub2=sub1+2
389        fin=(substr($2,sub2))
390        sub3=(match(fin, ":")-1)+sub2
391        SysTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
392    }
393    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
394    {
395        SysTime=(substr($2,1,match($2, ":")-1))
396    }
397  }
398
399# RUN_DATE_BEGIN
400if ($0 ~ /RunDateBegin.*=/) {
401    myprint( "start date" )
402    split($0,a,"=")
403    RunDateBegin=a[2]
404}
405
406# RUN_DATE_END
407if ($0 ~ /RunDateEnd.*=/) {
408    myprint( "end date" )
409    split($0,a,"=")
410    RunDateEnd=a[2]
411  }
412
413}
414
415#==========================
416END {
417
418    myprint("exit_value : " exit_value)
419    myprint("counter    : " counter)
420
421  if (! exit_value ) {
422    if (counter > 0) { 
423      myprint("=============================================")
424      myprint("Additionnal results on Program Informations for " ARGV[1])
425      myprint("Real Time (sec)        :" RealTime)
426      myprint("User Time (sec)        :" UserTime)
427      myprint("Sys  Time (sec)        :" SysTime)
428      myprint("Vector Time (sec)      :" VectorTime)
429      myprint("Inst. Count            :" InstCount)
430      myprint("V. Inst. Count         :" VInstCount)
431      myprint("V. Element Count       :" VElementCount)
432      myprint("FLOP Count             :" FLOPCount)
433      myprint("MOPS                   :" MOPS)
434      myprint("MFLOPS                 :" MFLOPS)
435      myprint("A.V. Length            :" AVLength)
436      myprint("V. Op. Ratio (%)       :" VOpRatio)
437      myprint("Memory Size (MB)       :" MemorySize)
438      myprint("MIPS                   :" MIPS)
439      myprint("I-Cache (sec)          :" ICache)
440      myprint("O-Cache (sec)          :" OCache)
441      myprint("Bank (sec)             :" Bank)
442
443      myprint("Date of executables :")
444      myprint("Start Time             :" RunDateBegin)
445      myprint("End   Time             :" RunDateEnd)
446
447      printf("%s %s %.5f %.5f %.5f", RunDateBegin, RunDateEnd, RealTime, UserTime, SysTime) 
448      exit(0)
449    }
450    else
451    { 
452      exit(1)
453    }
454  }
455  else
456  { 
457    exit(2)
458  }
459 
460}
Note: See TracBrowser for help on using the repository browser.