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 | # - zxcm : (0/1) mon${zconf}_err file (do/do not) exist" |
---|
11 | # - zxrs : (0/1) Ref memory_size.txt file (do/do not) exist" |
---|
12 | # - zxrm : (0/1) Ref mon${zconf}_err file (do/do not) exist" |
---|
13 | # - zconf : configuration name" |
---|
14 | # - zout : output file name" |
---|
15 | # - ztag : tag name to which are compared files" |
---|
16 | # |
---|
17 | # WORK: It aims to : |
---|
18 | # |
---|
19 | # - Treat output timing from the sx8brodie target for |
---|
20 | # mon, mpi & omp runs |
---|
21 | # *- compare it to a reference version |
---|
22 | # |
---|
23 | # * this step is performed only if a reference tag |
---|
24 | # is specified with the -t option and if files exist. |
---|
25 | # See the Makefile under ./config/HEAD directory |
---|
26 | # |
---|
27 | ############################################################## |
---|
28 | #set -xv |
---|
29 | ############################################################## |
---|
30 | |
---|
31 | # Get the name of the present script |
---|
32 | nscript=$( (basename $0) ) |
---|
33 | |
---|
34 | # |
---|
35 | # help_CPU_time() To print help |
---|
36 | # |
---|
37 | function help_CPU_time |
---|
38 | { |
---|
39 | echo "Usage: $nscript [-a] [-b] [-d] [-c] [-o] [-t]" |
---|
40 | echo "Options: These are optional argument" |
---|
41 | echo " -a : (0/1) mon${zconf}_err file (do/do not) exist" |
---|
42 | echo " -b : (0/1) Ref memory_size.txt file (do/do not) exist" |
---|
43 | echo " -d : (0/1) Ref mon${zconf}_err file (do/do not) exist" |
---|
44 | echo " -c : configuration name" |
---|
45 | echo " -o : output file name" |
---|
46 | echo " -t : tag name to which are compared files" |
---|
47 | echo " their values are not taken)" |
---|
48 | exit 1 |
---|
49 | } |
---|
50 | |
---|
51 | # Initialization |
---|
52 | zxcm=1 |
---|
53 | zxrs=1 |
---|
54 | zxrm=1 |
---|
55 | zconf= |
---|
56 | zout= |
---|
57 | ztag= |
---|
58 | |
---|
59 | # Get arguments |
---|
60 | while getopts a:b:d:c:o:t: opt |
---|
61 | do |
---|
62 | case "$opt" in |
---|
63 | a) zxcm="$OPTARG";; |
---|
64 | b) zxrs="$OPTARG";; |
---|
65 | d) zxrm="$OPTARG";; |
---|
66 | c) zconf="$OPTARG";; |
---|
67 | o) zout="$OPTARG";; |
---|
68 | t) ztag="$OPTARG";; |
---|
69 | *) help_MEM_size;; |
---|
70 | esac |
---|
71 | done |
---|
72 | |
---|
73 | # Check if results must be compared to the reference version |
---|
74 | test -n "${ztag}" |
---|
75 | evaltag=$? |
---|
76 | |
---|
77 | zfilecs='mon/LONG/memory_size.txt' ; zfilers='mon/LONG/REF/memory_size.txt' |
---|
78 | zfilecm="mon/LONG/mon${zconf}_err" ; zfilerm="mon/LONG/REF/mon${zconf}_err" |
---|
79 | |
---|
80 | # If reference version files exist |
---|
81 | if [ ${evaltag} == 0 -a ${zxrm} == 0 ] ; then |
---|
82 | # Get values from the reference tag |
---|
83 | Mo_stack_ms=$( (awk '/Stack/ {print $NF/(1024*1024) }' ${zfilers} ) ) |
---|
84 | Mo_stati_ms=$( (awk '/Stati/ {print $NF/(1024*1024) }' ${zfilers} ) ) |
---|
85 | if [ ${zxcm} == 0 ] ; then Mo_max_used=$( (awk '/Memory/ {print $NF}' ${zfilerm} ) ) ; fi |
---|
86 | |
---|
87 | # Print: Variable long name | current version values | reference version values | variations |
---|
88 | echo " " >> ${zout} |
---|
89 | echo " Version " >> ${zout} |
---|
90 | echo " Memory Current / \ ${ztag} Variation " >> ${zout} |
---|
91 | awk ' /Stack/ { val=$NF/(1024*1024) } END {printf("%-9s %-16s %8.1f | %8.1f | %5.1f %\n ", " ", "Stack (Mo) :", val, inck, ((val-inck)/inck)*100 ) }' inck=${Mo_stack_ms} ${zfilecs} >> ${zout} |
---|
92 | awk ' /Stati/ { val=$NF/(1024*1024) } END {printf("%-8s %-16s %8.1f | %8.1f | %5.1f %\n ", " ", "Static (Mo) :", val, inti, ((val-inti)/inti)*100 ) }' inti=${Mo_stati_ms} ${zfilecs} >> ${zout} |
---|
93 | if [ ${zxcm} == 0 ] ; then awk ' /Memory/ { val=$NF } END {printf("%-8s %-16s %8.1f | %8.1f | %5.1f %\n ", " ", "Max. used (Mo) :", val, inus, ((val-inus)/inus)*100 ) }' inus=${Mo_max_used} ${zfilecm} >> ${zout} ; fi |
---|
94 | else |
---|
95 | # Print: Variable long name | current version values |
---|
96 | echo " " >> ${zout} |
---|
97 | echo " Memory Current version " >> ${zout} |
---|
98 | awk ' /Stack/ {printf("%-9s %-.16s %11.1f\n ", " ", "Stack (Mo) :", $NF/(1024*1024) ) }' ${zfilecs} >> ${zout} |
---|
99 | awk ' /Stati/ {printf("%-8s %-.16s %11.1f\n ", " ", "Static (Mo) :", $NF/(1024*1024) ) }' ${zfilecs} >> ${zout} |
---|
100 | if [ ${zxcm} == 0 ] ; then awk ' /Memory/ {printf("%-8s %-.16s %11.1f\n ", " ", "Max. used (Mo) :", $NF ) }' ${zfilecm} >> ${zout} ; fi |
---|
101 | fi |
---|