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

source: trunk/NVTK/INSTALL/JOBS/MEM_size_osxxlf.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: 3.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#     - zmxcu  : (0/1) mon${CONF}_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${CONF}_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 osxxlf target for
20#        mon, mpi 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${CONF}_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${CONF}_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
52zmxcu=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) zmxcu="$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'
78zfilers='mon/LONG/REF/memory_size.txt'
79
80# Select only appropriate lines
81grep -v Stack ${zfilecs} | head -1 > temp_cs_sck
82tail -1 ${zfilecs}                 > temp_cs_sic
83
84# Select only appropriate lines
85grep -v Stack ${zfilers} | head -1 > temp_rs_sck
86tail -1 ${zfilers}                 > temp_rs_sic
87
88# If reference version files exist
89if [ ${evaltag} == 0 -a ${zxrs} == 0 ] ;  then
90    # Get values from the reference tag
91    Mo_stack_ms=$( (awk '{print $5/(1024*1024) }' temp_rs_sck ) )
92    Mo_stati_ms=$( (awk '{print $5/(1024*1024) }' temp_rs_sic ) )
93
94    # Print: Variable long name | current version values | reference version values | variations
95    echo "                                                 " >> ${zout}
96    echo "                                      Version    " >> ${zout}
97    echo "             Memory          Current /       \ ${ztag}        Variation " >> ${zout}
98    awk ' { val=$5/(1024*1024) } {printf("%-9s %-16s %8.1f      |   %8.1f     |    %5.1f \n ", " ", "Stack     (Mo) :", val, inck, ((val-inck)/inck)*100 ) }' inck=${Mo_stack_ms} temp_cs_sck >> ${zout}
99    awk ' { val=$5/(1024*1024) } {printf("%-8s %-16s %8.1f      |   %8.1f     |    %5.1f \n ", " ", "Static    (Mo) :", val, inti, ((val-inti)/inti)*100 ) }' inti=${Mo_stati_ms} temp_cs_sic >> ${zout}
100else
101    # Print: Variable long name | current version values
102    echo "                                                 " >> ${zout}
103    echo "             Memory          Current version "     >> ${zout}
104    awk ' {printf("%-9s %-.16s %11.1f\n ", " ", "Stack     (Mo) :", $5/(1024*1024) ) }' temp_cs_sck >> ${zout}
105    awk ' {printf("%-8s %-.16s %11.1f\n ", " ", "Static    (Mo) :", $5/(1024*1024) ) }' temp_cs_sic >> ${zout}
106fi
107
Note: See TracBrowser for help on using the repository browser.