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