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.16 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_svante_pgi_mpi,v 1.15 2018/02/05 13:36:05 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 |
|
|
echo "cd $TST_DISK ; pwd (x2)" |
40 |
|
|
cd $TST_DISK |
41 |
|
|
pwd |
42 |
|
|
if test ! -d $TST_DIR ; then |
43 |
|
|
echo -n "Creating a working dir: $TST_DIR ..." |
44 |
|
|
#/bin/rm -rf $TST_DIR |
45 |
|
|
mkdir $TST_DIR |
46 |
|
|
retVal=$? |
47 |
|
|
if test "x$retVal" != x0 ; then |
48 |
|
|
echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit" |
49 |
|
|
exit 1 |
50 |
|
|
fi |
51 |
jmc |
1.1 |
fi |
52 |
jmc |
1.14 |
echo "start from TST_DIR='$TST_DIR' at: "`date` |
53 |
|
|
cd $TST_DIR |
54 |
|
|
pwd |
55 |
jmc |
1.1 |
|
56 |
jmc |
1.10 |
typ='' ; addExp='' ; skipExp='' |
57 |
|
|
sfx='pgiMPI' |
58 |
jmc |
1.5 |
module add pgi/16.9 |
59 |
jmc |
1.1 |
module add openmpi |
60 |
jmc |
1.5 |
module add netcdf |
61 |
jmc |
1.1 |
OPTFILE="../tools/build_options/linux_amd64_pgf77" |
62 |
|
|
#- needed for DIVA with MPI: |
63 |
jmc |
1.5 |
#export MPI_INC_DIR="/home/software/pgi/16.9/linux86-64/2016/mpi/openmpi-1.10.2/include" |
64 |
jmc |
1.1 |
options="$typ -MPI 6" |
65 |
|
|
#- need this to get "staf": |
66 |
|
|
#export PATH="$PATH:$HOME/bin" |
67 |
|
|
|
68 |
|
|
dAlt=`date +%d` ; dAlt=`expr $dAlt % 3` |
69 |
|
|
if [ $dAlt -eq 1 ] ; then options="$options -fast" |
70 |
|
|
else options="$options -devel" ; fi |
71 |
|
|
|
72 |
|
|
checkOut=2 ; #options="$options -do" |
73 |
|
|
#options="$options -nc" ; checkOut=1 |
74 |
|
|
#options="$options -q" ; checkOut=0 |
75 |
|
|
|
76 |
jmc |
1.5 |
NSLOTS=$SLURM_NTASKS |
77 |
|
|
THEDATE=`date` |
78 |
|
|
echo '********************************************************************************' |
79 |
|
|
echo 'Start job '$THEDATE |
80 |
|
|
echo 'NSLOTS = '$NSLOTS |
81 |
|
|
echo '======= NODELIST ===============================================================' |
82 |
|
|
echo $SLURM_NODELIST |
83 |
|
|
cat /etc/redhat-release |
84 |
|
|
echo '======= env ====================================================================' |
85 |
|
|
env | grep SLURM |
86 |
|
|
echo '======= modules ================================================================' |
87 |
|
|
module list 2>&1 |
88 |
|
|
echo '================================================================================' |
89 |
jmc |
1.1 |
|
90 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
91 |
|
|
gcmDIR="MITgcm_$sfx" |
92 |
|
|
#- check for disk space: relative space (99%) or absolute (10.G): |
93 |
|
|
dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
94 |
|
|
if [ $dsp -gt 99 ] ; then |
95 |
|
|
#dsp=`df -P . | tail -1 | awk '{print $4}'` |
96 |
|
|
#if [ $dsp -le 100000000 ] ; then |
97 |
|
|
echo 'Not enough space on this disk => do not run testreport.' |
98 |
|
|
df . |
99 |
|
|
exit |
100 |
|
|
fi |
101 |
|
|
if [ $checkOut -eq 1 ] ; then |
102 |
|
|
if test -d $gcmDIR/CVS ; then |
103 |
|
|
echo "cleaning output from $gcmDIR/verification :" |
104 |
|
|
#- remove previous output tar files and tar & remove previous output-dir |
105 |
|
|
/bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz |
106 |
|
|
( cd $gcmDIR/verification |
107 |
|
|
listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null` |
108 |
|
|
for dd in $listD |
109 |
|
|
do |
110 |
|
|
if test -d $dd ; then |
111 |
|
|
tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd |
112 |
jmc |
1.14 |
retVal=$? |
113 |
|
|
if test "x$retVal" != x0 ; then |
114 |
jmc |
1.1 |
echo "ERROR in tar+gzip prev outp-dir: $dd" |
115 |
jmc |
1.14 |
echo " on '"`hostname`"' (return val=$retVal) but continue" |
116 |
jmc |
1.1 |
fi |
117 |
|
|
fi |
118 |
|
|
done ) |
119 |
|
|
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
120 |
|
|
( cd $gcmDIR/verification ; ./testreport $typ -clean ) |
121 |
|
|
echo "cvs update of dir $gcmDIR :" |
122 |
|
|
( cd $gcmDIR ; $cmdCVS update -P -d ) 2>&1 |
123 |
jmc |
1.14 |
retVal=$? |
124 |
|
|
if test "x$retVal" != x0 ; then |
125 |
|
|
echo "cvs update on '"`hostname`"' fail (return val=$retVal) => exit" |
126 |
jmc |
1.1 |
exit |
127 |
|
|
fi |
128 |
|
|
else |
129 |
|
|
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
130 |
|
|
checkOut=2 |
131 |
|
|
fi |
132 |
|
|
fi |
133 |
|
|
if [ $checkOut -eq 2 ] ; then |
134 |
|
|
if test -e $gcmDIR ; then |
135 |
|
|
echo -n "Removing working copy: $gcmDIR ..." |
136 |
|
|
rm -rf $gcmDIR |
137 |
|
|
echo " done" |
138 |
|
|
fi |
139 |
|
|
# make a local copy (instead of using CVS): |
140 |
|
|
today=`date +%Y%m%d` |
141 |
jmc |
1.14 |
nCount=0; updFile="${srcDIR}/updated_code" |
142 |
jmc |
1.1 |
updDate=0 ; test -f $updFile && updDate=`cat $updFile` |
143 |
|
|
while [ $today -gt $updDate ] ; do |
144 |
|
|
nCount=`expr $nCount + 1` |
145 |
|
|
if [ $nCount -gt 40 ] ; then |
146 |
|
|
echo " waiting too long (nCount=$nCount) for updated code" |
147 |
|
|
echo " today=$today , updDate=$updDate " |
148 |
|
|
ls -l $updFile |
149 |
|
|
exit |
150 |
|
|
fi |
151 |
|
|
sleep 60 |
152 |
|
|
updDate=0 ; test -f $updFile && updDate=`cat $updFile` |
153 |
|
|
done |
154 |
|
|
ls -l $updFile |
155 |
|
|
echo " waited nCount=$nCount for updated code ($updDate) to copy" |
156 |
jmc |
1.14 |
if test -d $srcDIR/$srcCode ; then |
157 |
|
|
echo -n "Make local copy of dir '$srcDIR/$srcCode' to: $gcmDIR ..." |
158 |
|
|
cp -pra $srcDIR/$srcCode $gcmDIR |
159 |
jmc |
1.1 |
echo " done" |
160 |
jmc |
1.14 |
else echo " dir: $srcDIR/$srcCode missing => exit" ; exit ; fi |
161 |
jmc |
1.1 |
# cvs co MITgcm |
162 |
|
|
#echo "Downloading using '$cmdCVS co -P -d $gcmDIR MITgcm' ..." |
163 |
|
|
#$cmdCVS co -P -d $gcmDIR MITgcm > /dev/null |
164 |
jmc |
1.14 |
#retVal=$? |
165 |
|
|
#if test "x$retVal" != x0 ; then |
166 |
|
|
# echo "cvs co on '"`hostname`"' fail (return val=$retVal) => exit" |
167 |
jmc |
1.1 |
# exit |
168 |
|
|
#else echo " done" ; fi |
169 |
|
|
#if test -d $gcmDIR/verification ; then |
170 |
|
|
# for exp2add in $addExp ; do |
171 |
|
|
# echo " add dir: $exp2add (from Contrib:verification_other)" |
172 |
|
|
# ( cd $gcmDIR/verification ; $cmdCVS co -P -d $exp2add \ |
173 |
|
|
# MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
174 |
|
|
# done |
175 |
|
|
# /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
176 |
|
|
# /usr/bin/find $gcmDIR -type f | xargs chmod g+r |
177 |
|
|
#fi |
178 |
|
|
fi |
179 |
|
|
|
180 |
|
|
#- change dir to $gcmDIR/verification dir: |
181 |
|
|
if test -e $gcmDIR/verification ; then |
182 |
|
|
if [ $checkOut -lt 2 ] ; then |
183 |
|
|
echo " dir $gcmDIR/verification exist" ; fi |
184 |
|
|
cd $gcmDIR/verification |
185 |
|
|
else |
186 |
|
|
echo "no dir: $gcmDIR/verification => exit" |
187 |
|
|
exit |
188 |
|
|
fi |
189 |
|
|
|
190 |
|
|
echo '' |
191 |
jmc |
1.10 |
echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \ |
192 |
jmc |
1.13 |
-odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
193 |
jmc |
1.10 |
./testreport $options -of $OPTFILE -skd "$skipExp" \ |
194 |
jmc |
1.13 |
-odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
195 |
jmc |
1.1 |
|
196 |
|
|
echo '' |
197 |
jmc |
1.10 |
echo ../tools/do_tst_2+2 -mpi \ |
198 |
jmc |
1.13 |
-o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
199 |
jmc |
1.10 |
../tools/do_tst_2+2 -mpi \ |
200 |
jmc |
1.13 |
-o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
201 |
jmc |
1.1 |
|