source: trunk/libIGCM/libIGCM_sys/IGCM_add_out.awk @ 163

Last change on this file since 163 was 163, checked in by mafoipsl, 15 years ago

First line is not required for awk script and produces an error on NEC

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Date Author Revision
File size: 7.9 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@ipsl.jussieu.fr
8# $Date$
9# $Author$
10# $Revision$
11# IPSL (2006)
12#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
13# History:
14# Modification: Patrick.Brockmann@cea.fr
15#
16#**************************************************************
17
18#==========================
19function myprint(str) {
20  if (debug) {
21     print str
22  }
23}
24
25
26#==========================
27BEGIN {
28#  print "traitement de " ARGV[1]
29
30  nbarg=ARGC
31  if (match(ARGV[1],"-d")) {
32    debug=1
33    file=ARGV[2]
34    delete ARGV[1] 
35    nbarg--
36  } else {
37    debug=0
38    file=ARGV[1]
39  }
40
41# When exit statement, 'END' rule is always executed, so defined a exit_value to manage this
42  exit_value=0
43  if (nbarg != 2) {
44    print "Usage: IGCM_add_out.awk [-d] file.output" 
45    print 
46    print "Args:"
47    print "      file.output = output file of at Job to be parsed" 
48    print 
49    print "Options:" 
50    print "       -d = debug mode" 
51    print 
52    exit_value=1
53    exit
54  }
55
56  Information_found=0
57  Information_ksh_SX_found=0
58  vargas_found=0
59
60  RealTime=0.
61  UserTime=-1.
62  SysTime=0.
63  VectorTime=0.
64  InstCount=0.
65  VInstCount=0.
66  VElementCount=0.
67  FLOPCount=0.
68  MOPS=0.
69  MFLOPS=0.
70  AVLength=0.
71  VOpRatio=0.
72  MemorySize=0.
73  MIPS=0.
74  ICache=0.
75  OCache=0.
76  Bank=0.
77
78  counter=0
79
80  RunDateBegin="2000-01-01T00:00:00"
81  RunDateEnd="2000-01-01T00:00:00"
82
83}
84
85#==========================
86{
87  myprint($0) 
88
89# Get information with MPI Program Information output on NEC
90  if (match($0, "     \\*\\*\\*\\*\\*\\*  Program Information  \\*\\*\\*\\*\\*\\*")) 
91  {
92    Information_found=1
93    counter=counter+1
94#   print $0     
95#    print counter
96    next
97  }
98  else if (Information_found == 1 && (match($0, ".*:.*"))) 
99  {
100    where=(match($0,"[a-zA-Z]"))
101    Length=(match($0, " *:"))-where
102    whereDot=(match($0, ":"))
103    info=substr($0,where,Length)
104    whereNum=(match($0, "[0-9]"))
105    Res=substr($0,whereNum)
106#    print where "," Length "," whereDot "," whereNum " '" info "' :" Res
107
108    if( info=="Real Time (sec)" ) {
109#      print "|" Res "|"
110#      printf("RealTime = %10.5f\n",0.037600)
111#      printf("RealTime = %10.5f\n",Res)
112      if ( Res > RealTime ) {
113        RealTime=Res
114      }
115      next
116    }
117         
118    if( info=="User Time (sec)" ) {
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  else if (match($0, "[0-9.]+u [0-9.]+s .+"))
214  {
215    myprint( "csh" )
216    counter=counter+1
217
218    UserTime=(substr($1,1,match($1, "u")-1))
219    SysTime=(substr($2,1,match($2, "s")-1))
220    RealTime=(substr($3,1,match($3, ":")-1)*60. + substr($3,match($3, ":")+1))
221
222  }
223# linux system time
224  else if (match($0, ".*user .*system .*elapsed .*CPU .*"))
225  {
226    myprint( "linux" )
227    counter=counter+1
228
229    UserTime=(substr($1,1,match($1, "user")-1))
230    SysTime=(substr($2,1,match($2, "system")-1))
231    RealTime=(substr($3,1,match($3, ":")-1)*60.+substr($3, match($3, ":")+1, match($3, "elapsed")))
232
233  }
234# AIX vargas system time
235  else if (match($0, "real   [0-9]*"))
236  {
237    myprint( "vargas" )
238    vargas_found=1 
239    counter=counter+1
240
241    RealTime=substr($0,8)
242    next
243  }
244  else if (vargas_found=1 )
245  {
246    if (match($0, "user   [0-9]*"))
247      {
248        UserTime=substr($0,8)
249        next
250      }
251    if (match($0, "sys    [0-9]*"))
252      {
253        SysTime=substr($0,7)
254        next
255      }
256  }
257# Get information with time output on SX hosts
258# ksh time
259  else if (match($0, "real *[0-9:.]*"))
260  {
261    myprint("ksh SX")
262    Information_ksh_SX_found=1
263    counter=counter+1
264
265    RealTime=0
266    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
267    {
268        sub1=(match($2, ":")-1)
269        sub2=sub1+2
270        fin=(substr($2,sub2))
271        sub3=(match(fin, ":")-1)+sub2
272        RealTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
273    }
274    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
275    {
276        RealTime=(substr($2,1,match($2, ":")-1))
277    }
278  }
279  else if (Information_ksh_SX_found == 1 && match($0, "user *[0-9:.]*"))
280  {
281    myprint("ksh SX ")
282
283    UserTime=0
284    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
285    {
286        sub1=(match($2, ":")-1)
287        sub2=sub1+2
288        fin=(substr($2,sub2))
289        sub3=(match(fin, ":")-1)+sub2
290        UserTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
291    }
292    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
293    {
294        UserTime=(substr($2,1,match($2, ":")-1))
295    }
296  }
297  else if (Information_ksh_SX_found == 1 && match($0, "sys *[0-9:.]*"))
298  {
299    myprint("ksh SX ")
300
301    SysTime=0
302    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
303    {
304        sub1=(match($2, ":")-1)
305        sub2=sub1+2
306        fin=(substr($2,sub2))
307        sub3=(match(fin, ":")-1)+sub2
308        SysTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
309    }
310    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
311    {
312        SysTime=(substr($2,1,match($2, ":")-1))
313    }
314  }
315
316# RUN_DATE_BEGIN
317if ($0 ~ /RunDateBegin.*=/) {
318    myprint( "start date" )
319    split($0,a,"=")
320    RunDateBegin=a[2]
321}
322
323# RUN_DATE_END
324if ($0 ~ /RunDateEnd.*=/) {
325    myprint( "end date" )
326    split($0,a,"=")
327    RunDateEnd=a[2]
328  }
329
330}
331
332#==========================
333END {
334
335    myprint("exit_value : " exit_value)
336    myprint("counter    : " counter)
337
338  if (! exit_value ) {
339    if (counter > 0) { 
340      myprint("=============================================")
341      myprint("Additionnal results on Program Informations for " ARGV[1])
342      myprint("Real Time (sec)        :" RealTime)
343      myprint("User Time (sec)        :" UserTime)
344      myprint("Sys  Time (sec)        :" SysTime)
345      myprint("Vector Time (sec)      :" VectorTime)
346      myprint("Inst. Count            :" InstCount)
347      myprint("V. Inst. Count         :" VInstCount)
348      myprint("V. Element Count       :" VElementCount)
349      myprint("FLOP Count             :" FLOPCount)
350      myprint("MOPS                   :" MOPS)
351      myprint("MFLOPS                 :" MFLOPS)
352      myprint("A.V. Length            :" AVLength)
353      myprint("V. Op. Ratio (%)       :" VOpRatio)
354      myprint("Memory Size (MB)       :" MemorySize)
355      myprint("MIPS                   :" MIPS)
356      myprint("I-Cache (sec)          :" ICache)
357      myprint("O-Cache (sec)          :" OCache)
358      myprint("Bank (sec)             :" Bank)
359
360      myprint("Date of executables :")
361      myprint("Start Time             :" RunDateBegin)
362      myprint("End   Time             :" RunDateEnd)
363
364      printf("%s %s %.5f %.5f %.5f", RunDateBegin, RunDateEnd, RealTime, UserTime, SysTime) 
365      exit(0)
366    }
367    else
368    { 
369      exit(1)
370    }
371  }
372  else
373  { 
374    exit(2)
375  }
376 
377}
Note: See TracBrowser for help on using the repository browser.