[695] | 1 | #!/bin/ksh |
---|
[1154] | 2 | # $Id$ |
---|
[695] | 3 | ############################################################## |
---|
| 4 | # Original : C. Talandier for ESOPA |
---|
| 5 | # Contact : opatlod@locean-ipsl.upmc.fr |
---|
| 6 | # |
---|
| 7 | # It is called by the assessment.ksh script for a |
---|
| 8 | # given configuration |
---|
| 9 | # |
---|
| 10 | # INPUT ARGS: 6 |
---|
| 11 | # - zmxcu : (0/1) mon${CONF}_err file (do/do not) exist" |
---|
| 12 | # - zxrs : (0/1) Ref memory_size.txt file (do/do not) exist" |
---|
| 13 | # - zxrm : (0/1) Ref mon${CONF}_err file (do/do not) exist" |
---|
| 14 | # - zconf : configuration name" |
---|
| 15 | # - zout : output file name" |
---|
| 16 | # - ztag : tag name to which are compared files" |
---|
| 17 | # |
---|
| 18 | # WORK: It aims to : |
---|
| 19 | # |
---|
| 20 | # - Treat output timing from the osxxlf target for |
---|
| 21 | # mon, mpi runs |
---|
| 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. |
---|
[1140] | 26 | # See the Makefile under ./config/NVTK directory |
---|
[695] | 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 [-a] [-b] [-d] [-c] [-o] [-t]" |
---|
| 41 | echo "Options: These are optional argument" |
---|
| 42 | echo " -a : (0/1) mon${CONF}_err file (do/do not) exist" |
---|
| 43 | echo " -b : (0/1) Ref memory_size.txt file (do/do not) exist" |
---|
| 44 | echo " -d : (0/1) Ref mon${CONF}_err file (do/do not) exist" |
---|
| 45 | echo " -c : configuration name" |
---|
| 46 | echo " -o : output file name" |
---|
| 47 | echo " -t : tag name to which are compared files" |
---|
| 48 | echo " their values are not taken)" |
---|
| 49 | exit 1 |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | # Initialization |
---|
| 53 | zmxcu=1 |
---|
| 54 | zxrs=1 |
---|
| 55 | zxrm=1 |
---|
| 56 | zconf= |
---|
| 57 | zout= |
---|
| 58 | ztag= |
---|
| 59 | |
---|
| 60 | # Get arguments |
---|
| 61 | while getopts a:b:d:c:o:t: opt |
---|
| 62 | do |
---|
| 63 | case "$opt" in |
---|
| 64 | a) zmxcu="$OPTARG";; |
---|
| 65 | b) zxrs="$OPTARG";; |
---|
| 66 | d) zxrm="$OPTARG";; |
---|
| 67 | c) zconf="$OPTARG";; |
---|
| 68 | o) zout="$OPTARG";; |
---|
| 69 | t) ztag="$OPTARG";; |
---|
| 70 | *) help_MEM_size;; |
---|
| 71 | esac |
---|
| 72 | done |
---|
| 73 | |
---|
| 74 | # Check if results must be compared to the reference version |
---|
| 75 | test -n "${ztag}" |
---|
| 76 | evaltag=$? |
---|
| 77 | |
---|
| 78 | zfilecs='mon/LONG/memory_size.txt' |
---|
| 79 | zfilers='mon/LONG/REF/memory_size.txt' |
---|
| 80 | |
---|
| 81 | # Select only appropriate lines |
---|
| 82 | grep -v Stack ${zfilecs} | head -1 > temp_cs_sck |
---|
| 83 | tail -1 ${zfilecs} > temp_cs_sic |
---|
| 84 | |
---|
| 85 | # Select only appropriate lines |
---|
| 86 | grep -v Stack ${zfilers} | head -1 > temp_rs_sck |
---|
| 87 | tail -1 ${zfilers} > temp_rs_sic |
---|
| 88 | |
---|
| 89 | # If reference version files exist |
---|
| 90 | if [ ${evaltag} == 0 -a ${zxrs} == 0 ] ; then |
---|
| 91 | # Get values from the reference tag |
---|
| 92 | Mo_stack_ms=$( (awk '{print $5/(1024*1024) }' temp_rs_sck ) ) |
---|
| 93 | Mo_stati_ms=$( (awk '{print $5/(1024*1024) }' temp_rs_sic ) ) |
---|
| 94 | |
---|
| 95 | # Print: Variable long name | current version values | reference version values | variations |
---|
| 96 | echo " " >> ${zout} |
---|
| 97 | echo " Version " >> ${zout} |
---|
| 98 | echo " Memory Current / \ ${ztag} Variation " >> ${zout} |
---|
| 99 | awk ' { val=$5/(1024*1024) } {printf("%-9s %-16s %8.1f | %8.1f | %5.1f \n ", " ", "Stack (Mo) :", val, inck, ((val-inck)/inck)*100 ) }' inck=${Mo_stack_ms} temp_cs_sck >> ${zout} |
---|
| 100 | awk ' { val=$5/(1024*1024) } {printf("%-8s %-16s %8.1f | %8.1f | %5.1f \n ", " ", "Static (Mo) :", val, inti, ((val-inti)/inti)*100 ) }' inti=${Mo_stati_ms} temp_cs_sic >> ${zout} |
---|
| 101 | else |
---|
| 102 | # Print: Variable long name | current version values |
---|
| 103 | echo " " >> ${zout} |
---|
| 104 | echo " Memory Current version " >> ${zout} |
---|
| 105 | awk ' {printf("%-9s %-.16s %11.1f\n ", " ", "Stack (Mo) :", $5/(1024*1024) ) }' temp_cs_sck >> ${zout} |
---|
| 106 | awk ' {printf("%-8s %-.16s %11.1f\n ", " ", "Static (Mo) :", $5/(1024*1024) ) }' temp_cs_sic >> ${zout} |
---|
| 107 | fi |
---|
| 108 | |
---|