1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/ACESgrid/aces_test_all,v 1.7 2008/02/26 21:52:16 jmc Exp $ |
4 |
# $Name: $ |
5 |
|
6 |
echo -n '-- Starting: ' |
7 |
date |
8 |
start=`date +%Y%m%d` |
9 |
if test $# = 0 |
10 |
then |
11 |
tst_list='gnu ifc pgi mth tuv' |
12 |
else |
13 |
tst_list=$* |
14 |
fi |
15 |
|
16 |
. /etc/profile.d/modules.sh |
17 |
module list > ~/tmp/.module_list 2>&1 |
18 |
|
19 |
cd /home/jmc/test_ACES |
20 |
|
21 |
# QSUB="/usr/local/bin/qsub" |
22 |
# QSTAT="/usr/local/bin/qstat" |
23 |
QSUB=qsub |
24 |
QSTAT=qstat |
25 |
MPACK="MITgcm_tools/mpack-1.6/mpack" |
26 |
TST_DIR="/home/jmc/test_ACES/gcm_tests" |
27 |
|
28 |
nbtst=0 |
29 |
for i in $tst_list |
30 |
do |
31 |
sfx=`echo ${i}"_mpi" | sed 's/mth_mpi/ifc_mth/' | sed 's/tuv_mpi/op64_tuv/'` |
32 |
if test -f MITgcm_tools/example_scripts/ACESgrid/aces_test_$sfx ; then |
33 |
JOB="tst_"$i |
34 |
job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l` |
35 |
if test "x_$job_exist" = x_0 ; then |
36 |
$QSUB MITgcm_tools/example_scripts/ACESgrid/aces_test_$sfx |
37 |
eval M_$i='submitted' |
38 |
nbtst=`expr $nbtst + 1` |
39 |
else |
40 |
echo $JOB |
41 |
$QSTAT -a | grep $USER | grep $JOB |
42 |
echo 'job already exist => skip this test' |
43 |
eval M_$i='skipped' |
44 |
fi |
45 |
else |
46 |
echo 'no file:' aces_test_$sfx 'to submit' |
47 |
eval M_$i='skipped' |
48 |
fi |
49 |
done |
50 |
|
51 |
#date_str=`date +%Y%m%d`"_0" |
52 |
|
53 |
MPACKDIR=`dirname $MPACK` |
54 |
#- build the mpack utility (from build_mpack in testreport): |
55 |
( cd $MPACKDIR && ./configure && make ) > TTT.build_mpack.$$ 2>&1 |
56 |
RETVAL=$? |
57 |
if test "x$RETVAL" != x0 ; then |
58 |
echo |
59 |
echo "Error building the mpack tools at: $MPACK_DIR" |
60 |
if test -x $MPACK ; then |
61 |
HAVE_MPACK=t |
62 |
echo " use (old ?) executable:" ; ls -l $MPACK |
63 |
else |
64 |
HAVE_MPACK=f |
65 |
fi |
66 |
else |
67 |
if test -x $MPACK ; then |
68 |
rm -f TTT.build_mpack.$$ |
69 |
HAVE_MPACK=t |
70 |
echo " building mpack: OK" |
71 |
else |
72 |
echo " $MPACK not executable" |
73 |
HAVE_MPACK=f |
74 |
fi |
75 |
fi |
76 |
echo |
77 |
|
78 |
minutes=0 |
79 |
count=$nbtst |
80 |
while test $count != 0 ; do |
81 |
|
82 |
sleep 600 |
83 |
minutes=$(( $minutes + 10 )) |
84 |
|
85 |
for i in $tst_list ; do |
86 |
|
87 |
eval comm=\$M_$i |
88 |
if test $comm = 'submitted' ; then |
89 |
JOB="tst_"$i |
90 |
ready_to_send=`$QSTAT -a | grep $USER | grep $JOB | wc -l` |
91 |
|
92 |
if test "x_$ready_to_send" = x_0 ; then |
93 |
run_dir=${TST_DIR}"/MITgcm_"$i"/verification" |
94 |
tdir=`ls -1 -t $run_dir | grep -v tr_out | grep '^tr_aces' | head -1` |
95 |
#- check this is the right output |
96 |
chk=`echo $tdir | grep -c $start` |
97 |
if test $chk = '0' ; then |
98 |
curday=`date +%Y%m%d` |
99 |
chk=`echo $tdir | grep -c $curday` |
100 |
fi |
101 |
if test "x$tdir" = x ; then |
102 |
echo "Output not found so no email sent for $i" |
103 |
elif test $chk = '0' ; then |
104 |
echo "tdir='$tdir'" |
105 |
echo "Output do not match so no email sent for $i" |
106 |
else |
107 |
rm -f "/tmp/tr_aces-"$i".tar.gz" |
108 |
( cd $run_dir ; tar -czf "/tmp/tr_aces-"$i".tar.gz" ./$tdir ) |
109 |
if test "x$HAVE_MPACK" = xt ; then |
110 |
$MPACK -s MITgcm-test -m 3555000 "/tmp/tr_aces-"$i".tar.gz" jmc@mitgcm.org |
111 |
echo "Email sent for $i" |
112 |
else |
113 |
echo "no email sent for $i (no mpack)" |
114 |
fi |
115 |
fi |
116 |
eval M_$i=done |
117 |
count=`expr $count - 1` |
118 |
chmod 644 output/tst_$i.std* |
119 |
fi |
120 |
fi |
121 |
done |
122 |
|
123 |
# "long" queue is 24hrs = 24*60min = 1440min |
124 |
if test $minutes -gt 2160 ; then |
125 |
hrs=$(( $minutes / 60 )); |
126 |
echo "Time expired after $minutes minutes ($hrs hours)" |
127 |
echo ' ' $count '/' $nbtst 'tests not yet finished' |
128 |
exit 1 |
129 |
fi |
130 |
|
131 |
done |
132 |
|
133 |
echo "All $nbtst tests completed successfully." |
134 |
echo -n '-- Finished: ' |
135 |
date |