New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
CPU_time_aix.ksh in trunk/NVTK/INSTALL/JOBS – NEMO

source: trunk/NVTK/INSTALL/JOBS/CPU_time_aix.ksh @ 1154

Last change on this file since 1154 was 1154, checked in by ctlod, 16 years ago

add svn Id

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