1 |
jmc |
1.1 |
#!/bin/bash |
2 |
jmc |
1.13 |
#SBATCH -J gfoTlm_tst |
3 |
jmc |
1.1 |
#SBATCH -p sched_mit_hill |
4 |
|
|
#SBATCH --mem-per-cpu 4000 |
5 |
|
|
#SBATCH -n 6 |
6 |
|
|
#SBATCH -N 2 |
7 |
jmc |
1.19 |
#SBATCH -x node[360,365] |
8 |
jmc |
1.13 |
#SBATCH -e /home/jm_c/test_engaging/output/gfoTlm_tst.stderr |
9 |
|
|
#SBATCH -o /home/jm_c/test_engaging/output/gfoTlm_tst.stdout |
10 |
jmc |
1.18 |
#SBATCH --no-requeue |
11 |
|
|
#SBATCH --constraint=centos6 |
12 |
jmc |
1.1 |
|
13 |
jmc |
1.19 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_engag_gfo_tlm,v 1.18 2020/12/23 15:48:53 jmc Exp $ |
14 |
jmc |
1.1 |
# $Name: $ |
15 |
|
|
|
16 |
|
|
if test -f /etc/profile.d/modules.sh ; then |
17 |
|
|
. /etc/profile.d/modules.sh |
18 |
|
|
fi |
19 |
jmc |
1.3 |
# Note: added "ulimit -s unlimited" in file "~/.bashrc" |
20 |
jmc |
1.1 |
# 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 |
|
|
|
27 |
|
|
dNam='engaging' |
28 |
|
|
HERE="$HOME/test_$dNam" |
29 |
|
|
OUTP="$HERE/output"; SavD="$HERE/send" |
30 |
|
|
SEND="ssh eofe4 $SavD/mpack" |
31 |
|
|
TST_DIR="/pool001/jm_c/test_$dNam" |
32 |
jmc |
1.11 |
tmpFil="/tmp/"`basename $0`".$$" |
33 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
34 |
jmc |
1.13 |
#- which GitHub repository to use and how to access it: |
35 |
jmc |
1.17 |
git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other' |
36 |
jmc |
1.11 |
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
37 |
jmc |
1.13 |
#-- |
38 |
|
|
git_repo="https://github.com/$git_repo" |
39 |
|
|
#git_repo="git://github.com/$git_repo" |
40 |
|
|
#git_repo="git@github.com:$git_repo" |
41 |
jmc |
1.1 |
|
42 |
jmc |
1.20 |
dblTr=0 ; typ='' ; addExp='' ; skipExp='' |
43 |
|
|
sfx='gfoTlm'; typ='-tlm' ; dblTr=1 |
44 |
jmc |
1.7 |
module add slurm |
45 |
jmc |
1.1 |
module add gcc |
46 |
jmc |
1.7 |
module add mvapich2/gcc/64/2.0b |
47 |
|
|
#module add openmpi/gcc |
48 |
jmc |
1.1 |
export MPI_INC_DIR="$MPI_HOME/include" |
49 |
jmc |
1.2 |
#- for NetCDF: |
50 |
|
|
module add harvard/centos6/hdf5-1.8.11_gcc-4.4.7 |
51 |
|
|
module add harvard/centos6/netcdf-4.3.0_gcc-4.4.7 |
52 |
jmc |
1.1 |
OPTFILE="../tools/build_options/linux_amd64_gfortran" |
53 |
|
|
options="$typ -MPI 6" |
54 |
|
|
ulimit -s unlimited |
55 |
|
|
#- need this to get "staf": |
56 |
|
|
export PATH="$PATH:$HOME/bin" |
57 |
|
|
|
58 |
jmc |
1.11 |
gcmDIR="MITgcm_$sfx" |
59 |
jmc |
1.1 |
dAlt=`date +%d` ; dAlt=`expr $dAlt % 3` |
60 |
|
|
if [ $dAlt -eq 1 ] ; then options="$options -fast" |
61 |
|
|
else options="$options -devel" ; fi |
62 |
|
|
|
63 |
jmc |
1.3 |
checkOut=1 ; #options="$options -do" |
64 |
jmc |
1.1 |
#options="$options -nc" ; checkOut=1 |
65 |
jmc |
1.20 |
#options="$options -q" ; checkOut=0 ; dblTr=0 |
66 |
jmc |
1.1 |
|
67 |
jmc |
1.11 |
if test -d $TST_DIR ; then |
68 |
|
|
echo "start from TST_DIR='$TST_DIR' at: "`date` |
69 |
|
|
else |
70 |
|
|
#if test ! -d $TST_DIR ; then mkdir $TST_DIR ; fi |
71 |
|
|
#if test ! -d $TST_DIR ; then |
72 |
|
|
# echo "ERROR: Can't create directory \"$TST_DIR\"" |
73 |
|
|
# exit 1 |
74 |
|
|
#fi |
75 |
|
|
#echo "start in new dir TST_DIR='$TST_DIR' at: "`date` |
76 |
|
|
echo "ERROR: missing directory \"$TST_DIR\"" |
77 |
|
|
exit 1 |
78 |
|
|
fi |
79 |
|
|
cd $TST_DIR |
80 |
|
|
pwd |
81 |
jmc |
1.19 |
df . |
82 |
jmc |
1.11 |
|
83 |
jmc |
1.1 |
NSLOTS=$SLURM_NTASKS |
84 |
jmc |
1.2 |
THEDATE=`date` |
85 |
jmc |
1.1 |
echo '********************************************************************************' |
86 |
|
|
echo 'Start job '$THEDATE |
87 |
|
|
echo 'NSLOTS = '$NSLOTS |
88 |
|
|
echo '======= NODELIST ===============================================================' |
89 |
|
|
echo $SLURM_NODELIST |
90 |
jmc |
1.4 |
cat /etc/redhat-release |
91 |
jmc |
1.1 |
echo '======= env ====================================================================' |
92 |
jmc |
1.2 |
env | grep SLURM |
93 |
|
|
echo '======= modules ================================================================' |
94 |
|
|
module list 2>&1 |
95 |
jmc |
1.1 |
echo '================================================================================' |
96 |
|
|
|
97 |
|
|
#- keep a copy of MPI_MFILE: |
98 |
|
|
#cp -p $PBS_NODEFILE $OUTP"/mf_"$sfx |
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 |
jmc |
1.15 |
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 |
jmc |
1.1 |
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 |
jmc |
1.11 |
retVal=$? |
132 |
|
|
if test "x$retVal" != x0 ; then |
133 |
jmc |
1.1 |
echo "ERROR in tar+gzip prev outp-dir: $dd" |
134 |
jmc |
1.11 |
echo " on '"`hostname`"' (return val=$retVal) but continue" |
135 |
jmc |
1.1 |
fi |
136 |
|
|
fi |
137 |
|
|
done ) |
138 |
|
|
# ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
139 |
|
|
( cd $gcmDIR/verification ; ./testreport $typ -clean ) |
140 |
jmc |
1.15 |
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 |
jmc |
1.17 |
echo "Update $git_code code in dir $gcmDIR :" |
148 |
jmc |
1.14 |
( cd $gcmDIR ; git pull ) 2>&1 |
149 |
jmc |
1.11 |
retVal=$? |
150 |
|
|
if test "x$retVal" != x0 ; then |
151 |
|
|
echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit" |
152 |
jmc |
1.1 |
exit |
153 |
|
|
fi |
154 |
jmc |
1.14 |
echo " and checkout master:" |
155 |
|
|
( cd $gcmDIR ; git checkout master -- . ) 2>&1 |
156 |
jmc |
1.15 |
if test "x$addExp" != x ; then |
157 |
|
|
echo "Update $git_other code in dir $gcmDIR/$git_other :" |
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:" |
165 |
|
|
( cd $gcmDIR/$git_other ; git checkout master -- . ) 2>&1 |
166 |
jmc |
1.1 |
fi |
167 |
|
|
fi |
168 |
jmc |
1.17 |
|
169 |
jmc |
1.1 |
if [ $checkOut -eq 2 ] ; then |
170 |
|
|
if test -e $gcmDIR ; then |
171 |
jmc |
1.3 |
echo -n "Removing working copy: $gcmDIR ..." |
172 |
|
|
rm -rf $gcmDIR |
173 |
|
|
echo " done" |
174 |
jmc |
1.1 |
fi |
175 |
jmc |
1.17 |
echo "Make a clone of $git_code from repo: $git_repo ..." |
176 |
jmc |
1.13 |
git clone $git_repo/${git_code}.git $gcmDIR 2> $tmpFil |
177 |
jmc |
1.11 |
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 |
jmc |
1.1 |
exit |
184 |
jmc |
1.11 |
fi |
185 |
jmc |
1.15 |
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 |
jmc |
1.1 |
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 |
jmc |
1.17 |
#- change dir to $gcmDIR/verification + add link for additional experiments: |
204 |
jmc |
1.1 |
if test -e $gcmDIR/verification ; then |
205 |
|
|
if [ $checkOut -lt 2 ] ; then |
206 |
|
|
echo " dir $gcmDIR/verification exist" ; fi |
207 |
|
|
cd $gcmDIR/verification |
208 |
jmc |
1.7 |
for exp2add in $addExp ; do |
209 |
jmc |
1.15 |
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 |
jmc |
1.7 |
else |
214 |
jmc |
1.15 |
echo " missing dir: $git_other/$exp2add" |
215 |
|
|
continue |
216 |
jmc |
1.7 |
fi |
217 |
|
|
done |
218 |
jmc |
1.1 |
else |
219 |
|
|
echo "no dir: $gcmDIR/verification => exit" |
220 |
|
|
exit |
221 |
|
|
fi |
222 |
|
|
|
223 |
jmc |
1.20 |
if [ $dblTr -eq 1 ] ; then |
224 |
jmc |
1.8 |
echo '' |
225 |
jmc |
1.20 |
echo ./testreport $options -of $OPTFILE -odir ${dNam}-$sfx -nr |
226 |
|
|
./testreport $options -of $OPTFILE -odir ${dNam}-$sfx -nr |
227 |
|
|
options="$options -q" |
228 |
|
|
fi |
229 |
|
|
|
230 |
|
|
echo '' |
231 |
|
|
echo ./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
232 |
|
|
-send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
233 |
|
|
./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
234 |
|
|
-send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
235 |
jmc |
1.8 |
|
236 |
|
|
# echo '' |
237 |
|
|
# echo ../tools/do_tst_2+2 -mpi \ |
238 |
jmc |
1.10 |
# -o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
239 |
jmc |
1.8 |
# ../tools/do_tst_2+2 -mpi \ |
240 |
jmc |
1.10 |
# -o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
241 |
jmc |
1.1 |
|