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_aix6.ksh in tags/nemo_v3_2/nemo_v3_2/NVTK/INSTALL/JOBS – NEMO

source: tags/nemo_v3_2/nemo_v3_2/NVTK/INSTALL/JOBS/CPU_time_aix6.ksh @ 1878

Last change on this file since 1878 was 1878, checked in by flavoni, 14 years ago

initial test for nemogcm

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