1 |
jmc |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
|
|
#PBS -q latenight |
4 |
|
|
#PBS -N tst_pgiMPI |
5 |
|
|
#PBS -l nodes=1:ppn=6:stooge |
6 |
|
|
#PBS -e /home/jm_c/test_svante/output/tst_pgiMPI.stderr |
7 |
|
|
#PBS -o /home/jm_c/test_svante/output/tst_pgiMPI.stdout |
8 |
|
|
|
9 |
|
|
# $Header: $ |
10 |
|
|
# $Name: $ |
11 |
|
|
|
12 |
|
|
if test -f /etc/profile.d/modules.sh ; then |
13 |
|
|
. /etc/profile.d/modules.sh |
14 |
|
|
fi |
15 |
|
|
# Note: added "ulimit -s unlimited" in file "~/.bashrc" |
16 |
|
|
# to pass big test (the 2 fizhi-cs-* test & adjoint tests) with MPI |
17 |
|
|
|
18 |
|
|
umask 0022 |
19 |
|
|
#- to get case insensitive "ls" (and order of tested experiments) |
20 |
|
|
export LC_ALL="en_US.UTF-8" |
21 |
|
|
echo " running on: "`hostname` |
22 |
|
|
|
23 |
|
|
dNam='svante' |
24 |
|
|
HERE="$HOME/test_$dNam" |
25 |
|
|
OUTP="$HERE/output"; SavD="$HERE/send" |
26 |
|
|
SEND="ssh svante $SavD/mpack" |
27 |
|
|
TST_DIR="/net/fs09/d0/jm_c/test_${dNam}" |
28 |
|
|
|
29 |
|
|
if test -d $TST_DIR ; then |
30 |
|
|
echo "start from TST_DIR='$TST_DIR' at: "`date` |
31 |
|
|
else |
32 |
|
|
#if test ! -d /scratch/jm_c ; then mkdir /scratch/jm_c ; fi |
33 |
|
|
#if test ! -d $TST_DIR ; then mkdir $TST_DIR ; fi |
34 |
|
|
#if test ! -d $TST_DIR ; then |
35 |
|
|
# echo "ERROR: Can't create directory \"$TST_DIR\"" |
36 |
|
|
# exit 1 |
37 |
|
|
#fi |
38 |
|
|
#echo "start in new dir TST_DIR='$TST_DIR' at: "`date` |
39 |
|
|
echo "ERROR: missing directory \"$TST_DIR\"" |
40 |
|
|
exit 1 |
41 |
|
|
fi |
42 |
|
|
|
43 |
|
|
sfx='pgiMPI'; typ='' |
44 |
|
|
addExp='' |
45 |
|
|
module add pgi/15.5 |
46 |
|
|
module add openmpi |
47 |
|
|
OPTFILE="../tools/build_options/linux_amd64_pgf77" |
48 |
|
|
#- needed for DIVA with MPI: |
49 |
|
|
#export MPI_INC_DIR="/home/software/pgi/pgi-15.5/pkg/openmpi/openmpi-1.8.5/include" |
50 |
|
|
options="$typ -MPI 6" |
51 |
|
|
#- need this to get "staf": |
52 |
|
|
#export PATH="$PATH:$HOME/bin" |
53 |
|
|
|
54 |
|
|
dAlt=`date +%d` ; dAlt=`expr $dAlt % 3` |
55 |
|
|
if [ $dAlt -eq 1 ] ; then options="$options -fast" |
56 |
|
|
else options="$options -devel" ; fi |
57 |
|
|
|
58 |
|
|
checkOut=2 ; #options="$options -do" |
59 |
|
|
#options="$options -nc" ; checkOut=1 |
60 |
|
|
#options="$options -q" ; checkOut=0 |
61 |
|
|
|
62 |
|
|
#- keep a copy of MPI_MFILE: |
63 |
|
|
cp -p $PBS_NODEFILE $OUTP"/mf_"$sfx |
64 |
|
|
|
65 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
66 |
|
|
gcmDIR="MITgcm_$sfx" |
67 |
|
|
cd $TST_DIR |
68 |
|
|
#- check for disk space: relative space (99%) or absolute (10.G): |
69 |
|
|
dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
70 |
|
|
if [ $dsp -gt 99 ] ; then |
71 |
|
|
#dsp=`df -P . | tail -1 | awk '{print $4}'` |
72 |
|
|
#if [ $dsp -le 100000000 ] ; then |
73 |
|
|
echo 'Not enough space on this disk => do not run testreport.' |
74 |
|
|
df . |
75 |
|
|
exit |
76 |
|
|
fi |
77 |
|
|
if [ $checkOut -eq 1 ] ; then |
78 |
|
|
if test -d $gcmDIR/CVS ; then |
79 |
|
|
echo "cleaning output from $gcmDIR/verification :" |
80 |
|
|
#- remove previous output tar files and tar & remove previous output-dir |
81 |
|
|
/bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz |
82 |
|
|
( cd $gcmDIR/verification |
83 |
|
|
listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null` |
84 |
|
|
for dd in $listD |
85 |
|
|
do |
86 |
|
|
if test -d $dd ; then |
87 |
|
|
tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd |
88 |
|
|
RETVAL=$? |
89 |
|
|
if test "x$RETVAL" != x0 ; then |
90 |
|
|
echo "ERROR in tar+gzip prev outp-dir: $dd" |
91 |
|
|
echo " on '"`hostname`"' (return val=$RETVAL) but continue" |
92 |
|
|
fi |
93 |
|
|
fi |
94 |
|
|
done ) |
95 |
|
|
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
96 |
|
|
( cd $gcmDIR/verification ; ./testreport $typ -clean ) |
97 |
|
|
echo "cvs update of dir $gcmDIR :" |
98 |
|
|
( cd $gcmDIR ; $cmdCVS update -P -d ) 2>&1 |
99 |
|
|
RETVAL=$? |
100 |
|
|
if test "x$RETVAL" != x0 ; then |
101 |
|
|
echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" |
102 |
|
|
exit |
103 |
|
|
fi |
104 |
|
|
else |
105 |
|
|
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
106 |
|
|
checkOut=2 |
107 |
|
|
fi |
108 |
|
|
fi |
109 |
|
|
if [ $checkOut -eq 2 ] ; then |
110 |
|
|
if test -e $gcmDIR ; then |
111 |
|
|
echo -n "Removing working copy: $gcmDIR ..." |
112 |
|
|
rm -rf $gcmDIR |
113 |
|
|
echo " done" |
114 |
|
|
fi |
115 |
|
|
# make a local copy (instead of using CVS): |
116 |
|
|
today=`date +%Y%m%d` |
117 |
|
|
nCount=0; updFile='updated_code' |
118 |
|
|
updDate=0 ; test -f $updFile && updDate=`cat $updFile` |
119 |
|
|
while [ $today -gt $updDate ] ; do |
120 |
|
|
nCount=`expr $nCount + 1` |
121 |
|
|
if [ $nCount -gt 40 ] ; then |
122 |
|
|
echo " waiting too long (nCount=$nCount) for updated code" |
123 |
|
|
echo " today=$today , updDate=$updDate " |
124 |
|
|
ls -l $updFile |
125 |
|
|
exit |
126 |
|
|
fi |
127 |
|
|
sleep 60 |
128 |
|
|
updDate=0 ; test -f $updFile && updDate=`cat $updFile` |
129 |
|
|
done |
130 |
|
|
ls -l $updFile |
131 |
|
|
echo " waited nCount=$nCount for updated code ($updDate) to copy" |
132 |
|
|
if test -d MITgcm ; then |
133 |
|
|
echo -n "Make local copy of dir 'MITgcm' to: $gcmDIR ..." |
134 |
|
|
cp -pra MITgcm $gcmDIR |
135 |
|
|
echo " done" |
136 |
|
|
else echo " dir: MITgcm missing => exit" ; exit ; fi |
137 |
|
|
# cvs co MITgcm |
138 |
|
|
#echo "Downloading using '$cmdCVS co -P -d $gcmDIR MITgcm' ..." |
139 |
|
|
#$cmdCVS co -P -d $gcmDIR MITgcm > /dev/null |
140 |
|
|
#RETVAL=$? |
141 |
|
|
#if test "x$RETVAL" != x0 ; then |
142 |
|
|
# echo "cvs co on '"`hostname`"' fail (return val=$RETVAL) => exit" |
143 |
|
|
# exit |
144 |
|
|
#else echo " done" ; fi |
145 |
|
|
#if test -d $gcmDIR/verification ; then |
146 |
|
|
# for exp2add in $addExp ; do |
147 |
|
|
# echo " add dir: $exp2add (from Contrib:verification_other)" |
148 |
|
|
# ( cd $gcmDIR/verification ; $cmdCVS co -P -d $exp2add \ |
149 |
|
|
# MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
150 |
|
|
# done |
151 |
|
|
# /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
152 |
|
|
# /usr/bin/find $gcmDIR -type f | xargs chmod g+r |
153 |
|
|
#fi |
154 |
|
|
fi |
155 |
|
|
|
156 |
|
|
#- change dir to $gcmDIR/verification dir: |
157 |
|
|
if test -e $gcmDIR/verification ; then |
158 |
|
|
if [ $checkOut -lt 2 ] ; then |
159 |
|
|
echo " dir $gcmDIR/verification exist" ; fi |
160 |
|
|
cd $gcmDIR/verification |
161 |
|
|
else |
162 |
|
|
echo "no dir: $gcmDIR/verification => exit" |
163 |
|
|
exit |
164 |
|
|
fi |
165 |
|
|
|
166 |
|
|
echo '' |
167 |
|
|
echo ./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
168 |
|
|
-send \"$SEND\" -sd $SavD -a jmc@mitgcm.org |
169 |
|
|
./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
170 |
|
|
-send "$SEND" -sd $SavD -a jmc@mitgcm.org |
171 |
|
|
|
172 |
|
|
echo '' |
173 |
|
|
echo ../tools/do_tst_2+2 -mpi -o ${dNam}-$sfx \ |
174 |
|
|
-send \"$SEND\" -sd $SavD -a jmc@mitgcm.org |
175 |
|
|
../tools/do_tst_2+2 -mpi -o ${dNam}-$sfx \ |
176 |
|
|
-send "$SEND" -sd $SavD -a jmc@mitgcm.org |
177 |
|
|
|