#!/usr/bin/awk -f # IGCM_add_out - filter of output of the job : # command : # IGCM_add_out.awk job_output.out REALTIME USERTIME SYSTIME #************************************************************** # Author: Martial.Mancip # Contact: Martial.Mancip@ipsl.jussieu.fr # $Date$ # $Author$ # $Revision$ # IPSL (2006) # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC # History: # Modification: # #************************************************************** #========================== function myprint(str) { if (debug) { print str } } #========================== BEGIN { # print "traitement de " ARGV[1] nbarg=ARGC if (match(ARGV[1],"-d")) { debug=1 file=ARGV[2] delete ARGV[1] nbarg-- } else { debug=0 file=ARGV[1] } # When exit statement, 'END' rule is always executed, so defined a exit_value to manage this exit_value=0 if (nbarg != 2) { print "Usage: $ print print "Args:" print " file.output = output file of at Job to be parsed" print print "Options:" print " -d = debug mode" print exit_value=1 exit } Information_found=0 RealTime=0. UserTime=-1. SysTime=0. VectorTime=0. InstCount=0. VInstCount=0. VElementCount=0. FLOPCount=0. MOPS=0. MFLOPS=0. AVLength=0. VOpRatio=0. MemorySize=0. MIPS=0. ICache=0. OCache=0. Bank=0. counter=0 # StartTime=[] # EndTime=[] Date_found=0 # print ENVIRON["LC_ALL"] # ENVIRON["LC_ALL"]="fr_FR" # print ENVIRON["LC_ALL"] } #========================== { myprint($0) # Get information with MPI Program Information output on NEC if (match($0, " \\*\\*\\*\\*\\*\\* Program Information \\*\\*\\*\\*\\*\\*")) { Information_found=1 counter=counter+1 # print $0 # print counter next } else if (Information_found == 1 && (match($0, ".*:.*"))) { where=(match($0,"[a-zA-Z]")) Length=(match($0, " *:"))-where whereDot=(match($0, ":")) info=substr($0,where,Length) whereNum=(match($0, "[0-9]")) Res=substr($0,whereNum) # print where "," Length "," whereDot "," whereNum " '" info "' :" Res if( info=="Real Time (sec)" ) { # print "|" Res "|" # printf("RealTime = %10.5f\n",0.037600) # printf("RealTime = %10.5f\n",Res) if ( Res > RealTime ) { RealTime=Res } next } if( info=="User Time (sec)" ) { UserTime=UserTime+Res next } if( info=="Sys Time (sec)" ) { SysTime=SysTime+Res next } if( info=="Vector Time (sec)" ) { VectorTime=VectorTime+Res next } if( info=="Inst. Count" ) { InstCount=InstCount+Res next } if( info=="V. Element Count" ) { VInstCount=VInstCount+Res next } if( info=="V. Element Count" ) { VElementCount=VElementCount+Res next } if( info=="FLOP Count" ) { FLOPCount=FLOPCount+Res next } if( info=="MOPS" ) { MOPS=MOPS+Res next } if( info=="MFLOPS" ) { MFLOPS=MFLOPS+Res next } if( info=="A.V. Length" ) { AVLength=AVLength+Res next } if( info=="V. Op. Ratio (%)" ) { VOpRatio=VOpRatio+Res next } if( info=="Memory Size (MB)" ) { MemorySize=MemorySize+Res next } if( info=="MIPS" ) { MIPS=MIPS+Res next } if( info=="I-Cache (sec)" ) { ICache=ICache+Res next } if( info=="O-Cache (sec)" ) { OCache=OCache+Res next } if( info=="Bank (sec)" ) { Bank=Bank+Res next } if( info=="Start Time (date)" ) { StartTime[counter]=Res next } if( info=="End Time (date)" ) { EndTime[counter]=Res Information_found=0 next } } # Get information with time output on other hosts # ksh time else if (match($0, ".*s real .*s user .*s system")) { myprint( "ksh" ) counter=counter+1 RealTime=(substr($1,1,match($1, "s")-1)) UserTime=(substr($3,1,match($3, "s")-1)) SysTime=(substr($5,1,match($5, "s")-1)) } # csh time else if (match($0, "[0-9.]+u [0-9.]+s .+")) { myprint( "csh" ) counter=counter+1 UserTime=(substr($1,1,match($1, "u")-1)) SysTime=(substr($2,1,match($2, "s")-1)) RealTime=(substr($3,1,match($3, ":")-1)*60. + substr($3,match($3, ":")+1)) } # linux system time else if (match($0, ".*user .*system .*elapsed .*CPU .*")) { myprint( "linux" ) counter=counter+1 UserTime=(substr($1,1,match($1, "user")-1)) SysTime=(substr($2,1,match($2, "system")-1)) RealTime=(substr($3,1,match($3, ":")-1)*60.+substr($3, match($3, ":")+1, match($3, "elapsed"))) } # date end # date begin 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]+"))) { myprint( "start date" ) Date_found=1 StartTime[counter]=$0 } 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]+"))) { myprint( "end date" ) EndTime[counter]=$0 exit } } #========================== END { if (! exit_value ) { if (counter > 0) { myprint("=============================================") myprint("Additionnal results on Program Informations for " ARGV[1]) myprint("Real Time (sec) :" RealTime) myprint("User Time (sec) :" UserTime) myprint("Sys Time (sec) :" SysTime) myprint("Vector Time (sec) :" VectorTime) myprint("Inst. Count :" InstCount) myprint("V. Inst. Count :" VInstCount) myprint("V. Element Count :" VElementCount) myprint("FLOP Count :" FLOPCount) myprint("MOPS :" MOPS) myprint("MFLOPS :" MFLOPS) myprint("A.V. Length :" AVLength) myprint("V. Op. Ratio (%) :" VOpRatio) myprint("Memory Size (MB) :" MemorySize) myprint("MIPS :" MIPS) myprint("I-Cache (sec) :" ICache) myprint("O-Cache (sec) :" OCache) myprint("Bank (sec) :" Bank) myprint("Date of executables :") for (i=1; i<=counter; i++) { myprint("Start Time (date) :" StartTime[i]) myprint("End Time (date) :" EndTime[i]) } printf("%s , %s , %.5f , %.5f , %.5f", StartTime[counter], EndTime[counter], RealTime, UserTime, SysTime) exit(0) } else { exit(1) } } else { exit(2) } }