[695] | 1 | #!/bin/ksh |
---|
| 2 | ############################################################## |
---|
| 3 | # Original : C. Talandier for ESOPA |
---|
| 4 | # Contact : opatlod@locean-ipsl.upmc.fr |
---|
| 5 | # |
---|
| 6 | # It is called by the assessment.ksh script for a |
---|
| 7 | # given configuration |
---|
| 8 | # |
---|
| 9 | # INPUT ARGS: 6 |
---|
| 10 | # - zrunt : run type to treat |
---|
| 11 | # - zfile1 : mon run timing input file name |
---|
| 12 | # - zfile2 : mpi run timing input file name |
---|
| 13 | # - zconf : configuration name |
---|
| 14 | # - zout : output file name |
---|
| 15 | # - ztag : tag name to which are compared files |
---|
| 16 | # - zxis : (0/1) reference timing files (do/do not) exist |
---|
| 17 | # |
---|
| 18 | # WORK: It aims to : |
---|
| 19 | # |
---|
| 20 | # - Treat output timing from the aix target for |
---|
| 21 | # mon & mpi run |
---|
| 22 | # *- compare it to a reference version |
---|
| 23 | # |
---|
| 24 | # * this step is performed only if a reference tag |
---|
| 25 | # is specified with the -t option and if files exist. |
---|
| 26 | # See the Makefile under ./config/HEAD directory |
---|
| 27 | # |
---|
| 28 | ############################################################## |
---|
| 29 | #set -xv |
---|
| 30 | ############################################################## |
---|
| 31 | |
---|
| 32 | # Get the name of the present script |
---|
| 33 | nscript=$( (basename $0) ) |
---|
| 34 | |
---|
| 35 | # |
---|
| 36 | # help_CPU_time() To print help |
---|
| 37 | # |
---|
| 38 | function help_CPU_time |
---|
| 39 | { |
---|
| 40 | echo "Usage: $nscript [-r] [-a] [-b] [-c] [-o] [-t] [-x]" |
---|
| 41 | echo "Options: These are optional argument" |
---|
| 42 | echo " -r : run type to treat" |
---|
| 43 | echo " -a : current version timing input file name" |
---|
| 44 | echo " -b : reference version timing input file name" |
---|
| 45 | echo " -c : configuration name" |
---|
| 46 | echo " -o : output file name" |
---|
| 47 | echo " -t : tag name to which are compared files" |
---|
| 48 | echo " -x : (0/1) reference timing files (do/do not) exist" |
---|
| 49 | echo " their values are not taken)" |
---|
| 50 | exit 1 |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | # Initialization |
---|
| 54 | zrunt= |
---|
| 55 | zfile1= |
---|
| 56 | zfile2= |
---|
| 57 | zconf= |
---|
| 58 | zout= |
---|
| 59 | ztag= |
---|
| 60 | zxis=1 |
---|
| 61 | |
---|
| 62 | # Get arguments |
---|
| 63 | while getopts r:a:b:c:o:t:x: opt |
---|
| 64 | do |
---|
| 65 | case "$opt" in |
---|
| 66 | r) zrunt="$OPTARG";; |
---|
| 67 | a) zfile1="$OPTARG";; |
---|
| 68 | b) zfile2="$OPTARG";; |
---|
| 69 | c) zconf="$OPTARG";; |
---|
| 70 | o) zout="$OPTARG";; |
---|
| 71 | t) ztag="$OPTARG";; |
---|
| 72 | x) zxis="$OPTARG";; |
---|
| 73 | *) help_CPU_time;; |
---|
| 74 | esac |
---|
| 75 | done |
---|
| 76 | |
---|
| 77 | # Check if results must be compare to the reference version |
---|
| 78 | test -n "${ztag}" |
---|
| 79 | evaltag=$? |
---|
| 80 | |
---|
| 81 | case "${zrunt}" in |
---|
| 82 | |
---|
| 83 | 'mon' ) |
---|
| 84 | |
---|
| 85 | # OUTPUT TIMING OF THE MON RUN |
---|
| 86 | ############################## |
---|
| 87 | |
---|
| 88 | if [ ${evaltag} -a ${zxis} == 0 ] ; then |
---|
| 89 | # Get values from the reference tag |
---|
| 90 | zreal=$( (awk '/wall clock time/ {print $6}' ${zfile2} ) ) |
---|
| 91 | zuser=$( (awk '/Total amount of time in u/ {print $9}' ${zfile2} ) ) |
---|
| 92 | zmemo=$( (awk '/Maximum resident set size/ {print $6/1024}' ${zfile2} ) ) |
---|
| 93 | zuzra=$( (awk '/Utilization rate/ {print $4}' ${zfile2} ) ) |
---|
| 94 | zcoin=$( (awk '/Computation intensity/ {print $4}' ${zfile2} ) ) |
---|
| 95 | # Print: Variable long name | current version values | reference version values | variations |
---|
| 96 | echo " Current version ${ztag} version Variation " >> ${zout} |
---|
| 97 | echo " " >> ${zout} |
---|
| 98 | awk '/wall clock time/ { creal=$6 ; printf("%-6s %.33s %8s %12.2f | %12.2f | %7.2f % \n", " ", $0, "(sec) :" , $6 , invar, ((creal-invar)/invar)*100 ) }' invar=${zreal} ${zfile1} >> ${zout} |
---|
| 99 | awk '/Total amount of time in u/ { cuser=$9 ; printf("%-6s %.34s %7s %12.2f | %12.2f | %7.2f % \n", " ", $0, "(sec) :" , $9 , invar, ((cuser-invar)/invar)*100 ) }' invar=${zuser} ${zfile1} >> ${zout} |
---|
| 100 | awk '/Maximum resident set size/ { cmflo=$6/1024 ; printf("%-6s %.26s %15s %12.2f | %12.2f | %7.2f % \n", " ", $0, "(Mo) :" ,cmflo, invar, ((cmflo-invar)/invar)*100 ) }' invar=${zmemo} ${zfile1} >> ${zout} |
---|
| 101 | awk '/Utilization rate/ { cuzra=$4 ; printf("%-5s %.24s %18s %12.2f | %12.2f | %7.2f % \n", " ", $0, "~100% (%) :", $4 , invar, ((cuzra-invar)/invar)*100 ) }' invar=${zuzra} ${zfile1} >> ${zout} |
---|
| 102 | awk '/Computation intensity/ { ccoin=$4 ; printf("%-5s %.23s %19s %12.2f | %12.2f | %7.2f % \n", " ", $0, "> 1 :" , $4 , invar, ((ccoin-invar)/invar)*100 ) }' invar=${zcoin} ${zfile1} >> ${zout} |
---|
| 103 | else |
---|
| 104 | # Print: Variable long name | current version values |
---|
| 105 | echo " Current version " >> ${zout} |
---|
| 106 | echo " " >> ${zout} |
---|
| 107 | awk '/wall clock time/ {printf("%-6s %.33s %8s %9.2f \n", " ", $0, "(sec) :" , $6 ) }' ${zfile1} >> ${zout} |
---|
| 108 | awk '/Total amount of time in u/ {printf("%-6s %.34s %7s %9.2f \n", " ", $0, "(sec) :" , $9 ) }' ${zfile1} >> ${zout} |
---|
| 109 | awk '/Maximum resident set size/ {printf("%-6s %.26s %15s %9.2f \n", " ", $0, "(Mo) :" , $6/1024) }' ${zfile1} >> ${zout} |
---|
| 110 | awk '/Utilization rate/ {printf("%-5s %.24s %18s %9.2f \n", " ", $0, "~100% (%) :", $4 ) }' ${zfile1} >> ${zout} |
---|
| 111 | awk '/Computation intensity/ {printf("%-5s %.23s %19s %9.2f \n", " ", $0, "> 1 :" , $4 ) }' ${zfile1} >> ${zout} |
---|
| 112 | fi |
---|
| 113 | |
---|
| 114 | ;; |
---|
| 115 | |
---|
| 116 | 'mpi' ) |
---|
| 117 | |
---|
| 118 | # OUTPUT TIMING OF THE MPI RUN |
---|
| 119 | ############################## |
---|
| 120 | |
---|
| 121 | if [ ${evaltag} -a ${zxis} == 0 ] ; then |
---|
| 122 | # Get values from the reference tag |
---|
| 123 | awk '/wall clock time/ {print}' ${zfile2} > temp1 |
---|
| 124 | awk '/Maximum resident set size/ {print}' ${zfile2} > temp2 |
---|
| 125 | awk '/Utilization rate/ {print}' ${zfile2} > temp3 |
---|
| 126 | awk '/Computation intensity/ {print}' ${zfile2} > temp4 |
---|
| 127 | |
---|
| 128 | zreal=$( (awk '/wall clock time/ {cum += $6} END {printf("%f", cum/NR) }' temp1 ) ) |
---|
| 129 | zuser=$( (awk '/Total amount of time in u/ {cum += $9} END {printf("%f", cum ) }' ${zfile2}) ) |
---|
| 130 | zmemo=$( (awk '/Maximum resident set size/ {cum += $6} END {printf("%f", cum/(1024*NR)) }' temp2 ) ) |
---|
| 131 | zuzra=$( (awk '/Utilization rate/ {cum += $4} END {printf("%f", cum/NR) }' temp3 ) ) |
---|
| 132 | zcoin=$( (awk '/Computation intensity/ {cum += $4} END {printf("%f", cum/NR) }' temp4 ) ) |
---|
| 133 | |
---|
| 134 | # Get values from the current version |
---|
| 135 | awk '/wall clock time/ {print}' ${zfile1} > temp1 |
---|
| 136 | awk '/Maximum resident set size/ {print}' ${zfile1} > temp2 |
---|
| 137 | awk '/Utilization rate/ {print}' ${zfile1} > temp3 |
---|
| 138 | awk '/Computation intensity/ {print}' ${zfile1} > temp4 |
---|
| 139 | |
---|
| 140 | echo " Current version ${ztag} version Variation " >> ${zout} |
---|
| 141 | echo " " >> ${zout} |
---|
| 142 | awk '/wall clock time/ {cum += $6} END {printf("%-7s %-39s %1s %11.2f | %12.2f | %7.2f %\n" , " ", "Execution time (wall clock time) (sec)", ":", cum/NR , invar, ((cum/NR-invar)/invar)*100 ) }' invar=${zreal} temp1 >> ${zout} |
---|
| 143 | awk '/Total amount of time in u/ {cum += $9} END {printf("%-7s %-39s %1s %11.2f | %12.2f | %7.2f %\n" , " ", "Total amount of time in user mode (sec)", ":", cum , invar, ((cum-invar)/invar)*100 ) }' invar=${zuser} ${zfile1} >> ${zout} |
---|
| 144 | awk '/Maximum resident set size/ {cum += $6} END {printf("%-7s %-25s %15s %12.2f | %12.2f | %7.2f %\n", " ", "Maximum resident set size", "(Mo) :" , cum/(1024*NR), invar, ((cum/(1024*NR)-invar)/invar)*100 ) }' invar=${zmemo} temp2 >> ${zout} |
---|
| 145 | awk '/Utilization rate/ {cum += $4} END {printf("%-7s %-16s %24s %12.2f | %12.2f | %7.2f %\n", " ", "Utilization rate", "(%) :" , cum/NR , invar, ((cum/NR-invar)/invar)*100 ) }' invar=${zuzra} temp3 >> ${zout} |
---|
| 146 | awk '/Computation intensity/ {cum += $4} END {printf("%-7s %-21s %19s %12.2f | %12.2f | %7.2f %\n", " ", "Computation intensity", ":" , cum/NR , invar, ((cum/NR-invar)/invar)*100 ) }' invar=${zcoin} temp4 >> ${zout} |
---|
| 147 | |
---|
| 148 | echo " " >> ${zout} |
---|
| 149 | |
---|
| 150 | \rm temp* |
---|
| 151 | |
---|
| 152 | else |
---|
| 153 | # Get values from the current version |
---|
| 154 | awk '/wall clock time/ {print}' ${zfile1} > temp1 |
---|
| 155 | awk '/Maximum resident set size/ {print}' ${zfile1} > temp2 |
---|
| 156 | awk '/Utilization rate/ {print}' ${zfile1} > temp3 |
---|
| 157 | awk '/Computation intensity/ {print}' ${zfile1} > temp4 |
---|
| 158 | |
---|
| 159 | echo " Current version " >> ${zout} |
---|
| 160 | echo " " >> ${zout} |
---|
| 161 | awk '/wall clock time/ {cum += $6} END {printf("%-7s %-39s %1s %9.2f\n" , " ", "Execution time (wall clock time) (sec)", ":", cum/NR ) }' temp1 >> ${zout} |
---|
| 162 | awk '/Total amount of time in u/ {cum += $9} END {printf("%-7s %-39s %1s %9.2f\n" , " ", "Total amount of time in user mode (sec)", ":", cum ) }' ${zfile1} >> ${zout} |
---|
| 163 | awk '/Maximum resident set size/ {cum += $6} END {printf("%-7s %-25s %15s %9.2f\n", " ", "Maximum resident set size", "(Mo) :", cum/(1024*NR) ) }' temp2 >> ${zout} |
---|
| 164 | awk '/Utilization rate/ {cum += $4} END {printf("%-7s %-16s %24s %9.2f\n", " ", "Utilization rate", "(%) :", cum/NR ) }' temp3 >> ${zout} |
---|
| 165 | awk '/Computation intensity/ {cum += $4} END {printf("%-7s %-21s %19s %9.2f\n", " ", "Computation intensity", ":", cum/NR ) }' temp4 >> ${zout} |
---|
| 166 | |
---|
| 167 | echo " " >> ${zout} |
---|
| 168 | |
---|
| 169 | \rm temp* |
---|
| 170 | fi |
---|
| 171 | |
---|
| 172 | ;; |
---|
| 173 | esac |
---|