1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/ACESgrid/aces_test_all,v 1.2 2007/08/08 18:47:48 jmc Exp $ |
4 |
# $Name: $ |
5 |
|
6 |
if test $# = 0 |
7 |
then |
8 |
tst_list='gnu ifc pgi mth' |
9 |
else |
10 |
tst_list=$* |
11 |
fi |
12 |
|
13 |
. /etc/profile.d/modules.sh |
14 |
module list > ~/tmp/.module_list 2>&1 |
15 |
|
16 |
cd /home/jmc/test_ACES/bin |
17 |
|
18 |
# QSUB="/usr/local/bin/qsub" |
19 |
# QSTAT="/usr/local/bin/qstat" |
20 |
QSUB=qsub |
21 |
QSTAT=qstat |
22 |
MPACK="./mpack" |
23 |
TST_DIR="/home/jmc/test_ACES/gcm_tests" |
24 |
|
25 |
nbtst=0 |
26 |
for i in $tst_list |
27 |
do |
28 |
sfx=`echo ${i}"_mpi" | sed 's/mth_mpi/ifc_mth/g'` |
29 |
if test -f ./aces_test_$sfx ; then |
30 |
$QSUB ./aces_test_$sfx |
31 |
eval M_$i='submitted' |
32 |
nbtst=`expr $nbtst + 1` |
33 |
else |
34 |
echo 'no file:' aces_test_$sfx 'to submit' |
35 |
fi |
36 |
done |
37 |
|
38 |
date_str=`date +%Y%m%d`"_0" |
39 |
|
40 |
minutes=0 |
41 |
count=$nbtst |
42 |
while test $count != 0 ; do |
43 |
|
44 |
sleep 300 |
45 |
minutes=$(( $minutes + 5 )) |
46 |
|
47 |
for i in $tst_list ; do |
48 |
|
49 |
eval comm=\$M_$i |
50 |
if test $comm = 'submitted' ; then |
51 |
JOB="tst_"$i |
52 |
ready_to_send=`$QSTAT -a | grep $USER | grep $JOB | wc -l` |
53 |
|
54 |
if test "x_$ready_to_send" = x_0 ; then |
55 |
pat="/tmp/tr_aces-$i"'*' |
56 |
rm -rf $pat |
57 |
run_dir=${TST_DIR}"/tmp_"$i"/MITgcm/verification" |
58 |
tdir=`ls -1 $run_dir | grep -v tr_out | grep '^tr' | head -1` |
59 |
if test ! "x$tdir" = x ; then |
60 |
cp -ra $run_dir"/"$tdir "/tmp/tr_aces-"$i"_"$date_str |
61 |
( cd /tmp ; tar -czf "./tr_aces-"$i".tar.gz" "./tr_aces-"$i"_"$date_str ) |
62 |
$MPACK -s MITgcm-test -m 3555000 "/tmp/tr_aces-"$i".tar.gz" jmc@mitgcm.org |
63 |
echo "Email sent for $i" |
64 |
else |
65 |
echo "Output not found so no email sent for $i" |
66 |
fi |
67 |
eval M_$i=done |
68 |
count=`expr $count - 1` |
69 |
chmod 644 ../output/tst_$i.std* |
70 |
fi |
71 |
fi |
72 |
done |
73 |
|
74 |
hrs=$(( $minutes / 60 )); |
75 |
# "long" queue is 24hrs = 24*60min = 1440min |
76 |
if test $minutes -gt 1440 ; then |
77 |
echo "Time expired after $minutes minutes ($hrs hours)" |
78 |
echo ' ' $count '/' $nbtst 'tests not yet finished' |
79 |
exit 1 |
80 |
fi |
81 |
|
82 |
done |
83 |
|
84 |
echo "All $nbtst tests completed successfully." |