1 |
jmc |
1.1 |
#!/bin/bash |
2 |
jmc |
1.4 |
#SBATCH -J ifcMPI_tst |
3 |
jmc |
1.1 |
#SBATCH -p fdr |
4 |
jmc |
1.3 |
#SBATCH -t 18:00:00 |
5 |
jmc |
1.1 |
#SBATCH --mem-per-cpu 4000 |
6 |
|
|
#SBATCH -N 1 |
7 |
|
|
#SBATCH --tasks-per-node 6 |
8 |
jmc |
1.4 |
#SBATCH -e /home/jm_c/test_svante/output/ifcMPI_tst.stderr |
9 |
|
|
#SBATCH -o /home/jm_c/test_svante/output/ifcMPI_tst.stdout |
10 |
jmc |
1.2 |
#SBATCH --no-requeue |
11 |
jmc |
1.1 |
|
12 |
jmc |
1.4 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_svante_ifc_mpi,v 1.3 2017/03/18 13:11:08 jmc Exp $ |
13 |
jmc |
1.1 |
# $Name: $ |
14 |
|
|
|
15 |
|
|
if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi |
16 |
|
|
if test -f /etc/profile.d/zz_modules.sh ; then . /etc/profile.d/zz_modules.sh ; fi |
17 |
|
|
# Note: added "ulimit -s unlimited" in file "~/.bashrc" |
18 |
|
|
# 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 |
|
|
headNode='svante-login' |
25 |
|
|
|
26 |
|
|
dNam='svante' |
27 |
|
|
HERE="$HOME/test_${dNam}" |
28 |
|
|
OUTP="$HERE/output"; SavD="$HERE/send" |
29 |
|
|
SEND="ssh $headNode $SavD/mpack" |
30 |
|
|
TST_DISK="/net/fs09/d0/jm_c" |
31 |
|
|
TST_DIR="$TST_DISK/test_${dNam}" |
32 |
|
|
|
33 |
|
|
cd $TST_DISK ; pwd |
34 |
|
|
if test -d $TST_DIR ; then |
35 |
|
|
echo "start from TST_DIR='$TST_DIR' at: "`date` |
36 |
|
|
else |
37 |
|
|
echo "ERROR: missing directory \"$TST_DIR\"" |
38 |
|
|
exit 1 |
39 |
|
|
fi |
40 |
|
|
|
41 |
|
|
sfx='ifcMPI'; typ='' |
42 |
|
|
addExp='' |
43 |
|
|
module add intel/2017.0.1 |
44 |
|
|
module add openmpi |
45 |
|
|
#module add netcdf |
46 |
|
|
OPTFILE="../tools/build_options/linux_amd64_ifort11" |
47 |
|
|
#- needed for DIVA with MPI: |
48 |
|
|
#export MPI_INC_DIR=$INC_MPI |
49 |
|
|
options="$typ -j 2 -MPI 6" |
50 |
|
|
#- need this to get "staf": |
51 |
|
|
#export PATH="$PATH:$HOME/bin" |
52 |
|
|
|
53 |
|
|
dAlt=`date +%d` ; dAlt=`expr $dAlt % 3` |
54 |
|
|
#if [ $dAlt -eq 1 ] ; then options="$options -fast" |
55 |
|
|
#else options="$options -devel" ; fi |
56 |
|
|
|
57 |
|
|
checkOut=2 ; #options="$options -do" |
58 |
|
|
#options="$options -nc" ; checkOut=1 |
59 |
|
|
#options="$options -q" ; checkOut=0 |
60 |
|
|
|
61 |
|
|
NSLOTS=$SLURM_NTASKS |
62 |
|
|
THEDATE=`date` |
63 |
|
|
echo '********************************************************************************' |
64 |
|
|
echo 'Start job '$THEDATE |
65 |
|
|
echo 'NSLOTS = '$NSLOTS |
66 |
|
|
echo '======= NODELIST ===============================================================' |
67 |
|
|
echo $SLURM_NODELIST |
68 |
|
|
cat /etc/redhat-release |
69 |
|
|
echo '======= env ====================================================================' |
70 |
|
|
env | grep SLURM |
71 |
|
|
echo '======= modules ================================================================' |
72 |
|
|
module list 2>&1 |
73 |
|
|
echo '================================================================================' |
74 |
|
|
|
75 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
76 |
|
|
gcmDIR="MITgcm_$sfx" |
77 |
|
|
cd $TST_DIR |
78 |
|
|
#- check for disk space: relative space (99%) or absolute (10.G): |
79 |
|
|
dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
80 |
|
|
if [ $dsp -gt 99 ] ; then |
81 |
|
|
#dsp=`df -P . | tail -1 | awk '{print $4}'` |
82 |
|
|
#if [ $dsp -le 100000000 ] ; then |
83 |
|
|
echo 'Not enough space on this disk => do not run testreport.' |
84 |
|
|
df . |
85 |
|
|
exit |
86 |
|
|
fi |
87 |
|
|
if [ $checkOut -eq 1 ] ; then |
88 |
|
|
if test -d $gcmDIR/CVS ; then |
89 |
|
|
echo "cleaning output from $gcmDIR/verification :" |
90 |
|
|
#- remove previous output tar files and tar & remove previous output-dir |
91 |
|
|
/bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz |
92 |
|
|
( cd $gcmDIR/verification |
93 |
|
|
listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null` |
94 |
|
|
for dd in $listD |
95 |
|
|
do |
96 |
|
|
if test -d $dd ; then |
97 |
|
|
tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd |
98 |
|
|
RETVAL=$? |
99 |
|
|
if test "x$RETVAL" != x0 ; then |
100 |
|
|
echo "ERROR in tar+gzip prev outp-dir: $dd" |
101 |
|
|
echo " on '"`hostname`"' (return val=$RETVAL) but continue" |
102 |
|
|
fi |
103 |
|
|
fi |
104 |
|
|
done ) |
105 |
|
|
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
106 |
|
|
( cd $gcmDIR/verification ; ./testreport $typ -clean ) |
107 |
|
|
echo "cvs update of dir $gcmDIR :" |
108 |
|
|
( cd $gcmDIR ; $cmdCVS update -P -d ) 2>&1 |
109 |
|
|
RETVAL=$? |
110 |
|
|
if test "x$RETVAL" != x0 ; then |
111 |
|
|
echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" |
112 |
|
|
exit |
113 |
|
|
fi |
114 |
|
|
else |
115 |
|
|
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
116 |
|
|
checkOut=2 |
117 |
|
|
fi |
118 |
|
|
fi |
119 |
|
|
if [ $checkOut -eq 2 ] ; then |
120 |
|
|
if test -e $gcmDIR ; then |
121 |
|
|
echo -n "Removing working copy: $gcmDIR ..." |
122 |
|
|
rm -rf $gcmDIR |
123 |
|
|
echo " done" |
124 |
|
|
fi |
125 |
|
|
# make a local copy (instead of using CVS): |
126 |
|
|
today=`date +%Y%m%d` |
127 |
|
|
nCount=0; updFile='updated_code' |
128 |
|
|
updDate=0 ; test -f $updFile && updDate=`cat $updFile` |
129 |
|
|
while [ $today -gt $updDate ] ; do |
130 |
|
|
nCount=`expr $nCount + 1` |
131 |
|
|
if [ $nCount -gt 40 ] ; then |
132 |
|
|
echo " waiting too long (nCount=$nCount) for updated code" |
133 |
|
|
echo " today=$today , updDate=$updDate " |
134 |
|
|
ls -l $updFile |
135 |
|
|
exit |
136 |
|
|
fi |
137 |
|
|
sleep 60 |
138 |
|
|
updDate=0 ; test -f $updFile && updDate=`cat $updFile` |
139 |
|
|
done |
140 |
|
|
ls -l $updFile |
141 |
|
|
echo " waited nCount=$nCount for updated code ($updDate) to copy" |
142 |
|
|
if test -d MITgcm ; then |
143 |
|
|
echo -n "Make local copy of dir 'MITgcm' to: $gcmDIR ..." |
144 |
|
|
cp -pra MITgcm $gcmDIR |
145 |
|
|
echo " done" |
146 |
|
|
else echo " dir: MITgcm missing => exit" ; exit ; fi |
147 |
|
|
fi |
148 |
|
|
|
149 |
|
|
#- change dir to $gcmDIR/verification dir: |
150 |
|
|
if test -e $gcmDIR/verification ; then |
151 |
|
|
if [ $checkOut -lt 2 ] ; then |
152 |
|
|
echo " dir $gcmDIR/verification exist" ; fi |
153 |
|
|
cd $gcmDIR/verification |
154 |
|
|
else |
155 |
|
|
echo "no dir: $gcmDIR/verification => exit" |
156 |
|
|
exit |
157 |
|
|
fi |
158 |
|
|
|
159 |
|
|
if [ $dAlt -eq 1 ] ; then |
160 |
|
|
options="$options -fast" |
161 |
|
|
echo '' |
162 |
|
|
echo ./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
163 |
|
|
-send \"$SEND\" -sd $SavD -a jmc@mitgcm.org |
164 |
|
|
./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
165 |
|
|
-send "$SEND" -sd $SavD -a jmc@mitgcm.org |
166 |
|
|
else |
167 |
|
|
options="$options -devel" |
168 |
|
|
echo '' |
169 |
|
|
echo ./testreport $options -of $OPTFILE \ |
170 |
|
|
-repl_mk do_make_syntax.sh -obj -dd |
171 |
|
|
./testreport $options -of $OPTFILE \ |
172 |
|
|
-repl_mk do_make_syntax.sh -obj -dd 2>&1 |
173 |
|
|
echo '' |
174 |
|
|
echo ./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
175 |
|
|
-q -send \"$SEND\" -sd $SavD -a jmc@mitgcm.org |
176 |
|
|
./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
177 |
|
|
-q -send "$SEND" -sd $SavD -a jmc@mitgcm.org |
178 |
|
|
fi |
179 |
|
|
echo '' |
180 |
|
|
echo ../tools/do_tst_2+2 -mpi -o ${dNam}-$sfx \ |
181 |
|
|
-send \"$SEND\" -sd $SavD -a jmc@mitgcm.org |
182 |
|
|
../tools/do_tst_2+2 -mpi -o ${dNam}-$sfx \ |
183 |
|
|
-send "$SEND" -sd $SavD -a jmc@mitgcm.org |