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