/[MITgcm]/MITgcm_contrib/test_scripts/svante/test_svante_pgi_mth
ViewVC logotype

Contents of /MITgcm_contrib/test_scripts/svante/test_svante_pgi_mth

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


Revision 1.15 - (show annotations) (download)
Mon Nov 6 13:35:01 2023 UTC (20 months, 2 weeks ago) by jmc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.14: +3 -1 lines
Add new script to make tar file of output-dir results and
save this backup file after testreport and restart test.

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

  ViewVC Help
Powered by ViewVC 1.1.22