1 | #!/bin/ksh |
---|
2 | # $Id$ |
---|
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 | # - 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 | # - 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 osxxlf target for |
---|
22 | # mon, mpi 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] [-c] [-o] [-t]" |
---|
42 | echo "Options: These are optional argument" |
---|
43 | echo " -a : (0/1) mon${CONF}_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${CONF}_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 | zmxcu=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) zmxcu="$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' |
---|
83 | zfilers='mon/LONG/REF/memory_size.txt' |
---|
84 | |
---|
85 | # Select only appropriate lines |
---|
86 | grep -v Stack ${zfilecs} | head -1 > temp_cs_sck |
---|
87 | tail -1 ${zfilecs} > temp_cs_sic |
---|
88 | |
---|
89 | # Select only appropriate lines |
---|
90 | grep -v Stack ${zfilers} | head -1 > temp_rs_sck |
---|
91 | tail -1 ${zfilers} > temp_rs_sic |
---|
92 | |
---|
93 | # If reference version files exist |
---|
94 | if [ ${evaltag} == 0 -a ${zxrs} == 0 ] ; then |
---|
95 | # Get values from the reference tag |
---|
96 | Mo_stack_ms=$( (awk '{print $5/(1024*1024) }' temp_rs_sck ) ) |
---|
97 | Mo_stati_ms=$( (awk '{print $5/(1024*1024) }' temp_rs_sic ) ) |
---|
98 | |
---|
99 | # Print: Variable long name | current version values | reference version values | variations |
---|
100 | echo " " >> ${zout} |
---|
101 | echo " Version " >> ${zout} |
---|
102 | echo " Memory Current / \ ${ztag} Variation " >> ${zout} |
---|
103 | 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} |
---|
104 | 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} |
---|
105 | else |
---|
106 | # Print: Variable long name | current version values |
---|
107 | echo " " >> ${zout} |
---|
108 | echo " Memory Current version " >> ${zout} |
---|
109 | awk ' {printf("%-9s %-.16s %11.1f\n ", " ", "Stack (Mo) :", $5/(1024*1024) ) }' temp_cs_sck >> ${zout} |
---|
110 | awk ' {printf("%-8s %-.16s %11.1f\n ", " ", "Static (Mo) :", $5/(1024*1024) ) }' temp_cs_sic >> ${zout} |
---|
111 | fi |
---|
112 | |
---|