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