1 |
jmc |
1.1 |
#!/bin/bash |
2 |
jmc |
1.9 |
#SBATCH -J pgiMPI_tst |
3 |
jmc |
1.5 |
#SBATCH -p fdr |
4 |
jmc |
1.14 |
#SBATCH -t 23:30:00 |
5 |
jmc |
1.5 |
#SBATCH --mem-per-cpu 4000 |
6 |
|
|
#SBATCH -N 1 |
7 |
|
|
#SBATCH --tasks-per-node 6 |
8 |
jmc |
1.16 |
#SBATCH -x curly,larry,moe,shemp |
9 |
jmc |
1.9 |
#SBATCH -e /home/jm_c/test_svante/output/pgiMPI_tst.stderr |
10 |
|
|
#SBATCH -o /home/jm_c/test_svante/output/pgiMPI_tst.stdout |
11 |
jmc |
1.7 |
#SBATCH --no-requeue |
12 |
jmc |
1.1 |
|
13 |
jmc |
1.17 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_svante_pgi_mpi,v 1.16 2018/06/12 21:42:22 jmc Exp $ |
14 |
jmc |
1.1 |
# $Name: $ |
15 |
|
|
|
16 |
jmc |
1.5 |
if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi |
17 |
|
|
if test -f /etc/profile.d/zz_modules.sh ; then . /etc/profile.d/zz_modules.sh ; fi |
18 |
jmc |
1.1 |
# 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 |
jmc |
1.6 |
headNode='svante-login' |
26 |
jmc |
1.1 |
|
27 |
|
|
dNam='svante' |
28 |
jmc |
1.2 |
HERE="$HOME/test_${dNam}" |
29 |
jmc |
1.1 |
OUTP="$HERE/output"; SavD="$HERE/send" |
30 |
jmc |
1.6 |
SEND="ssh $headNode $SavD/mpack" |
31 |
jmc |
1.15 |
#TST_DISK="/net/fs09/d1/jm_c" |
32 |
|
|
TST_DISK="/scratch/jm_c" |
33 |
jmc |
1.2 |
TST_DIR="$TST_DISK/test_${dNam}" |
34 |
jmc |
1.14 |
#- where local copy of code is (need to be consistent with "test_submit_svante"): |
35 |
jmc |
1.15 |
#srcDIR='.' |
36 |
|
|
srcDIR=$HERE |
37 |
jmc |
1.14 |
srcCode="MITgcm_today" |
38 |
|
|
|
39 |
jmc |
1.17 |
#- following lines are not used here: |
40 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
41 |
|
|
#- which GitHub repository to use and how to access it: |
42 |
|
|
git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other' |
43 |
|
|
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
44 |
|
|
#-- |
45 |
|
|
git_repo="https://github.com/$git_repo" |
46 |
|
|
#git_repo="git://github.com/$git_repo" |
47 |
|
|
#git_repo="git@github.com:$git_repo" |
48 |
jmc |
1.1 |
|
49 |
jmc |
1.10 |
typ='' ; addExp='' ; skipExp='' |
50 |
|
|
sfx='pgiMPI' |
51 |
jmc |
1.5 |
module add pgi/16.9 |
52 |
jmc |
1.1 |
module add openmpi |
53 |
jmc |
1.5 |
module add netcdf |
54 |
jmc |
1.1 |
OPTFILE="../tools/build_options/linux_amd64_pgf77" |
55 |
|
|
#- needed for DIVA with MPI: |
56 |
jmc |
1.5 |
#export MPI_INC_DIR="/home/software/pgi/16.9/linux86-64/2016/mpi/openmpi-1.10.2/include" |
57 |
jmc |
1.1 |
options="$typ -MPI 6" |
58 |
|
|
#- need this to get "staf": |
59 |
|
|
#export PATH="$PATH:$HOME/bin" |
60 |
|
|
|
61 |
jmc |
1.17 |
gcmDIR="MITgcm_$sfx" |
62 |
jmc |
1.1 |
dAlt=`date +%d` ; dAlt=`expr $dAlt % 3` |
63 |
|
|
if [ $dAlt -eq 1 ] ; then options="$options -fast" |
64 |
|
|
else options="$options -devel" ; fi |
65 |
|
|
|
66 |
|
|
checkOut=2 ; #options="$options -do" |
67 |
|
|
#options="$options -nc" ; checkOut=1 |
68 |
|
|
#options="$options -q" ; checkOut=0 |
69 |
|
|
|
70 |
jmc |
1.17 |
echo "cd $TST_DISK ; pwd (x2)" |
71 |
|
|
cd $TST_DISK |
72 |
|
|
pwd |
73 |
|
|
if test ! -d $TST_DIR ; then |
74 |
|
|
echo -n "Creating a working dir: $TST_DIR ..." |
75 |
|
|
#/bin/rm -rf $TST_DIR |
76 |
|
|
mkdir $TST_DIR |
77 |
|
|
retVal=$? |
78 |
|
|
if test "x$retVal" != x0 ; then |
79 |
|
|
echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit" |
80 |
|
|
exit 1 |
81 |
|
|
fi |
82 |
|
|
fi |
83 |
|
|
echo "start from TST_DIR='$TST_DIR' at: "`date` |
84 |
|
|
cd $TST_DIR |
85 |
|
|
pwd |
86 |
|
|
|
87 |
jmc |
1.5 |
NSLOTS=$SLURM_NTASKS |
88 |
|
|
THEDATE=`date` |
89 |
|
|
echo '********************************************************************************' |
90 |
|
|
echo 'Start job '$THEDATE |
91 |
|
|
echo 'NSLOTS = '$NSLOTS |
92 |
|
|
echo '======= NODELIST ===============================================================' |
93 |
|
|
echo $SLURM_NODELIST |
94 |
|
|
cat /etc/redhat-release |
95 |
|
|
echo '======= env ====================================================================' |
96 |
|
|
env | grep SLURM |
97 |
|
|
echo '======= modules ================================================================' |
98 |
|
|
module list 2>&1 |
99 |
|
|
echo '================================================================================' |
100 |
jmc |
1.1 |
|
101 |
|
|
#- check for disk space: relative space (99%) or absolute (10.G): |
102 |
|
|
dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
103 |
|
|
if [ $dsp -gt 99 ] ; then |
104 |
|
|
#dsp=`df -P . | tail -1 | awk '{print $4}'` |
105 |
|
|
#if [ $dsp -le 100000000 ] ; then |
106 |
|
|
echo 'Not enough space on this disk => do not run testreport.' |
107 |
|
|
df . |
108 |
|
|
exit |
109 |
|
|
fi |
110 |
jmc |
1.17 |
|
111 |
jmc |
1.1 |
if [ $checkOut -eq 1 ] ; then |
112 |
|
|
echo "cleaning output from $gcmDIR/verification :" |
113 |
|
|
#- remove previous output tar files and tar & remove previous output-dir |
114 |
|
|
/bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz |
115 |
|
|
( cd $gcmDIR/verification |
116 |
|
|
listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null` |
117 |
|
|
for dd in $listD |
118 |
|
|
do |
119 |
|
|
if test -d $dd ; then |
120 |
|
|
tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd |
121 |
jmc |
1.14 |
retVal=$? |
122 |
|
|
if test "x$retVal" != x0 ; then |
123 |
jmc |
1.1 |
echo "ERROR in tar+gzip prev outp-dir: $dd" |
124 |
jmc |
1.14 |
echo " on '"`hostname`"' (return val=$retVal) but continue" |
125 |
jmc |
1.1 |
fi |
126 |
|
|
fi |
127 |
|
|
done ) |
128 |
jmc |
1.17 |
echo "clean tst_2+2 + testreport output" |
129 |
jmc |
1.1 |
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
130 |
|
|
( cd $gcmDIR/verification ; ./testreport $typ -clean ) |
131 |
jmc |
1.17 |
if test "x$addExp" != x ; then |
132 |
|
|
( cd $gcmDIR/verification |
133 |
|
|
listD=`ls -o | grep '^l' | awk '{print $8}' 2> /dev/null` |
134 |
|
|
echo " + remove local links: $listD" |
135 |
|
|
/bin/rm -f $listD |
136 |
|
|
) |
137 |
|
|
fi |
138 |
|
|
echo "Update $git_code code in dir $gcmDIR :" |
139 |
|
|
( cd $gcmDIR ; git pull ) 2>&1 |
140 |
jmc |
1.14 |
retVal=$? |
141 |
|
|
if test "x$retVal" != x0 ; then |
142 |
jmc |
1.17 |
echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit" |
143 |
jmc |
1.1 |
exit |
144 |
|
|
fi |
145 |
jmc |
1.17 |
echo " and checkout master:" |
146 |
|
|
( cd $gcmDIR ; git checkout master -- . ) 2>&1 |
147 |
|
|
if test "x$addExp" != x ; then |
148 |
|
|
echo "Update $git_other code in dir $gcmDIR/$git_other :" |
149 |
|
|
( cd $gcmDIR/$git_other ; git pull ) 2>&1 |
150 |
|
|
retVal=$? |
151 |
|
|
if test "x$retVal" != x0 ; then |
152 |
|
|
echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit" |
153 |
|
|
exit |
154 |
|
|
fi |
155 |
|
|
echo " and checkout master:" |
156 |
|
|
( cd $gcmDIR/$git_other ; git checkout master -- . ) 2>&1 |
157 |
jmc |
1.1 |
fi |
158 |
|
|
fi |
159 |
jmc |
1.17 |
|
160 |
jmc |
1.1 |
if [ $checkOut -eq 2 ] ; then |
161 |
|
|
if test -e $gcmDIR ; then |
162 |
|
|
echo -n "Removing working copy: $gcmDIR ..." |
163 |
|
|
rm -rf $gcmDIR |
164 |
|
|
echo " done" |
165 |
|
|
fi |
166 |
jmc |
1.17 |
# make a local copy (instead of making a new clone): |
167 |
jmc |
1.1 |
today=`date +%Y%m%d` |
168 |
jmc |
1.14 |
nCount=0; updFile="${srcDIR}/updated_code" |
169 |
jmc |
1.1 |
updDate=0 ; test -f $updFile && updDate=`cat $updFile` |
170 |
|
|
while [ $today -gt $updDate ] ; do |
171 |
|
|
nCount=`expr $nCount + 1` |
172 |
|
|
if [ $nCount -gt 40 ] ; then |
173 |
|
|
echo " waiting too long (nCount=$nCount) for updated code" |
174 |
|
|
echo " today=$today , updDate=$updDate " |
175 |
|
|
ls -l $updFile |
176 |
|
|
exit |
177 |
|
|
fi |
178 |
|
|
sleep 60 |
179 |
|
|
updDate=0 ; test -f $updFile && updDate=`cat $updFile` |
180 |
|
|
done |
181 |
|
|
ls -l $updFile |
182 |
|
|
echo " waited nCount=$nCount for updated code ($updDate) to copy" |
183 |
jmc |
1.14 |
if test -d $srcDIR/$srcCode ; then |
184 |
|
|
echo -n "Make local copy of dir '$srcDIR/$srcCode' to: $gcmDIR ..." |
185 |
|
|
cp -pra $srcDIR/$srcCode $gcmDIR |
186 |
jmc |
1.1 |
echo " done" |
187 |
jmc |
1.14 |
else echo " dir: $srcDIR/$srcCode missing => exit" ; exit ; fi |
188 |
jmc |
1.1 |
fi |
189 |
|
|
|
190 |
|
|
#- change dir to $gcmDIR/verification dir: |
191 |
|
|
if test -e $gcmDIR/verification ; then |
192 |
|
|
if [ $checkOut -lt 2 ] ; then |
193 |
|
|
echo " dir $gcmDIR/verification exist" ; fi |
194 |
|
|
cd $gcmDIR/verification |
195 |
jmc |
1.17 |
for exp2add in $addExp ; do |
196 |
|
|
test -r $exp2add && /bin/rm -rf $exp2add |
197 |
|
|
if test -d ../$git_other/$exp2add ; then |
198 |
|
|
echo " add $exp2add link from $git_other" |
199 |
|
|
ln -s ../$git_other/$exp2add . |
200 |
|
|
if test $exp2add = 'global_oce_cs32' ; then |
201 |
|
|
echo " link dir 'other_input/core2_cnyf' in here" |
202 |
|
|
( cd ../${git_other}/${exp2add} |
203 |
|
|
test -L core2_cnyf && /bin/rm -f core2_cnyf |
204 |
|
|
ln -s ../../../other_input/core2_cnyf . ) |
205 |
|
|
fi |
206 |
|
|
if test $exp2add = 'global_oce_llc90' ; then |
207 |
|
|
echo " link dir 'other_input/gael_oce_llc90_input' to 'input_fields'" |
208 |
|
|
( cd ../${git_other}/${exp2add} |
209 |
|
|
test -L input_fields && /bin/rm -f input_fields |
210 |
|
|
ln -s ../../../other_input/gael_oce_llc90_input input_fields |
211 |
|
|
echo " link dirs: 'core2_cnyf' & 'global_oce_input_fields/*' in input_verifs" |
212 |
|
|
test ! -e input_verifs && mkdir input_verifs |
213 |
|
|
( cd input_verifs ; /bin/rm -f * |
214 |
|
|
ln -s ../../../../other_input/core2_cnyf . |
215 |
|
|
ln -s ../../../../other_input/global_oce_input_fields/* . ) |
216 |
|
|
) |
217 |
|
|
fi |
218 |
|
|
else |
219 |
|
|
echo " missing dir: $git_other/$exp2add" |
220 |
|
|
continue |
221 |
|
|
fi |
222 |
|
|
done |
223 |
jmc |
1.1 |
else |
224 |
|
|
echo "no dir: $gcmDIR/verification => exit" |
225 |
|
|
exit |
226 |
|
|
fi |
227 |
|
|
|
228 |
|
|
echo '' |
229 |
jmc |
1.10 |
echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \ |
230 |
jmc |
1.13 |
-odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
231 |
jmc |
1.10 |
./testreport $options -of $OPTFILE -skd "$skipExp" \ |
232 |
jmc |
1.13 |
-odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
233 |
jmc |
1.1 |
|
234 |
|
|
echo '' |
235 |
jmc |
1.10 |
echo ../tools/do_tst_2+2 -mpi \ |
236 |
jmc |
1.13 |
-o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
237 |
jmc |
1.10 |
../tools/do_tst_2+2 -mpi \ |
238 |
jmc |
1.13 |
-o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
239 |
jmc |
1.1 |
|