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.
chk_wrk_alloc.sh in branches/UKMO/dev_r5107_hadgem3_cplseq/NEMOGCM/TOOLS/MISCELLANEOUS – NEMO

source: branches/UKMO/dev_r5107_hadgem3_cplseq/NEMOGCM/TOOLS/MISCELLANEOUS/chk_wrk_alloc.sh @ 5476

Last change on this file since 5476 was 3294, checked in by rblod, 12 years ago

Merge of 3.4beta into the trunk

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/bin/bash
2#
3# purpose:
4#   small script to check in all *90 files of the current directory and subdirectories
5#   if all lines with wrk_alloc have their corresponding lines with wrk_dealloc
6#
7# use:
8#   call chk_wrk_alloc.sh from the directory you want to check
9#
10# example:
11#   cd ~/dev_NEMO_MERGE_2011/NEMOGCM/NEMO
12#   ../TOOLS/MISCELLANEOUS/chk_wrk_alloc.sh
13#
14set -ue
15#
16echo "check for all *90 files contained in "$( pwd )" and its subdirectories"
17#
18for ff in $( grep -il wrk_nemo_2 $( find . -name "*90" ) )
19do
20
21    # number of lines with wrk_alloc
22    n1=$( grep -ic "call *wrk_alloc *(" $ff ) 
23    # replace wrk_alloc with wrk_dealloc and count the lines
24    n2=$( sed -e "s/wrk_alloc/wrk_dealloc/" $ff | grep -ic "call *wrk_dealloc *(" )
25    # we should get n2 = 2 * n1...
26    [ $(( 2 * $n1 )) -ne $n2 ] && echo "problem with wrk_alloc in $ff" 
27   
28    # same story but for wrk_dealloc
29    n1=$( grep -ic "call *wrk_dealloc *(" $ff ) 
30    n2=$( sed -e "s/wrk_dealloc/wrk_alloc/" $ff | grep -ic "call *wrk_alloc *(" )
31    [ $(( 2 * $n1 )) -ne $n2 ] && echo "problem with wrk_dealloc in $ff" 
32   
33done
Note: See TracBrowser for help on using the repository browser.