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

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