1 |
jmc |
1.1 |
#!/bin/bash |
2 |
jmc |
1.9 |
#SBATCH -J ifcMpi_tst |
3 |
jmc |
1.1 |
#SBATCH -p sched_mit_hill |
4 |
|
|
#SBATCH --mem-per-cpu 4000 |
5 |
|
|
#SBATCH -N 2 |
6 |
|
|
#SBATCH --tasks-per-node 4 |
7 |
jmc |
1.6 |
#SBATCH -x node[016,030,031,073,125,198,332] |
8 |
jmc |
1.9 |
#SBATCH -e /home/jm_c/test_engaging/output/ifcMpi_tst.stderr |
9 |
|
|
#SBATCH -o /home/jm_c/test_engaging/output/ifcMpi_tst.stdout |
10 |
jmc |
1.1 |
#SBATCH --no-requeue --constraint=centos6 |
11 |
|
|
|
12 |
jmc |
1.9 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_engag_ifc_mpi,v 1.8 2018/02/09 17:33:41 jmc Exp $ |
13 |
jmc |
1.1 |
# $Name: $ |
14 |
|
|
|
15 |
|
|
if test -f /etc/profile.d/modules.sh ; then |
16 |
|
|
. /etc/profile.d/modules.sh |
17 |
|
|
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 |
|
|
|
26 |
|
|
dNam='engaging' |
27 |
|
|
HERE="$HOME/test_$dNam" |
28 |
|
|
OUTP="$HERE/output"; SavD="$HERE/send" |
29 |
|
|
SEND="ssh eofe4 $SavD/mpack" |
30 |
|
|
TST_DIR="/pool001/jm_c/test_$dNam" |
31 |
jmc |
1.7 |
tmpFil="/tmp/"`basename $0`".$$" |
32 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
33 |
jmc |
1.9 |
#- which GitHub repository to use and how to access it: |
34 |
jmc |
1.7 |
git_repo='MITgcm'; git_code='MITgcm' |
35 |
|
|
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
36 |
jmc |
1.9 |
#-- |
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 |
jmc |
1.1 |
|
41 |
jmc |
1.2 |
typ='' ; addExp='' ; skipExp='' |
42 |
|
|
sfx='ifcMpi' |
43 |
jmc |
1.1 |
addExp='global_oce_cs32 global_oce_llc90' |
44 |
|
|
module add slurm |
45 |
|
|
module add gcc |
46 |
|
|
module add engaging/intel/2013.1.046 |
47 |
|
|
#export MPI_INC_DIR="$MPI_HOME/include" |
48 |
|
|
OPTFILE="../tools/build_options/linux_amd64_ifort+impi" |
49 |
|
|
mpiCMD="mpirun -env I_MPI_DEBUG 2 -n TR_NPROC ./mitgcmuv" #- currently not used |
50 |
jmc |
1.4 |
options="$typ -MPI 8" |
51 |
jmc |
1.5 |
#options="-j 4 $options" |
52 |
jmc |
1.1 |
#export OMP_NUM_THREADS=2 |
53 |
|
|
#export KMP_SLAVE_STACK_SIZE=400m |
54 |
|
|
#options="$options -gsl" |
55 |
|
|
#export GSL_IEEE_MODE=double-precision,mask-underflow,mask-denormalized |
56 |
|
|
ulimit -s unlimited |
57 |
|
|
#- need this to get "staf" & "do_make_syntax.sh": |
58 |
|
|
export PATH="$PATH:$HOME/bin" |
59 |
|
|
|
60 |
jmc |
1.7 |
gcmDIR="MITgcm_$sfx" |
61 |
jmc |
1.1 |
dAlt=`date +%d` ; dAlt=`expr $dAlt % 3` |
62 |
|
|
if [ $dAlt -eq 1 ] ; then options="$options -ur4 -match 5" ; fi |
63 |
|
|
options="$options -devel" |
64 |
|
|
|
65 |
|
|
checkOut=1 ; #options="$options -do" |
66 |
|
|
#options="$options -nc" ; checkOut=1 |
67 |
|
|
#options="$options -q" ; checkOut=0 |
68 |
|
|
|
69 |
jmc |
1.7 |
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 |
|
|
|
84 |
jmc |
1.1 |
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 |
|
|
#- |
99 |
|
|
MPI_MFile="${OUTP}/mf_${sfx}" #- currently not used |
100 |
|
|
#mpiCMD="mpirun -hostfile TR_MFILE -n TR_NPROC ./mitgcmuv" |
101 |
|
|
#- make the testreport MPI_MFILE: |
102 |
|
|
listNODES=`echo $SLURM_NODELIST | sed -e 's/\[/ /' -e 's/\]//' -e 's/,/ /' -e 's/-/ /'` |
103 |
|
|
# duplicate the 2 listed nodes into a 6 list file: |
104 |
|
|
/bin/rm -f $MPI_MFile ; touch $MPI_MFile |
105 |
|
|
for nc in `seq 1 4` ; do pfx='' |
106 |
|
|
for nd in $listNODES ; do |
107 |
|
|
if test "x$pfx" = x ; then pfx=$nd ; else |
108 |
|
|
echo "${pfx}${nd}" >> $MPI_MFile |
109 |
|
|
fi |
110 |
|
|
done |
111 |
|
|
done |
112 |
|
|
|
113 |
|
|
#- check for disk space: relative space (99%) or absolute (10.G): |
114 |
|
|
dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
115 |
|
|
if [ $dsp -gt 99 ] ; then |
116 |
|
|
#dsp=`df -P . | tail -1 | awk '{print $4}'` |
117 |
|
|
#if [ $dsp -le 100000000 ] ; then |
118 |
|
|
echo 'Not enough space on this disk => do not run testreport.' |
119 |
|
|
df . |
120 |
|
|
exit |
121 |
|
|
fi |
122 |
|
|
if [ $checkOut -eq 1 ] ; then |
123 |
jmc |
1.7 |
if test -e $gcmDIR/.git/config ; then |
124 |
jmc |
1.1 |
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 |
jmc |
1.7 |
retVal=$? |
134 |
|
|
if test "x$retVal" != x0 ; then |
135 |
jmc |
1.1 |
echo "ERROR in tar+gzip prev outp-dir: $dd" |
136 |
jmc |
1.7 |
echo " on '"`hostname`"' (return val=$retVal) but continue" |
137 |
jmc |
1.1 |
fi |
138 |
|
|
fi |
139 |
|
|
done ) |
140 |
|
|
echo "clean tst_2+2 + testreport output (+ Makefile_syntax files)" |
141 |
|
|
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
142 |
|
|
( cd $gcmDIR/verification ; ./testreport $typ -clean ) |
143 |
|
|
( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax ) |
144 |
|
|
( cd $gcmDIR/verification ; rm -f */build/port_rand.i */build/ptracers_set_iolabel.i ) |
145 |
jmc |
1.7 |
echo "Update MITgcm code in dir $gcmDIR :" |
146 |
jmc |
1.8 |
( cd $gcmDIR ; git checkout master ; git pull ) 2>&1 |
147 |
jmc |
1.7 |
retVal=$? |
148 |
|
|
if test "x$retVal" != x0 ; then |
149 |
|
|
echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit" |
150 |
jmc |
1.1 |
exit |
151 |
|
|
fi |
152 |
|
|
else |
153 |
jmc |
1.7 |
echo "no file: $gcmDIR/.git/config => try to download a fresh clone" |
154 |
jmc |
1.1 |
checkOut=2 |
155 |
|
|
fi |
156 |
|
|
fi |
157 |
|
|
if [ $checkOut -eq 2 ] ; then |
158 |
|
|
if test -e $gcmDIR ; then |
159 |
|
|
echo -n "Removing working copy: $gcmDIR ..." |
160 |
|
|
rm -rf $gcmDIR |
161 |
|
|
echo " done" |
162 |
|
|
fi |
163 |
jmc |
1.7 |
echo -n "Make a clone of $git_code from repo: $git_repo ..." |
164 |
jmc |
1.9 |
git clone $git_repo/${git_code}.git $gcmDIR 2> $tmpFil |
165 |
jmc |
1.7 |
retVal=$? |
166 |
|
|
if test $retVal = 0 ; then |
167 |
|
|
echo ' done' ; rm -f $tmpFil |
168 |
|
|
else |
169 |
|
|
echo " Error: 'git clone' returned: $retVal" |
170 |
|
|
cat $tmpFil ; rm -f $tmpFil |
171 |
jmc |
1.1 |
exit |
172 |
jmc |
1.7 |
fi |
173 |
jmc |
1.1 |
if test -d $gcmDIR/verification ; then |
174 |
|
|
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
175 |
|
|
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
176 |
|
|
fi |
177 |
|
|
fi |
178 |
|
|
|
179 |
|
|
# -change dir to $gcmDIR/verification dir + add additional experiments: |
180 |
|
|
if test -e $gcmDIR/verification ; then |
181 |
|
|
if [ $checkOut -lt 2 ] ; then |
182 |
|
|
echo " dir $gcmDIR/verification exist" ; fi |
183 |
|
|
cd $gcmDIR/verification |
184 |
|
|
for exp2add in $addExp ; do |
185 |
|
|
if test -d ${exp2add}/CVS ; then |
186 |
jmc |
1.7 |
echo " update dir: $exp2add (from Contrib:verification_other)" |
187 |
|
|
( cd $exp2add ; $cmdCVS update -P -d ) 2>&1 |
188 |
|
|
retVal=$? |
189 |
|
|
if test "x$retVal" != x0 ; then |
190 |
|
|
echo "cvs update on '"`hostname`"' fail (return val=$retVal)" |
191 |
|
|
#exit |
192 |
|
|
fi |
193 |
jmc |
1.1 |
else |
194 |
|
|
test -r $exp2add && /bin/rm -rf $exp2add |
195 |
|
|
echo " add dir: $exp2add (from Contrib:verification_other)" |
196 |
|
|
( $cmdCVS co -P -d $exp2add \ |
197 |
|
|
MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
198 |
|
|
if test $exp2add = 'global_oce_cs32' ; then |
199 |
|
|
echo " link dir 'other_input/core2_cnyf' in here" |
200 |
|
|
( cd ${exp2add} ; ln -s ../../../other_input/core2_cnyf . ) |
201 |
|
|
fi |
202 |
|
|
if test $exp2add = 'global_oce_llc90' ; then |
203 |
|
|
echo " link dir 'other_input/gael_oce_llc90_input' to 'input_fields'" |
204 |
|
|
( cd ${exp2add} ; ln -s ../../../other_input/gael_oce_llc90_input input_fields ) |
205 |
|
|
echo " link dirs: 'core2_cnyf' & 'global_oce_input_fields/*' in input_verifs" |
206 |
|
|
( test ! -e ${exp2add}/input_verifs && mkdir ${exp2add}/input_verifs |
207 |
|
|
cd ${exp2add}/input_verifs |
208 |
|
|
ln -s ../../../../other_input/core2_cnyf . |
209 |
|
|
ln -s ../../../../other_input/global_oce_input_fields/* . ) |
210 |
|
|
fi |
211 |
|
|
/usr/bin/find $exp2add -type d | xargs chmod g+rxs |
212 |
|
|
/usr/bin/find $exp2add -type f | xargs chmod g+r |
213 |
|
|
fi |
214 |
|
|
done |
215 |
|
|
else |
216 |
|
|
echo "no dir: $gcmDIR/verification => exit" |
217 |
|
|
exit |
218 |
|
|
fi |
219 |
|
|
|
220 |
jmc |
1.6 |
if [ $checkOut -ge 1 ] ; then |
221 |
jmc |
1.1 |
echo '' |
222 |
jmc |
1.5 |
#- 0) just make all module header ( *__genmod.mod files) using modified Makefile |
223 |
jmc |
1.2 |
echo ./testreport $options -of $OPTFILE \ |
224 |
jmc |
1.1 |
-nc -repl_mk do_make_syntax.sh -obj -dd |
225 |
jmc |
1.2 |
./testreport $options -of $OPTFILE \ |
226 |
jmc |
1.1 |
-nc -repl_mk do_make_syntax.sh -obj -dd |
227 |
|
|
|
228 |
|
|
echo '' |
229 |
jmc |
1.5 |
#- 1) just compile ("-nr"), using "-j 4" to speed up |
230 |
|
|
echo ./testreport $options -of $OPTFILE \ |
231 |
|
|
-j 4 -nr -q -odir ${dNam}-$sfx |
232 |
|
|
./testreport $options -of $OPTFILE \ |
233 |
|
|
-j 4 -nr -q -odir ${dNam}-$sfx |
234 |
|
|
nFc=`grep -c '^Y . N N ' tr_out.txt` |
235 |
|
|
echo " <= fail to compile $nFc experiments" |
236 |
jmc |
1.6 |
fi |
237 |
jmc |
1.5 |
|
238 |
|
|
echo '' |
239 |
|
|
#- 2) run and report results ; also finish to compile those who failed with "-j" |
240 |
jmc |
1.2 |
#echo ./testreport $options -of $OPTFILE -command \'$mpiCMD\' -mf $MPI_MFile \ |
241 |
|
|
echo ./testreport $options -of $OPTFILE \ |
242 |
jmc |
1.6 |
-q -odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
243 |
jmc |
1.2 |
#./testreport $options -of $OPTFILE -command "$mpiCMD" -mf $MPI_MFile \ |
244 |
|
|
./testreport $options -of $OPTFILE \ |
245 |
jmc |
1.6 |
-q -odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
246 |
jmc |
1.1 |
|
247 |
|
|
echo '' |
248 |
jmc |
1.5 |
#- 3) test restart and report results |
249 |
jmc |
1.2 |
#echo ../tools/do_tst_2+2 -mpi -exe \'$mpiCMD\' -mf $MPI_MFile \ |
250 |
|
|
echo ../tools/do_tst_2+2 -mpi \ |
251 |
jmc |
1.6 |
-o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
252 |
jmc |
1.2 |
#../tools/do_tst_2+2 -mpi -exe "$mpiCMD" -mf $MPI_MFile \ |
253 |
|
|
../tools/do_tst_2+2 -mpi \ |
254 |
jmc |
1.6 |
-o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
255 |
jmc |
1.1 |
|