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

Annotation 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.12 - (hide annotations) (download)
Thu Oct 19 14:43:00 2023 UTC (20 months, 4 weeks ago) by jmc
Branch: MAIN
Changes since 1.11: +9 -3 lines
check testreport exit value before running restart test

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

  ViewVC Help
Powered by ViewVC 1.1.22