/[MITgcm]/MITgcm_contrib/jmc_script/tst1+1
ViewVC logotype

Contents of /MITgcm_contrib/jmc_script/tst1+1

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download)
Sun Nov 4 20:11:07 2007 UTC (17 years, 8 months ago) by jmc
Branch: MAIN
Changes since 1.10: +49 -22 lines
improve where to find additional scripts.

1 #!/bin/sh
2
3 # $Header: /u/gcmpack/MITgcm_contrib/jmc_script/tst1+1,v 1.10 2007/10/29 23:18:18 jmc Exp $
4 # $Name: $
5
6 #- uses scripts in the path (1rst) or if not in the path, from dScript directory:
7 dScript=../../../../MITgcm_contrib/jmc_script
8
9 #- input :
10 # 1) data.tst = parameter file "data" for 2.Nit iter run
11 # 2) here or in dir temp : pickup(_cd).0..0{num0}.001.001.data
12
13 NbArg=$#
14 if test -r data.tst ; then
15 # Nit = Nb of iter of 2nd & 3rd run (1rst one is 2 x Nit iter long)
16 Dbl=`sed -n 's/nTimeSteps=//p' data.tst | sed 's/,//g'`
17 Nit=`expr $Dbl / 2`
18 else
19 echo '=> Need a readable "data.tst" file for the 2 x Nit iterations run'
20 Nit=2 ; NbArg=0;
21 fi
22
23 case $NbArg in
24 1) ;;
25 *) echo "Usage: `basename $0` flag"
26 echo " Check restart: compare 1 run of 2 x $Nit it long"
27 echo " with 2 consecutive runs of $Nit it long each"
28 echo " where: flag = 1 -> do the 3 runs"
29 echo " flag = 2 -> compare std_outp"
30 echo " flag = 3 -> compare pickup files"
31 exit ;;
32 esac
33 flag=$1
34
35 num0=`sed -n 's/nIter0=//p' data.tst | sed 's/,//g' | sed 's/ //g'`
36 #num0="72000"
37
38 # list of pickup(s) that are needed for a restart :
39 #listP='pickup pickup_cd pickup_nh pickup_ic pickup_land pickup_seaice'
40
41 #- executable:
42 mpi=0
43 if [ $mpi -ge 1 ]
44 then gcmExc=run_ifc_mpi
45 else gcmExc=mitgcmuv
46 fi
47
48 #- dir where to put the results :
49 dir1=res_2it
50 dir2=res_1iA
51 dir3=res_1iB
52
53 #---------------------------
54 # find where the 3 little scripts are:
55
56 #export PATH=${PATH}:$HOME/MITgcm_contrib/jmc_script
57
58 if test -d $dScript ; then : ; else echo 'dScript='$dScript 'is not a directory' ; fi
59
60 ff=rnp ;
61 RNPs=`which $ff 2> /dev/null`
62 if test "x$RNPs" = x -a -x $dScript/$ff ; then RNPs=$dScript/$ff ; fi
63 if test "x$RNPs" != x ; then RNPs=$RNPs" -s" ; fi
64 ff=add0upto10c ;
65 P10c=`which $ff 2> /dev/null`
66 if test "x$P10c" = x -a -x $dScript/$ff ; then P10c=$dScript/$ff ; fi
67 ff=dif_data ;
68 DIFd=`which $ff 2> /dev/null`
69 if test "x$DIFd" = x -a -x $dScript/$ff ; then DIFd=$dScript/$ff ; fi
70 echo " use script: P10c='$P10c'"
71 echo " RNPs='$RNPs'"
72 echo " and DIFd='$DIFd'"
73 if test "x$RNPs" = x -o "x$P10c" = x -o "x$DIFd" = x
74 then echo 'missing some scripts' ; exit ; fi
75 #---------------------------
76 Dbl=`expr $Nit + $Nit`
77 num1=`expr $num0 + $Nit`
78 num2=`expr $num0 + $Dbl`
79 num0c=`$P10c $num0`
80 num1c=`$P10c $num1`
81 num2c=`$P10c $num2`
82 echo $num0 $num1 $num2
83 echo $num0c $num1c $num2c
84 echo 'gcmExc='$gcmExc
85 # exit
86 #---------------------------
87
88 if test $flag = 1 ; then
89 #------------
90 if test -d $dir1 -o -d $dir2 -o -d $dir3
91 then echo -n 'remove dir: '
92 if test -d $dir1 ; then echo -n $dir1 ' , ' ; rm -r $dir1 ; fi
93 if test -d $dir2 ; then echo -n $dir2 ' , ' ; rm -r $dir2 ; fi
94 if test -d $dir3 ; then echo -n $dir3 ' , ' ; rm -r $dir3 ; fi
95 echo ' '
96 fi
97 mkdir $dir1 $dir2 $dir3
98 rm -f STDERR.0000
99
100 cp -p data.tst data
101 numF=`ls temp/pickup*.${num0c}* 2> /dev/null | grep -c pickup`
102 if test $numF != 0 ; then ln -s temp/pickup*.${num0c}* . 2> /dev/null ; fi
103 echo '==> START RUN 2 x' $Nit 'it'
104 if [ $mpi -ge 1 ]
105 then ./$gcmExc std_outp.2it > TTT.out.2it 2>&1
106 else ./$gcmExc > std_outp.2it
107 fi
108 mv STDERR.0000 std__err.2it
109 if test -f pickup.ckptA.001.001.data
110 then out=`egrep -c 'STOP ABNORMAL END' std_outp.2it`
111 else out=9 ; fi
112 if test $out != 0 ; then echo 'RUN 2it STOP before END => exit' ; exit ; fi
113 echo '==> END RUN 2 x' $Nit 'it'
114 listP=`ls pickup*.ckptA* | sed 's/\..*//g' | uniq`
115 echo ' listP=' $listP
116 for xx in $listP
117 do
118 $RNPs $xx.ckptA $xx.$num2c
119 done
120 mv *.0??.0??.* $dir1
121 txtF=`ls -1 *.txt 2> /dev/null`
122 mv R?.data R?.meta DR?.data DR?.meta $txtF $dir1
123 listS=`ls $dir1/pickup*.${num0c}* 2> /dev/null | head -1`
124 if test "x$listS" != x ; then mv $dir1/pickup*.${num0c}* . ; fi
125 #--
126 sed "s/^ nTimeSteps=$Dbl/ nTimeSteps=$Nit/g" data.tst > data
127 echo '==> START RUN 1iA'
128 if [ $mpi -ge 1 ]
129 then ./$gcmExc std_outp.1iA > TTT.out.1iA 2>&1
130 else ./$gcmExc > std_outp.1iA
131 fi
132 mv STDERR.0000 std__err.1iA
133 if test -f pickup.ckptA.001.001.data
134 then out=`egrep -c 'STOP ABNORMAL END' std_outp.1iA`
135 else out=9 ; fi
136 if test $out != 0 ; then echo 'RUN 1iA STOP before END => exit' ; exit ; fi
137 echo '==> END RUN 1iA'
138 for xx in $listP
139 do
140 $RNPs $xx.ckptA $xx.$num1c
141 done
142 mv *.0??.0??.* $dir2
143 txtF=`ls -1 *.txt 2> /dev/null`
144 mv R?.data R?.meta DR?.data DR?.meta $txtF $dir2
145 listS=`ls $dir2/pickup*.${num0c}* 2> /dev/null | head -1`
146 if test "x$listS" != x ; then rm $dir2/pickup*.${num0c}* ; fi
147 #--
148 ln -s $dir2/pickup*.$num1c.* .
149 sed "s/^ nIter0=$num0/ nIter0=$num1/g" data > data.tmp
150 mv -f data.tmp data
151 echo '==> START RUN 1iB'
152 if [ $mpi -ge 1 ]
153 then ./$gcmExc std_outp.1iB > TTT.out.1iB 2>&1
154 else ./$gcmExc > std_outp.1iB
155 fi
156 mv STDERR.0000 std__err.1iB
157 if test -f pickup.ckptA.001.001.data
158 then out=`egrep -c 'STOP ABNORMAL END' std_outp.1iB`
159 else out=9 ; fi
160 if test $out != 0 ; then echo 'RUN 1iB STOP before END => exit' ; exit ; fi
161 echo '==> END RUN 1iB'
162 for xx in $listP
163 do
164 $RNPs $xx.ckptA $xx.$num2c
165 done
166 mv *.0??.0??.* $dir3
167 txtF=`ls -1 *.txt 2> /dev/null`
168 mv R?.data R?.meta DR?.data DR?.meta $txtF $dir3
169 rm $dir3/pickup*.$num1c.*
170 exit
171 #------------
172 fi
173
174 if test $flag = 2 ; then
175 #------------
176 echo ' ' ; echo '-- compare cg2d_init_res :'
177 echo ' run 1iA:'
178 grep "cg2d_init_res" std_outp.1iA \
179 | sed 's/.* cg2d_init_res =//'
180 echo ' run 1iB:'
181 grep "cg2d_init_res" std_outp.1iB \
182 | sed 's/.* cg2d_init_res =//'
183 echo ' run 2it:'
184 grep "cg2d_init_res" std_outp.2it \
185 | sed 's/.* cg2d_init_res =//'
186 exit
187 #------------
188 fi
189
190 if test $flag = 3 ; then
191 #------------
192 listP=`( cd $dir1 ; ls pickup*.$num2c* | sed 's/\..*//g' | uniq )`
193 for xx in $listP
194 do
195 $DIFd $dir1 $dir3 $xx.$num2c
196 done
197 exit
198 #------------
199 fi

  ViewVC Help
Powered by ViewVC 1.1.22