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

source: trunk/NVTK/INSTALL/JOBS/MEM_size_sx8brodie.ksh @ 1140

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

trunk: NVTK directory re-organization, replace HEAD & VALID names with NVTK and 2INSTALL with INSTALL in scripts, see ticket: #220

  • Property svn:executable set to *
File size: 4.0 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#     - zxcm   : (0/1) mon${zconf}_err file (do/do not) exist"
11#     - zxrs   : (0/1) Ref memory_size.txt file (do/do not) exist"
12#     - zxrm   : (0/1) Ref mon${zconf}_err file (do/do not) exist"
13#     - zconf  : configuration name"
14#     - zout   : output file name"
15#     - ztag   : tag name to which are compared files"
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/NVTK 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 [-a] [-b] [-d] [-c] [-o] [-t]"
40  echo "Options: These are optional argument"
41  echo " -a : (0/1) mon${zconf}_err file (do/do not) exist"
42  echo " -b : (0/1) Ref memory_size.txt file (do/do not) exist"
43  echo " -d : (0/1) Ref mon${zconf}_err file (do/do not) exist"
44  echo " -c : configuration name"
45  echo " -o : output file name"
46  echo " -t : tag name to which are compared files"
47  echo " their values are not taken)"
48  exit 1
49}
50
51# Initialization
52zxcm=1
53zxrs=1
54zxrm=1
55zconf=
56zout=
57ztag=
58
59# Get arguments
60while getopts a:b:d:c:o:t: opt
61do
62  case "$opt" in
63    a) zxcm="$OPTARG";;
64    b) zxrs="$OPTARG";;
65    d) zxrm="$OPTARG";;
66    c) zconf="$OPTARG";;
67    o) zout="$OPTARG";;
68    t) ztag="$OPTARG";;
69    *) help_MEM_size;;
70  esac
71done
72
73# Check if results must be compared to the reference version
74test -n "${ztag}"
75evaltag=$?
76
77zfilecs='mon/LONG/memory_size.txt' ;  zfilers='mon/LONG/REF/memory_size.txt'
78zfilecm="mon/LONG/mon${zconf}_err"  ;  zfilerm="mon/LONG/REF/mon${zconf}_err"
79
80# If reference version files exist
81if [ ${evaltag} == 0 -a ${zxrm} == 0 ] ;  then
82    # Get values from the reference tag
83    Mo_stack_ms=$( (awk '/Stack/ {print $NF/(1024*1024) }' ${zfilers} ) )
84    Mo_stati_ms=$( (awk '/Stati/ {print $NF/(1024*1024) }' ${zfilers} ) )
85    if [ ${zxcm} == 0 ] ; then Mo_max_used=$( (awk '/Memory/ {print $NF}' ${zfilerm} ) ) ; fi
86
87    # Print: Variable long name | current version values | reference version values | variations
88    echo "                                                 " >> ${zout}
89    echo "                                      Version    " >> ${zout}
90    echo "             Memory          Current /       \ ${ztag}        Variation " >> ${zout}
91    awk ' /Stack/ { val=$NF/(1024*1024) } END {printf("%-9s %-16s %8.1f      |   %8.1f     |    %5.1f %\n ", " ", "Stack     (Mo) :", val, inck, ((val-inck)/inck)*100 ) }' inck=${Mo_stack_ms} ${zfilecs} >> ${zout}
92    awk ' /Stati/ { val=$NF/(1024*1024) } END {printf("%-8s %-16s %8.1f      |   %8.1f     |    %5.1f %\n ", " ", "Static    (Mo) :", val, inti, ((val-inti)/inti)*100 ) }' inti=${Mo_stati_ms} ${zfilecs} >> ${zout}
93    if [ ${zxcm} == 0 ] ; then awk ' /Memory/ { val=$NF } END {printf("%-8s %-16s %8.1f      |   %8.1f     |    %5.1f %\n ", " ", "Max. used (Mo) :", val, inus, ((val-inus)/inus)*100 ) }' inus=${Mo_max_used} ${zfilecm} >> ${zout} ; fi
94else
95    # Print: Variable long name | current version values
96    echo "                                                 " >> ${zout}
97    echo "             Memory          Current version "     >> ${zout}
98    awk ' /Stack/  {printf("%-9s %-.16s %11.1f\n ", " ", "Stack     (Mo) :", $NF/(1024*1024) ) }' ${zfilecs} >> ${zout}
99    awk ' /Stati/  {printf("%-8s %-.16s %11.1f\n ", " ", "Static    (Mo) :", $NF/(1024*1024) ) }' ${zfilecs} >> ${zout}
100    if [ ${zxcm} == 0 ] ; then awk ' /Memory/   {printf("%-8s %-.16s %11.1f\n ", " ", "Max. used (Mo) :", $NF ) }' ${zfilecm} >> ${zout} ; fi
101fi
Note: See TracBrowser for help on using the repository browser.