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

Last change on this file since 161 was 161, checked in by sdipsl, 15 years ago
  • Move the "ksh time" detection on SX hosts because it generates a false positive with vargas detection
  • 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#!/usr/bin/gawk -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: Patrick.Brockmann@cea.fr
16#
17#**************************************************************
18
19#==========================
20function myprint(str) {
21  if (debug) {
22     print str
23  }
24}
25
26
27#==========================
28BEGIN {
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  Information_ksh_SX_found=0
59  vargas_found=0
60
61  RealTime=0.
62  UserTime=-1.
63  SysTime=0.
64  VectorTime=0.
65  InstCount=0.
66  VInstCount=0.
67  VElementCount=0.
68  FLOPCount=0.
69  MOPS=0.
70  MFLOPS=0.
71  AVLength=0.
72  VOpRatio=0.
73  MemorySize=0.
74  MIPS=0.
75  ICache=0.
76  OCache=0.
77  Bank=0.
78
79  counter=0
80
81  RunDateBegin="2000-01-01T00:00:00"
82  RunDateEnd="2000-01-01T00:00:00"
83
84}
85
86#==========================
87{
88  myprint($0) 
89
90# Get information with MPI Program Information output on NEC
91  if (match($0, "     \\*\\*\\*\\*\\*\\*  Program Information  \\*\\*\\*\\*\\*\\*")) 
92  {
93    Information_found=1
94    counter=counter+1
95#   print $0     
96#    print counter
97    next
98  }
99  else if (Information_found == 1 && (match($0, ".*:.*"))) 
100  {
101    where=(match($0,"[a-zA-Z]"))
102    Length=(match($0, " *:"))-where
103    whereDot=(match($0, ":"))
104    info=substr($0,where,Length)
105    whereNum=(match($0, "[0-9]"))
106    Res=substr($0,whereNum)
107#    print where "," Length "," whereDot "," whereNum " '" info "' :" Res
108
109    if( info=="Real Time (sec)" ) {
110#      print "|" Res "|"
111#      printf("RealTime = %10.5f\n",0.037600)
112#      printf("RealTime = %10.5f\n",Res)
113      if ( Res > RealTime ) {
114        RealTime=Res
115      }
116      next
117    }
118         
119    if( info=="User Time (sec)" ) {
120      UserTime=UserTime+Res
121      next
122    }
123
124    if( info=="Sys  Time (sec)" ) {
125      SysTime=SysTime+Res
126      next
127    }
128
129    if( info=="Vector Time (sec)" ) {
130      VectorTime=VectorTime+Res
131      next 
132    }
133
134    if( info=="Inst. Count" ) {
135      InstCount=InstCount+Res
136      next
137    }
138
139    if( info=="V. Element Count" ) {
140      VInstCount=VInstCount+Res
141      next 
142    }
143
144    if( info=="V. Element Count" ) {
145      VElementCount=VElementCount+Res
146      next
147    }
148
149    if( info=="FLOP Count" ) {
150      FLOPCount=FLOPCount+Res
151      next 
152    }
153
154    if( info=="MOPS" ) {
155      MOPS=MOPS+Res
156      next
157    }
158
159    if( info=="MFLOPS" ) {
160      MFLOPS=MFLOPS+Res
161      next 
162    }
163
164    if( info=="A.V. Length" ) {
165      AVLength=AVLength+Res
166      next
167    }
168
169    if( info=="V. Op. Ratio (%)" ) {
170      VOpRatio=VOpRatio+Res
171      next 
172    }
173
174    if( info=="Memory Size (MB)" ) {
175      MemorySize=MemorySize+Res
176      next
177    }
178
179    if( info=="MIPS" ) {
180      MIPS=MIPS+Res
181      next 
182    }
183
184    if( info=="I-Cache (sec)" ) {
185      ICache=ICache+Res
186      next
187    }
188
189    if( info=="O-Cache (sec)" ) {
190      OCache=OCache+Res
191      next 
192    }
193
194    if( info=="Bank (sec)" ) {
195      Bank=Bank+Res
196      next
197    }
198
199  }
200# Get information with time output on other hosts
201# ksh time
202  else if (match($0, ".*s real .*s user .*s system"))
203  {
204    myprint( "ksh" )
205    counter=counter+1
206
207    RealTime=(substr($1,1,match($1, "s")-1))
208    UserTime=(substr($3,1,match($3, "s")-1))
209    SysTime=(substr($5,1,match($5, "s")-1))
210
211  }
212
213# csh time
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    RealTime=(substr($3,1,match($3, ":")-1)*60. + substr($3,match($3, ":")+1))
222
223  }
224# linux system time
225  else if (match($0, ".*user .*system .*elapsed .*CPU .*"))
226  {
227    myprint( "linux" )
228    counter=counter+1
229
230    UserTime=(substr($1,1,match($1, "user")-1))
231    SysTime=(substr($2,1,match($2, "system")-1))
232    RealTime=(substr($3,1,match($3, ":")-1)*60.+substr($3, match($3, ":")+1, match($3, "elapsed")))
233
234  }
235# AIX vargas system time
236  else if (match($0, "real   [0-9]*"))
237  {
238    myprint( "vargas" )
239    vargas_found=1 
240    counter=counter+1
241
242    RealTime=substr($0,8)
243    next
244  }
245  else if (vargas_found=1 )
246  {
247    if (match($0, "user   [0-9]*"))
248      {
249        UserTime=substr($0,8)
250        next
251      }
252    if (match($0, "sys    [0-9]*"))
253      {
254        SysTime=substr($0,7)
255        next
256      }
257  }
258# Get information with time output on SX hosts
259# ksh time
260  else if (match($0, "real *[0-9:.]*"))
261  {
262    myprint("ksh SX")
263    Information_ksh_SX_found=1
264    counter=counter+1
265
266    RealTime=0
267    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
268    {
269        sub1=(match($2, ":")-1)
270        sub2=sub1+2
271        fin=(substr($2,sub2))
272        sub3=(match(fin, ":")-1)+sub2
273        RealTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
274    }
275    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
276    {
277        RealTime=(substr($2,1,match($2, ":")-1))
278    }
279  }
280  else if (Information_ksh_SX_found == 1 && match($0, "user *[0-9:.]*"))
281  {
282    myprint("ksh SX ")
283
284    UserTime=0
285    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
286    {
287        sub1=(match($2, ":")-1)
288        sub2=sub1+2
289        fin=(substr($2,sub2))
290        sub3=(match(fin, ":")-1)+sub2
291        UserTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
292    }
293    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
294    {
295        UserTime=(substr($2,1,match($2, ":")-1))
296    }
297  }
298  else if (Information_ksh_SX_found == 1 && match($0, "sys *[0-9:.]*"))
299  {
300    myprint("ksh SX ")
301
302    SysTime=0
303    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
304    {
305        sub1=(match($2, ":")-1)
306        sub2=sub1+2
307        fin=(substr($2,sub2))
308        sub3=(match(fin, ":")-1)+sub2
309        SysTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
310    }
311    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
312    {
313        SysTime=(substr($2,1,match($2, ":")-1))
314    }
315  }
316
317# RUN_DATE_BEGIN
318if ($0 ~ /RunDateBegin.*=/) {
319    myprint( "start date" )
320    split($0,a,"=")
321    RunDateBegin=a[2]
322}
323
324# RUN_DATE_END
325if ($0 ~ /RunDateEnd.*=/) {
326    myprint( "end date" )
327    split($0,a,"=")
328    RunDateEnd=a[2]
329  }
330
331}
332
333#==========================
334END {
335
336    myprint("exit_value : " exit_value)
337    myprint("counter    : " counter)
338
339  if (! exit_value ) {
340    if (counter > 0) { 
341      myprint("=============================================")
342      myprint("Additionnal results on Program Informations for " ARGV[1])
343      myprint("Real Time (sec)        :" RealTime)
344      myprint("User Time (sec)        :" UserTime)
345      myprint("Sys  Time (sec)        :" SysTime)
346      myprint("Vector Time (sec)      :" VectorTime)
347      myprint("Inst. Count            :" InstCount)
348      myprint("V. Inst. Count         :" VInstCount)
349      myprint("V. Element Count       :" VElementCount)
350      myprint("FLOP Count             :" FLOPCount)
351      myprint("MOPS                   :" MOPS)
352      myprint("MFLOPS                 :" MFLOPS)
353      myprint("A.V. Length            :" AVLength)
354      myprint("V. Op. Ratio (%)       :" VOpRatio)
355      myprint("Memory Size (MB)       :" MemorySize)
356      myprint("MIPS                   :" MIPS)
357      myprint("I-Cache (sec)          :" ICache)
358      myprint("O-Cache (sec)          :" OCache)
359      myprint("Bank (sec)             :" Bank)
360
361      myprint("Date of executables :")
362      myprint("Start Time             :" RunDateBegin)
363      myprint("End   Time             :" RunDateEnd)
364
365      printf("%s %s %.5f %.5f %.5f", RunDateBegin, RunDateEnd, RealTime, UserTime, SysTime) 
366      exit(0)
367    }
368    else
369    { 
370      exit(1)
371    }
372  }
373  else
374  { 
375    exit(2)
376  }
377 
378}
Note: See TracBrowser for help on using the repository browser.