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