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

Last change on this file since 112 was 112, checked in by brocksce, 15 years ago

PB: - Add initialisation for RUN_DATE_BEGIN and RUN_DATE_END

(useful if AA_job is an old one ie. without RUN_DATE_BEGIN and
RUN_DATE_END sent to the ${Exe_Output})

  • 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: 6.1 KB
Line 
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: 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
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
79  RunDateBegin=0000-00-00T00:00:00
80  RunDateEnd=0000-00-00T00:00:00
81
82}
83
84#==========================
85{
86  myprint($0) 
87
88# Get information with MPI Program Information output on NEC
89  if (match($0, "     \\*\\*\\*\\*\\*\\*  Program Information  \\*\\*\\*\\*\\*\\*")) 
90  {
91    Information_found=1
92    counter=counter+1
93#   print $0     
94#    print counter
95    next
96  }
97  else if (Information_found == 1 && (match($0, ".*:.*"))) 
98  {
99    where=(match($0,"[a-zA-Z]"))
100    Length=(match($0, " *:"))-where
101    whereDot=(match($0, ":"))
102    info=substr($0,where,Length)
103    whereNum=(match($0, "[0-9]"))
104    Res=substr($0,whereNum)
105#    print where "," Length "," whereDot "," whereNum " '" info "' :" Res
106
107    if( info=="Real Time (sec)" ) {
108#      print "|" Res "|"
109#      printf("RealTime = %10.5f\n",0.037600)
110#      printf("RealTime = %10.5f\n",Res)
111      if ( Res > RealTime ) {
112        RealTime=Res
113      }
114      next
115    }
116         
117    if( info=="User Time (sec)" ) {
118      UserTime=UserTime+Res
119      next
120    }
121
122    if( info=="Sys  Time (sec)" ) {
123      SysTime=SysTime+Res
124      next
125    }
126
127    if( info=="Vector Time (sec)" ) {
128      VectorTime=VectorTime+Res
129      next 
130    }
131
132    if( info=="Inst. Count" ) {
133      InstCount=InstCount+Res
134      next
135    }
136
137    if( info=="V. Element Count" ) {
138      VInstCount=VInstCount+Res
139      next 
140    }
141
142    if( info=="V. Element Count" ) {
143      VElementCount=VElementCount+Res
144      next
145    }
146
147    if( info=="FLOP Count" ) {
148      FLOPCount=FLOPCount+Res
149      next 
150    }
151
152    if( info=="MOPS" ) {
153      MOPS=MOPS+Res
154      next
155    }
156
157    if( info=="MFLOPS" ) {
158      MFLOPS=MFLOPS+Res
159      next 
160    }
161
162    if( info=="A.V. Length" ) {
163      AVLength=AVLength+Res
164      next
165    }
166
167    if( info=="V. Op. Ratio (%)" ) {
168      VOpRatio=VOpRatio+Res
169      next 
170    }
171
172    if( info=="Memory Size (MB)" ) {
173      MemorySize=MemorySize+Res
174      next
175    }
176
177    if( info=="MIPS" ) {
178      MIPS=MIPS+Res
179      next 
180    }
181
182    if( info=="I-Cache (sec)" ) {
183      ICache=ICache+Res
184      next
185    }
186
187    if( info=="O-Cache (sec)" ) {
188      OCache=OCache+Res
189      next 
190    }
191
192    if( info=="Bank (sec)" ) {
193      Bank=Bank+Res
194      next
195    }
196
197  }
198# Get information with time output on other hosts
199# ksh time
200  else if (match($0, ".*s real .*s user .*s system"))
201  {
202    myprint( "ksh" )
203    counter=counter+1
204
205    RealTime=(substr($1,1,match($1, "s")-1))
206    UserTime=(substr($3,1,match($3, "s")-1))
207    SysTime=(substr($5,1,match($5, "s")-1))
208
209  }
210# csh time
211  else if (match($0, "[0-9.]+u [0-9.]+s .+"))
212  {
213    myprint( "csh" )
214    counter=counter+1
215
216    UserTime=(substr($1,1,match($1, "u")-1))
217    SysTime=(substr($2,1,match($2, "s")-1))
218    RealTime=(substr($3,1,match($3, ":")-1)*60. + substr($3,match($3, ":")+1))
219
220  }
221# linux system time
222  else if (match($0, ".*user .*system .*elapsed .*CPU .*"))
223  {
224    myprint( "linux" )
225    counter=counter+1
226
227    UserTime=(substr($1,1,match($1, "user")-1))
228    SysTime=(substr($2,1,match($2, "system")-1))
229    RealTime=(substr($3,1,match($3, ":")-1)*60.+substr($3, match($3, ":")+1, match($3, "elapsed")))
230
231  }
232
233# RUN_DATE_BEGIN
234if ($0 ~ /RunDateBegin.*=/) {
235    myprint( "start date" )
236    split($0,a,"=")
237    RunDateBegin=a[2]
238}
239
240# RUN_DATE_END
241if ($0 ~ /RunDateEnd.*=/) {
242    myprint( "end date" )
243    split($0,a,"=")
244    RunDateEnd=a[2]
245  }
246
247}
248
249#==========================
250END {
251
252  if (! exit_value ) {
253    if (counter > 0) { 
254      myprint("=============================================")
255      myprint("Additionnal results on Program Informations for " ARGV[1])
256      myprint("Real Time (sec)        :" RealTime)
257      myprint("User Time (sec)        :" UserTime)
258      myprint("Sys  Time (sec)        :" SysTime)
259      myprint("Vector Time (sec)      :" VectorTime)
260      myprint("Inst. Count            :" InstCount)
261      myprint("V. Inst. Count         :" VInstCount)
262      myprint("V. Element Count       :" VElementCount)
263      myprint("FLOP Count             :" FLOPCount)
264      myprint("MOPS                   :" MOPS)
265      myprint("MFLOPS                 :" MFLOPS)
266      myprint("A.V. Length            :" AVLength)
267      myprint("V. Op. Ratio (%)       :" VOpRatio)
268      myprint("Memory Size (MB)       :" MemorySize)
269      myprint("MIPS                   :" MIPS)
270      myprint("I-Cache (sec)          :" ICache)
271      myprint("O-Cache (sec)          :" OCache)
272      myprint("Bank (sec)             :" Bank)
273
274      myprint("Date of executables :")
275      myprint("Start Time             :" RunDateBegin)
276      myprint("End   Time             :" RunDateEnd)
277
278      printf("%s %s %.5f %.5f %.5f", RunDateBegin, RunDateEnd, RealTime, UserTime, SysTime) 
279      exit(0)
280    }
281    else
282    { 
283      exit(1)
284    }
285  }
286  else
287  { 
288    exit(2)
289  }
290 
291}
Note: See TracBrowser for help on using the repository browser.