1 |
#!/bin/bash |
2 |
# |
3 |
#PBS -q one |
4 |
#PBS -N tst_mp2 |
5 |
#PBS -l nodes=1:ppn=12 |
6 |
#PBS -e /mit/jm_c/test_acesgrid/output/tst_mp2.stderr |
7 |
#PBS -o /mit/jm_c/test_acesgrid/output/tst_mp2.stdout |
8 |
|
9 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/ACESgrid/test_aces_gnu_mp2,v 1.21 2014/05/08 18:44:03 jmc Exp $ |
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 "~/.tcshrc" |
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='acesgrid' |
24 |
HERE="$HOME/test_$dNam" |
25 |
OUTP="$HERE/output"; SavD="$HERE/send" |
26 |
SEND="ssh login $SavD/mpack" |
27 |
TST_DIR="/scratch/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 |
fi |
40 |
|
41 |
sfx='mp2' |
42 |
addExp='offline_cheapaml atm_gray' |
43 |
module add gcc |
44 |
module add openmpi |
45 |
OPTFILE="../tools/build_options/linux_amd64_gfortran" |
46 |
options="-j 2 -MPI 3 -mth" |
47 |
#- note: with mpich1, need to set these 2 vars in .tcshrc |
48 |
export OMP_NUM_THREADS=2 |
49 |
export GOMP_STACKSIZE=400m |
50 |
|
51 |
dAlt=`date +%d` ; dAlt=`expr $dAlt % 3` |
52 |
if [ $dAlt -eq 1 ] ; then options="$options -fast" ; fi |
53 |
|
54 |
checkOut=2 |
55 |
#options="$options -nc" ; checkOut=1 |
56 |
#options="$options -q" ; checkOut=0 |
57 |
|
58 |
#- keep a copy of MPI_MFILE: |
59 |
cp -p $PBS_NODEFILE $OUTP"/mf_"$sfx |
60 |
|
61 |
cvsArg="-d :pserver:cvsanon@mitgcm.org:/u/gcmpack" |
62 |
gcmDIR="MITgcm_$sfx" |
63 |
cd $TST_DIR |
64 |
#- check for disk space: relative space (99%) or absolute (10.G): |
65 |
dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
66 |
if [ $dsp -gt 99 ] ; then |
67 |
#dsp=`df -P . | tail -1 | awk '{print $4}'` |
68 |
#if [ $dsp -le 100000000 ] ; then |
69 |
echo 'Not enough space on this disk => do not run testreport.' |
70 |
df . |
71 |
exit |
72 |
fi |
73 |
if [ $checkOut -eq 1 ] ; then |
74 |
if test -d $gcmDIR/CVS ; then |
75 |
#- remove previous output tar files and tar & remove previous output-dir |
76 |
/bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz |
77 |
( cd $gcmDIR/verification |
78 |
listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null` |
79 |
for dd in $listD |
80 |
do |
81 |
if test -d $dd ; then |
82 |
tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd |
83 |
RETVAL=$? |
84 |
if test "x$RETVAL" != x0 ; then |
85 |
echo "ERROR in tar+gzip prev outp-dir: $dd" |
86 |
echo " on '"`hostname`"' (return val=$RETVAL) but continue" |
87 |
fi |
88 |
fi |
89 |
done ) |
90 |
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
91 |
echo "cvs update of dir $gcmDIR :" |
92 |
( cd $gcmDIR ; cvs -q $cvsArg update -P -d ) 2>&1 |
93 |
RETVAL=$? |
94 |
if test "x$RETVAL" != x0 ; then |
95 |
echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" |
96 |
exit |
97 |
fi |
98 |
else |
99 |
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
100 |
checkOut=2 |
101 |
fi |
102 |
fi |
103 |
if [ $checkOut -eq 2 ] ; then |
104 |
if test -e $gcmDIR ; then |
105 |
rm -rf $gcmDIR |
106 |
fi |
107 |
# cvs co MITgcm |
108 |
cvs $cvsArg co -P -d $gcmDIR MITgcm > /dev/null 2>&1 |
109 |
for exp2add in $addExp ; do |
110 |
echo " add dir: $exp2add (from Contrib:verification_other)" |
111 |
( cd $gcmDIR/verification ; cvs $cvsArg co -P -d $exp2add \ |
112 |
MITgcm_contrib/verification_other/$exp2add > /dev/null 2>&1 ) |
113 |
done |
114 |
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
115 |
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
116 |
fi |
117 |
|
118 |
#- change dir to $gcmDIR/verification dir: |
119 |
if test -e $gcmDIR/verification ; then |
120 |
if [ $checkOut -lt 2 ] ; then |
121 |
echo " dir $gcmDIR/verification exist" ; fi |
122 |
cd $gcmDIR/verification |
123 |
else |
124 |
echo "no dir: $gcmDIR/verification => exit" |
125 |
exit |
126 |
fi |
127 |
|
128 |
#-- in case 1 proc get stuck, run this script in background to check |
129 |
check_sh=check_aces_$sfx |
130 |
if test -x $OUTP/$check_sh ; then |
131 |
echo "start $check_sh in background" |
132 |
mv -f $OUTP/${check_sh}.log $OUTP/${check_sh}.log_bak |
133 |
( cd $OUTP ; ./$check_sh > ${check_sh}.log 2>&1 ) & |
134 |
fi |
135 |
|
136 |
echo ./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
137 |
-send \"$SEND\" -sd $SavD -a jmc@mitgcm.org |
138 |
./testreport $options -of $OPTFILE -odir ${dNam}-$sfx \ |
139 |
-send "$SEND" -sd $SavD -a jmc@mitgcm.org |
140 |
|
141 |
echo '' |
142 |
echo ../tools/do_tst_2+2 -mpi -o ${dNam}-$sfx \ |
143 |
-send \"$SEND\" -sd $SavD -a jmc@mitgcm.org |
144 |
../tools/do_tst_2+2 -mpi -o ${dNam}-$sfx \ |
145 |
-send "$SEND" -sd $SavD -a jmc@mitgcm.org |