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