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_sx8brodie.ksh in trunk/NVTK/INSTALL/JOBS – NEMO

source: trunk/NVTK/INSTALL/JOBS/CPU_time_sx8brodie.ksh @ 1155

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

add svn Id

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 11.8 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#     - zfile1 : mon run timing input file name
12#     - zfile2 : mpi run timing input file name
13#     - zconf  : configuration 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 sx8brodie target for
21#        mon, mpi & omp runs
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] [-c] [-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 " -c : configuration name"
46  echo " -o : output file name"
47  echo " -t : tag name to which are compared files"
48  echo " -x : (0/1) reference timing files (do/do not) exist"
49  echo " their values are not taken)"
50  exit 1
51}
52
53# Initialization
54zrunt=
55zfile1=
56zfile2=
57zconf=
58zout=
59ztag=
60zxis=1
61
62# Get arguments
63while getopts r:a:b:c:o:t:x: opt
64do
65  case "$opt" in
66    r) zrunt="$OPTARG";;
67    a) zfile1="$OPTARG";;
68    b) zfile2="$OPTARG";;
69    c) zconf="$OPTARG";;
70    o) zout="$OPTARG";;
71    t) ztag="$OPTARG";;
72    x) zxis="$OPTARG";;
73    *) help_CPU_time;;
74  esac
75done
76
77# Check if results must be compare to the reference version
78test -n "${ztag}"
79evaltag=$?
80
81case "${zrunt}" in
82
83     'mon' | 'omp' )
84
85           # OUTPUT TIMING OF THE MON/OMP RUN
86           ###################################
87           
88           if [ ${evaltag} == 0 -a ${zxis} == 0 ] ; then
89               # Get values from the reference tag
90               zreal=$( (awk '/Real/        {print $NF}' ${zfile2} ) )
91               zuser=$( (awk '/User/        {print $NF}' ${zfile2} ) )
92               zmflo=$( (awk '/MFLOPS/ && ! /concurrent/      {print $NF}' ${zfile2} ) )
93               [ ${zrunt} = 'omp' ] && zmfli=$( (awk '/MFLOPS/ &&   /concurrent/      {print $NF}' ${zfile2} ) )
94               [ ${zrunt} = 'omp' ] && zmprc=$( (awk '/Max Concurrent Proc/           {print $NF}' ${zfile2} ) )
95               zvlen=$( (awk '/VLEN/        {print $NF}' ${zfile2} ) )
96               zmemo=$( (awk '/Memory Size/ {print $NF}' ${zfile2} ) )
97               # Print: Variable long name | current version values | reference version values | variations
98               echo "                                Current version    ${ztag} version    Variation " >> ${zout}
99               awk '/Real/         { creal=$5 ; printf("%-5s %.25s  %10.2f      | %10.2f    |   %7.2f % \n", " ", $0, $NF, invar, ((creal-invar)/invar)*100 ) }' invar=${zreal} ${zfile1} >> ${zout}
100               awk '/User/         { cuser=$5 ; printf("%-5s %.25s  %10.2f      | %10.2f    |   %7.2f % \n", " ", $0, $NF, invar, ((cuser-invar)/invar)*100 ) }' invar=${zuser} ${zfile1} >> ${zout}
101               awk '/MFLOPS/ && ! /concurrent/      { cmflo=$3 ; printf("%-5s %.25s  %10.2f      | %10.2f    |   %7.2f % \n", " ", $0, $NF, invar, ((cmflo-invar)/invar)*100 ) }' invar=${zmflo} ${zfile1} >> ${zout}
102               [ ${zrunt} = 'omp' ] && awk '/MFLOPS/ &&   /concurrent/      { cmfli=$4 ; printf("%-5s %.25s  %10.2f      | %10.2f    |   %7.2f % \n", " ", $0, $NF, invar, ((cmfli-invar)/invar)*100 ) }' invar=${zmfli} ${zfile1} >> ${zout}
103               awk '/VLEN/         { cvlen=$3 ; printf("%-5s %.25s  %10.2f      | %10.2f    |   %7.2f % \n", " ", $0, $NF, invar, ((cvlen-invar)/invar)*100 ) }' invar=${zvlen} ${zfile1} >> ${zout}
104               awk '/Memory Size/  { cmemo=$5 ; printf("%-5s %.25s  %10.2f      | %10.2f    |   %7.2f % \n", " ", $0, $NF, invar, ((cmemo-invar)/invar)*100 ) }' invar=${zmemo} ${zfile1} >> ${zout} 
105               [ ${zrunt} = 'omp' ] && awk '/Max Concurrent Proc/  { cmprc=$5 ; printf("%-5s %.25s  %10i      | %10i    |   %7i \n", " ", $0, $NF, invar, (cmprc-invar) ) }' invar=${zmprc} ${zfile1} >> ${zout} 
106           else
107               # Print: Variable long name | current version values
108               echo "                                 Current version " >> ${zout}
109               awk '/Real/        {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
110               awk '/User/        {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
111               awk '/MFLOPS/ && ! /concurrent/     {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
112               [ ${zrunt} = 'omp' ] && awk '/MFLOPS/ &&   /concurrent/     {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
113               awk '/VLEN/        {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
114               awk '/Memory Size/ {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
115               [ ${zrunt} = 'omp' ] && awk '/Max Concurrent Proc/  { cmprc=$5 ; printf("%-5s %.25s  %10i\n", " ", $0, $NF ) }' ${zfile1} >> ${zout} 
116           fi 
117
118           ;;
119
120     'mpi' )
121           # OUTPUT TIMING OF THE MPI RUN
122           ##############################
123           
124           if [ ${evaltag} == 0 -a ${zxis} == 0 ] ; then
125               # Get reference tag information
126               # Syntax: 1) search pattern between // symbol, 2) print text of the last column (identified by $NF)
127               zreal=$( (awk '( /\[/ && /\]/ ) && /Real/                           {print $NF}' ${zfile2} ) )
128               zuser=$( (awk '( /\[/ && /\]/ ) && /User/                           {print $NF}' ${zfile2} ) )
129               zmflo=$( (awk '( /\[/ && /\]/ ) && /MFLOPS/                         {print $NF}' ${zfile2} ) )
130               zvlen=$( (awk '( /\[/ && /\]/ ) && /Average Vector Length/          {print $NF}' ${zfile2} ) )
131               zmemo=$( (awk '( /\[/ && /\]/ ) && ! /Global/ && /Memory size used/ {print $NF}' ${zfile2} ) )
132           
133               # Print: Variable long name | current version values | reference version values | variations
134               # Syntax: 1) search pattern between // symbol, 2) print text & values following a format (printf) explicited between "" symbol
135               awk '/Global Data/ { printf( "        %.29s  Current version   %s version      Variation \n", $0, tag) }' tag=${ztag} ${zfile1} >> ${zout}
136               awk '/==========================/ { printf("        %s \n", $0) }' ${zfile1} >> ${zout}
137               awk '( /\[/ && /\]/ ) && /Real/                  { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zreal} ${zfile1} >> ${zout}
138               awk '( /\[/ && /\]/ ) && /User/                  { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zuser} ${zfile1} >> ${zout}
139               awk '( /\[/ && /\]/ ) && /MFLOPS/                { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zmflo} ${zfile1} >> ${zout}
140               awk '( /\[/ && /\]/ ) && /Average Vector Length/ { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zvlen} ${zfile1} >> ${zout}
141               awk '( /\[/ && /\]/ ) && /Memory size used/ && !/Global/ { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zmemo} ${zfile1} >> ${zout}
142               echo " " >> ${zout} 
143           
144               # Get reference tag information (Overall data)
145               # Syntax: 1) search pattern between // symbol, 2) print text of the last column (identified by $NF)
146               zreal=$( (awk '!( /\[/ && /\]/ ) && /Real/                           {print $NF}' ${zfile2} ) )
147               zuser=$( (awk '!( /\[/ && /\]/ ) && ! /OPS/ && /User/                {print $NF}' ${zfile2} ) )
148               zgflo=$( (awk '!( /\[/ && /\]/ ) && /GFLOPS/                         {print $NF}' ${zfile2} ) )
149               zmemo=$( (awk '!( /\[/ && /\]/ ) && ! /Global/ && /Memory size used/ {print $NF}' ${zfile2} ) )
150           
151               # Print: Variable long name | current version values
152               # Syntax: 1) search pattern between // symbol, 2) print text & values following a format (printf) explicited between "" symbol
153               awk '/Overall Data/ { printf( "        %-28s  Current version   %s version       Variation \n", $0, tag) }' tag=${ztag} ${zfile1} >> ${zout}
154               echo "        =============" >> ${zout} 
155               awk '!( /\[/ && /\]/ ) && /Real/             { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zreal} ${zfile1} >> ${zout}
156               awk '!( /\[/ && /\]/ ) && ! /OPS/ && /User/  { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zuser} ${zfile1} >> ${zout}
157               awk '!( /\[/ && /\]/ ) && /GFLOPS/           { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zgflo} ${zfile1} >> ${zout}
158               awk '!( /\[/ && /\]/ ) && /Memory size used/ && !/Global/ { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zmemo} ${zfile1} >> ${zout}
159               echo " " >> ${zout} 
160           
161           else
162           
163               # Print: Variable long name | current version values
164               awk '/Global Data/ { printf( "        %.29s   Current version\n ", $0) }' ${zfile1} >> ${zout}
165               awk '/==========================/ { printf("%-7s %-.26s \n", " ", $0) } ' ${zfile1} >> ${zout}
166               awk '( /\[/ && /\]/ ) && /Real/                  { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile1} >> ${zout}
167               awk '( /\[/ && /\]/ ) && /User/                  { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile1} >> ${zout}
168               awk '( /\[/ && /\]/ ) && /MFLOPS/                { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile1} >> ${zout}
169               awk '( /\[/ && /\]/ ) && /Average Vector Length/ { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile1} >> ${zout}
170               awk '( /\[/ && /\]/ ) && /Memory size used/ && ! /Global/ { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile2} >> ${zout}
171               echo " " >> ${zout} 
172           
173               # Print: Variable long name | current version values (Overall data)
174               awk '/Overall Data/ { printf( "        %-28s   Current version\n ", $0 ) }' ${zfile1} >> ${zout}
175               echo "        =============" >> ${zout} 
176               awk '!( /\[/ && /\]/ ) && /Real/             { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF ) }' ${zfile1} >> ${zout}
177               awk '!( /\[/ && /\]/ ) && ! /OPS/ && /User/  { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF ) }' ${zfile1} >> ${zout}
178               awk '!( /\[/ && /\]/ ) && /GFLOPS/           { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF ) }' ${zfile1} >> ${zout}
179               awk '!( /\[/ && /\]/ ) && /Memory size used/  && ! /Global/ { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF ) }' ${zfile1} >> ${zout}
180               echo "" >> ${zout} 
181           fi
182           ;;
183esac
Note: See TracBrowser for help on using the repository browser.