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_osxxlf.ksh in trunk/VALID/2INSTALL/JOBS – NEMO

source: trunk/VALID/2INSTALL/JOBS/CPU_time_osxxlf.ksh @ 695

Last change on this file since 695 was 695, checked in by ctlod, 17 years ago

NVTK installation

  • Property svn:executable set to *
File size: 11.7 KB
Line 
1#!/bin/ksh
2##############################################################
3# Original : C. Talandier for ESOPA
4# Contact  : opatlod@locean-ipsl.upmc.fr
5#
6# It is called by the assessment.ksh script for a
7# given configuration
8#
9# INPUT ARGS: 6
10#     - zfile1 : mon run timing input file name
11#     - zfile2 : mpi run timing input file name
12#     - zconf  : configuration name
13#     - zout   : output file name
14#     - ztag   : tag name to which are compared files
15#     - zxis   : (0/1) reference timing files (do/do not) exist
16#
17# WORK: It aims to :
18#
19#      - Treat output timing from the sx8brodie target for
20#        mon, mpi & omp runs
21#     *- compare it to a reference version
22#
23# * this step is performed only if a reference tag
24#   is specified with the -t option and if files exist.
25#   See the Makefile under ./config/HEAD directory
26#
27##############################################################
28#set -xv
29##############################################################
30
31# Get the name of the present script
32nscript=$( (basename $0) )
33
34#
35# help_CPU_time() To print help
36#
37function help_CPU_time
38{
39  echo "Usage: $nscript [-r] [-a] [-b] [-c] [-o] [-t] [-x]"
40  echo "Options: These are optional argument"
41  echo " -r : run type to treat"
42  echo " -a : current version timing input file name"
43  echo " -b : reference version timing input file name"
44  echo " -c : configuration 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=
56zconf=
57zout=
58ztag=
59zxis=1
60
61# Get arguments
62while getopts r:a:b:c:o:t:x: opt
63do
64  case "$opt" in
65    r) zrunt="$OPTARG";;
66    a) zfile1="$OPTARG";;
67    b) zfile2="$OPTARG";;
68    c) zconf="$OPTARG";;
69    o) zout="$OPTARG";;
70    t) ztag="$OPTARG";;
71    x) zxis="$OPTARG";;
72    *) help_CPU_time;;
73  esac
74done
75
76# Check if results must be compare to the reference version
77test -n "${ztag}"
78evaltag=$?
79
80case "${zrunt}" in
81
82     'mon' )
83
84           # OUTPUT TIMING OF THE MON/OMP RUN
85           ###################################
86           
87           if [ ${evaltag} == 0 -a ${zxis} == 0 ] ; then
88               # Get values from the reference tag
89               zreal=$( (awk '/Real/        {print $NF}' ${zfile2} ) )
90               zuser=$( (awk '/User/        {print $NF}' ${zfile2} ) )
91               zmflo=$( (awk '/MFLOPS/ && ! /concurrent/      {print $NF}' ${zfile2} ) )
92               [ ${zrunt} = 'omp' ] && zmfli=$( (awk '/MFLOPS/ &&   /concurrent/      {print $NF}' ${zfile2} ) )
93               [ ${zrunt} = 'omp' ] && zmprc=$( (awk '/Max Concurrent Proc/           {print $NF}' ${zfile2} ) )
94               zvlen=$( (awk '/VLEN/        {print $NF}' ${zfile2} ) )
95               zmemo=$( (awk '/Memory Size/ {print $NF}' ${zfile2} ) )
96               # Print: Variable long name | current version values | reference version values | variations
97               echo "                                Current version    ${ztag} version    Variation " >> ${zout}
98               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}
99               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}
100               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}
101               [ ${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}
102               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}
103               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} 
104               [ ${zrunt} = 'omp' ] && awk '/Max Concurrent Proc/  { cmprc=$5 ; printf("%-5s %.25s  %10i      | %10i    |   %7i \n", " ", $0, $NF, invar, (cmprc-invar) ) }' invar=${zmprc} ${zfile1} >> ${zout} 
105           else
106               # Print: Variable long name | current version values
107               echo "                                 Current version " >> ${zout}
108               awk '/Real/        {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
109               awk '/User/        {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
110               awk '/MFLOPS/ && ! /concurrent/     {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
111               [ ${zrunt} = 'omp' ] && awk '/MFLOPS/ &&   /concurrent/     {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
112               awk '/VLEN/        {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
113               awk '/Memory Size/ {printf("%-5s %.25s  %10.2f\n", " ", $0, $NF ) }' ${zfile1} >> ${zout}
114               [ ${zrunt} = 'omp' ] && awk '/Max Concurrent Proc/  { cmprc=$5 ; printf("%-5s %.25s  %10i\n", " ", $0, $NF ) }' ${zfile1} >> ${zout} 
115           fi 
116
117           ;;
118
119     'mpi' )
120           # OUTPUT TIMING OF THE MPI RUN
121           ##############################
122           
123           if [ ${evaltag} == 0 -a ${zxis} == 0 ] ; then
124               # Get reference tag information
125               # Syntax: 1) search pattern between // symbol, 2) print text of the last column (identified by $NF)
126               zreal=$( (awk '( /\[/ && /\]/ ) && /Real/                           {print $NF}' ${zfile2} ) )
127               zuser=$( (awk '( /\[/ && /\]/ ) && /User/                           {print $NF}' ${zfile2} ) )
128               zmflo=$( (awk '( /\[/ && /\]/ ) && /MFLOPS/                         {print $NF}' ${zfile2} ) )
129               zvlen=$( (awk '( /\[/ && /\]/ ) && /Average Vector Length/          {print $NF}' ${zfile2} ) )
130               zmemo=$( (awk '( /\[/ && /\]/ ) && ! /Global/ && /Memory size used/ {print $NF}' ${zfile2} ) )
131           
132               # Print: Variable long name | current version values | reference version values | variations
133               # Syntax: 1) search pattern between // symbol, 2) print text & values following a format (printf) explicited between "" symbol
134               awk '/Global Data/ { printf( "        %.29s  Current version   %s version      Variation \n", $0, tag) }' tag=${ztag} ${zfile1} >> ${zout}
135               awk '/==========================/ { printf("        %s \n", $0) }' ${zfile1} >> ${zout}
136               awk '( /\[/ && /\]/ ) && /Real/                  { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zreal} ${zfile1} >> ${zout}
137               awk '( /\[/ && /\]/ ) && /User/                  { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zuser} ${zfile1} >> ${zout}
138               awk '( /\[/ && /\]/ ) && /MFLOPS/                { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zmflo} ${zfile1} >> ${zout}
139               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}
140               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}
141               echo " " >> ${zout} 
142           
143               # Get reference tag information (Overall data)
144               # Syntax: 1) search pattern between // symbol, 2) print text of the last column (identified by $NF)
145               zreal=$( (awk '!( /\[/ && /\]/ ) && /Real/                           {print $NF}' ${zfile2} ) )
146               zuser=$( (awk '!( /\[/ && /\]/ ) && ! /OPS/ && /User/                {print $NF}' ${zfile2} ) )
147               zgflo=$( (awk '!( /\[/ && /\]/ ) && /GFLOPS/                         {print $NF}' ${zfile2} ) )
148               zmemo=$( (awk '!( /\[/ && /\]/ ) && ! /Global/ && /Memory size used/ {print $NF}' ${zfile2} ) )
149           
150               # Print: Variable long name | current version values
151               # Syntax: 1) search pattern between // symbol, 2) print text & values following a format (printf) explicited between "" symbol
152               awk '/Overall Data/ { printf( "        %-28s  Current version   %s version       Variation \n", $0, tag) }' tag=${ztag} ${zfile1} >> ${zout}
153               echo "        =============" >> ${zout} 
154               awk '!( /\[/ && /\]/ ) && /Real/             { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zreal} ${zfile1} >> ${zout}
155               awk '!( /\[/ && /\]/ ) && ! /OPS/ && /User/  { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zuser} ${zfile1} >> ${zout}
156               awk '!( /\[/ && /\]/ ) && /GFLOPS/           { printf( "%-7s %.29s  %10.2f     |   %10.2f    |    %7.2f %\n", " ", $0 , $NF, invar, (($NF-invar)/invar)*100 ) }' invar=${zgflo} ${zfile1} >> ${zout}
157               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}
158               echo " " >> ${zout} 
159           
160           else
161           
162               # Print: Variable long name | current version values
163               awk '/Global Data/ { printf( "        %.29s   Current version\n ", $0) }' ${zfile1} >> ${zout}
164               awk '/==========================/ { printf("%-7s %-.26s \n", " ", $0) } ' ${zfile1} >> ${zout}
165               awk '( /\[/ && /\]/ ) && /Real/                  { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile1} >> ${zout}
166               awk '( /\[/ && /\]/ ) && /User/                  { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile1} >> ${zout}
167               awk '( /\[/ && /\]/ ) && /MFLOPS/                { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile1} >> ${zout}
168               awk '( /\[/ && /\]/ ) && /Average Vector Length/ { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile1} >> ${zout}
169               awk '( /\[/ && /\]/ ) && /Memory size used/ && ! /Global/ { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF) }' ${zfile2} >> ${zout}
170               echo " " >> ${zout} 
171           
172               # Print: Variable long name | current version values (Overall data)
173               awk '/Overall Data/ { printf( "        %-28s   Current version\n ", $0 ) }' ${zfile1} >> ${zout}
174               echo "        =============" >> ${zout} 
175               awk '!( /\[/ && /\]/ ) && /Real/             { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF ) }' ${zfile1} >> ${zout}
176               awk '!( /\[/ && /\]/ ) && ! /OPS/ && /User/  { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF ) }' ${zfile1} >> ${zout}
177               awk '!( /\[/ && /\]/ ) && /GFLOPS/           { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF ) }' ${zfile1} >> ${zout}
178               awk '!( /\[/ && /\]/ ) && /Memory size used/  && ! /Global/ { printf( "%-7s %.29s  %10.2f \n", " ", $0 , $NF ) }' ${zfile1} >> ${zout}
179               echo "" >> ${zout} 
180           fi
181           ;;
182esac
Note: See TracBrowser for help on using the repository browser.