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