/[MITgcm]/MITgcm_contrib/test_scripts/engaging/test_engag_gfo_adm
ViewVC logotype

Contents of /MITgcm_contrib/test_scripts/engaging/test_engag_gfo_adm

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


Revision 1.14 - (show annotations) (download)
Sat Dec 30 16:55:12 2023 UTC (18 months, 2 weeks ago) by jmc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +6 -6 lines
print time few more times

1 #!/bin/bash
2 #SBATCH -J gfoAdm_tst
3 #SBATCH -p sched_mit_hill
4 #SBATCH -t 11:50:00
5 #SBATCH --mem-per-cpu 4000
6 #SBATCH -N 2
7 # #SBATCH --exclusive
8 #SBATCH --tasks-per-node 16
9 # #SBATCH -x node235
10 #SBATCH -x node[095,122]
11 #SBATCH -e /home/jm_c/test_engaging/output/gfoAdm_tst.stderr
12 #SBATCH -o /home/jm_c/test_engaging/output/gfoAdm_tst.stdout
13 #SBATCH --no-requeue
14
15 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_engag_gfo_adm,v 1.13 2023/11/06 14:23:01 jmc Exp $
16 # $Name: $
17
18 if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi
19 # Note: added "ulimit -s unlimited" in file "~/.bashrc"
20 # to pass big test (the 2 fizhi-cs-* test & adjoint tests) with MPI
21
22 umask 0022
23 #- to get case insensitive "ls" (and order of tested experiments)
24 export LC_ALL="en_US.UTF-8"
25 echo " running on: "`hostname`
26 headNode='eofe8'
27
28 dNam='engaging'
29 HERE="$HOME/test_${dNam}"
30 OUTP="$HERE/output"; SavD="$HERE/send"
31 SEND="ssh $headNode $SavD/mpack"
32 TST_DIR="/pool001/jm_c/test_$dNam"
33 tmpFil="/tmp/"`basename $0`".$$"
34 cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
35 #- which GitHub repository to use and how to access it:
36 git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other'
37 #git_repo='altMITgcm'; #git_code='MITgcm66h'
38 #--
39 git_repo="https://github.com/$git_repo"
40 #git_repo="git://github.com/$git_repo"
41 #git_repo="git@github.com:$git_repo"
42
43 dblTr=0 ; typ='' ; addExp='' ; skipExp=''
44 sfx='gfoAdm'; typ='-adm' ; dblTr=1
45 addExp="$addExp global_oce_cs32 global_oce_llc90"
46 module add slurm
47 module add gcc
48 module add mvapich2/gcc/64/2.0b
49 #module add openmpi/gcc
50 export MPI_INC_DIR="$MPI_HOME/include"
51 #- for NetCDF:
52 module add harvard/centos6/hdf5-1.8.11_gcc-4.4.7
53 module add harvard/centos6/netcdf-4.3.0_gcc-4.4.7
54 OPTFILE="../tools/build_options/linux_amd64_gfortran"
55 options="$typ -MPI 32"
56 ulimit -s unlimited
57 #- need this to get "staf":
58 export PATH="$PATH:$HOME/bin"
59
60 gcmDIR="MITgcm_$sfx"
61 dAlt=`date +%d` ; dAlt=`expr $dAlt % 3`
62 if [ $dAlt -eq 1 ] ; then options="$options -fast"
63 else options="$options -devel" ; fi
64 if test "x$skipExp" != x ; then skipExp=`echo $skipExp | sed 's/^ *//'` ; fi
65
66 checkOut=1 ; #options="$options -do"
67 #options="$options -nc" ; checkOut=1
68 #options="$options -q" ; checkOut=0 ; dblTr=0
69 # dblTr=-1 #- skip testreport completely (only run "do_tst_2+2")
70
71 if test -d $TST_DIR ; then
72 echo "start from TST_DIR='$TST_DIR' at: "`date`
73 else
74 #if test ! -d $TST_DIR ; then mkdir $TST_DIR ; fi
75 #if test ! -d $TST_DIR ; then
76 # echo "ERROR: Can't create directory \"$TST_DIR\""
77 # exit 1
78 #fi
79 #echo "start in new dir TST_DIR='$TST_DIR' at: "`date`
80 echo "ERROR: missing directory \"$TST_DIR\""
81 exit 1
82 fi
83 cd $TST_DIR
84 pwd
85 df .
86
87 NSLOTS=$SLURM_NTASKS
88 THEDATE=`date`
89 echo '********************************************************************************'
90 echo 'Start job '$THEDATE
91 echo 'NSLOTS = '$NSLOTS
92 echo '======= NODELIST ==============================================================='
93 echo $SLURM_NODELIST
94 cat /etc/redhat-release
95 echo '======= env ===================================================================='
96 env | grep SLURM
97 echo '======= modules ================================================================'
98 module list 2>&1
99 echo '================================================================================'
100
101 #- check for disk space: relative space (99%) or absolute (10.G):
102 dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'`
103 if [ $dsp -gt 99 ] ; then
104 #dsp=`df -P . | tail -1 | awk '{print $4}'`
105 #if [ $dsp -le 100000000 ] ; then
106 echo 'Not enough space on this disk => do not run testreport.'
107 df .
108 exit
109 fi
110 if [ $checkOut -eq 1 ] ; then
111 if test ! -e $gcmDIR/.git/config ; then
112 echo "no file: $gcmDIR/.git/config => try to download a fresh clone"
113 checkOut=2
114 fi
115 if test "x$addExp" != x ; then
116 if test ! -e $gcmDIR/$git_other/.git/config ; then
117 echo "no file: $gcmDIR/$git_other/.git/config => try a fresh clone"
118 checkOut=2
119 fi
120 fi
121 fi
122 if [ $checkOut -eq 1 ] ; then
123 echo "cleaning output from $gcmDIR/verification @ "`date +"%H:%M:%S"`" :"
124 #- remove previous output tar files and tar & remove previous output-dir
125 /bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz
126 ( cd $gcmDIR/verification
127 listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null`
128 for dd in $listD
129 do
130 if test -d $dd ; then
131 tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd
132 retVal=$?
133 if test "x$retVal" != x0 ; then
134 echo "ERROR in tar+gzip prev outp-dir: $dd"
135 echo " on '"`hostname`"' (return val=$retVal) but continue"
136 fi
137 fi
138 done )
139 echo "clean testreport output"
140 # echo "clean tst_2+2 + testreport output (+ Makefile_syntax files)"
141 # ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean )
142 ( cd $gcmDIR/verification ; ./testreport $typ -clean )
143 if test "x$addExp" != x ; then
144 ( cd $gcmDIR/verification
145 listD=`ls -o | grep '^l' | awk '{print $8}' 2> /dev/null`
146 echo " + remove local links: $listD"
147 /bin/rm -f $listD
148 )
149 fi
150 echo "Update $git_code code in dir $gcmDIR @ "`date +"%H:%M:%S"`" :"
151 ( cd $gcmDIR ; git pull ) 2>&1
152 retVal=$?
153 if test "x$retVal" != x0 ; then
154 echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
155 exit
156 fi
157 echo " and checkout master @ "`date +"%H:%M:%S"`" :"
158 ( cd $gcmDIR ; git checkout master -- . ) 2>&1
159 if test "x$addExp" != x ; then
160 echo "Update $git_other code in dir $gcmDIR/$git_other @ "`date +"%H:%M:%S"`" :"
161 ( cd $gcmDIR/$git_other ; git pull ) 2>&1
162 retVal=$?
163 if test "x$retVal" != x0 ; then
164 echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
165 exit
166 fi
167 echo " and checkout master @ "`date +"%H:%M:%S"`" :"
168 ( cd $gcmDIR/$git_other ; git checkout master -- . ) 2>&1
169 fi
170 fi
171
172 if [ $checkOut -eq 2 ] ; then
173 if test -e $gcmDIR ; then
174 echo -n "Removing working copy: $gcmDIR ..."
175 rm -rf $gcmDIR
176 echo " done"
177 fi
178 echo "Make a clone of $git_code from repo: $git_repo ..."
179 git clone $git_repo/${git_code}.git $gcmDIR 2> $tmpFil
180 retVal=$?
181 if test $retVal = 0 ; then
182 echo ' done' ; rm -f $tmpFil
183 else
184 echo " Error: 'git clone' returned: $retVal"
185 cat $tmpFil ; rm -f $tmpFil
186 exit
187 fi
188 if test "x$addExp" != x ; then
189 echo "Make a clone of $git_other from repo: $git_repo ..."
190 ( cd $gcmDIR ; git clone $git_repo/${git_other}.git 2> $tmpFil )
191 retVal=$?
192 if test $retVal = 0 ; then
193 echo ' done' ; rm -f $tmpFil
194 else
195 echo " Error: 'git clone' returned: $retVal"
196 cat $tmpFil ; rm -f $tmpFil
197 exit
198 fi
199 fi
200 if test -d $gcmDIR/verification ; then
201 /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs
202 /usr/bin/find $gcmDIR -type f | xargs chmod g+r
203 fi
204 fi
205
206 #- change dir to $gcmDIR/verification + add link for additional experiments:
207 if test -e $gcmDIR/verification ; then
208 if [ $checkOut -lt 2 ] ; then
209 echo " dir $gcmDIR/verification exist" ; fi
210 cd $gcmDIR/verification
211 for exp2add in $addExp ; do
212 test -r $exp2add && /bin/rm -rf $exp2add
213 if test -d ../$git_other/$exp2add ; then
214 echo " add $exp2add link from $git_other"
215 ln -s ../$git_other/$exp2add .
216 if test $exp2add = 'global_oce_cs32' ; then
217 echo " link dir 'other_input/core2_cnyf' in here"
218 ( cd ../${git_other}/${exp2add}
219 test -L core2_cnyf && /bin/rm -f core2_cnyf
220 ln -s ../../../other_input/core2_cnyf . )
221 fi
222 if test $exp2add = 'global_oce_llc90' ; then
223 echo " link dir 'other_input/gael_oce_llc90_input' to 'input_fields'"
224 ( cd ../${git_other}/${exp2add}
225 test -L input_fields && /bin/rm -f input_fields
226 ln -s ../../../other_input/gael_oce_llc90_input input_fields
227 echo " link dirs: 'core2_cnyf' & 'global_oce_input_fields/*' in input_verifs"
228 test ! -e input_verifs && mkdir input_verifs
229 ( cd input_verifs ; /bin/rm -f *
230 ln -s ../../../../other_input/core2_cnyf .
231 ln -s ../../../../other_input/global_oce_input_fields/* . )
232 )
233 fi
234 else
235 echo " missing dir: $git_other/$exp2add"
236 continue
237 fi
238 done
239 else
240 echo "no dir: $gcmDIR/verification => exit"
241 exit
242 fi
243
244 if [ $dblTr -eq 1 ] ; then
245 echo ''
246 #- 1) just compile ("-nr"), using "-j 4" to speed up
247 echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
248 -j 4 -nr -odir ${dNam}-$sfx
249 ./testreport $options -of $OPTFILE -skd "$skipExp" \
250 -j 4 -nr -odir ${dNam}-$sfx
251 options="$options -q"
252 fi
253
254 if [ $dblTr -ge 0 ] ; then
255 echo ''
256 #- 2) run and report results ; also finish to compile those who failed with "-j"
257 echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \
258 -odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org
259 ./testreport $options -of $OPTFILE -skd "$skipExp" \
260 -odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org
261 retVal=$?
262 else retVal=0 ; fi
263
264 if test "x$retVal" != x0 ; then
265 echo "<== testreport returned retVal=${retVal}, expecting 0"
266 # echo " -> skip restart test 'do_tst_2+2'"
267 #else
268 # echo ''
269 #- 3) test restart and report results
270 # echo ../tools/do_tst_2+2 -mpi \
271 # -o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org
272 # ../tools/do_tst_2+2 -mpi \
273 # -o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org
274 fi

  ViewVC Help
Powered by ViewVC 1.1.22