8 |
|
|
9 |
if test $# = 0 |
if test $# = 0 |
10 |
then |
then |
11 |
TEST_LIST='pgiMPI' |
TEST_LIST='ifcMPI pgiMPI pgiAdm pgiMth' |
|
#if test "x$dInWeek" = xSun ; then TEST_LIST="$TEST_LIST iad ifc oad" ; fi |
|
12 |
else |
else |
13 |
TEST_LIST=$* |
TEST_LIST=$* |
14 |
fi |
fi |
15 |
|
|
16 |
QSUB="qsub" |
headNode=`hostname -s` |
17 |
QSTAT="qstat" |
#QSUB="qsub" |
18 |
dNam=`hostname -s` |
#QSTAT="qstat -u $USER" |
19 |
|
#dNam=$headNode |
20 |
|
QSUB="/usr/bin/sbatch" |
21 |
|
QLIST="/usr/bin/squeue -u $USER" |
22 |
|
dNam='svante' |
23 |
HERE="$HOME/test_${dNam}" |
HERE="$HOME/test_${dNam}" |
24 |
TST_DISK="/net/fs09/d0/jm_c" |
TST_DISK="/net/fs09/d1/jm_c" |
25 |
TST_DIR="$TST_DISK/test_${dNam}" |
TST_DIR="$TST_DISK/test_${dNam}" |
26 |
logPfix='test_submit' |
#- where local copy of code is (need to be consistent with run-job scripts): |
27 |
|
#srcDIR=$TST_DIR |
28 |
|
srcDIR=$HERE |
29 |
|
srcCode="MITgcm_today" |
30 |
|
|
31 |
|
logPfix='test_submit' |
32 |
SUB_DIR="$HERE/$dNam" |
SUB_DIR="$HERE/$dNam" |
33 |
OUT_DIR="$HERE/output" |
OUT_DIR="$HERE/output" |
34 |
LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log" |
LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log" |
58 |
# Turn off stack limit for FIZHI & AD-tests |
# Turn off stack limit for FIZHI & AD-tests |
59 |
ulimit -s unlimited |
ulimit -s unlimited |
60 |
|
|
61 |
if test -f /etc/profile.d/modules.sh ; then |
if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi |
62 |
. /etc/profile.d/modules.sh |
if test -f /etc/profile.d/zz_modules.sh ; then . /etc/profile.d/zz_modules.sh ; fi |
|
fi |
|
63 |
#- load standard modules: |
#- load standard modules: |
64 |
module add fedora torque maui svante |
#module add fedora slurm maui svante |
65 |
|
module add slurm |
66 |
module list >> $LOG_FIL 2>&1 |
module list >> $LOG_FIL 2>&1 |
67 |
|
|
68 |
#- method to acces CVS: |
#- method to acces CVS: |
71 |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
#---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
72 |
#-- Download/Update reference version of MITgcm code: |
#-- Download/Update reference version of MITgcm code: |
73 |
checkOut=1 |
checkOut=1 |
|
gcmDIR='MITgcm' |
|
74 |
exp2add='' |
exp2add='' |
75 |
updFile='updated_code' |
updFile='updated_code' |
76 |
|
|
77 |
cd $TST_DISK | tee -a $LOG_FIL 2>&1 |
if test $srcDIR = $TST_DIR ; then |
78 |
pwd | tee -a $LOG_FIL |
echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL |
79 |
if test ! -d $TST_DIR ; then |
cd $TST_DISK | tee -a $LOG_FIL 2>&1 |
80 |
echo -n "Creating a working dir: $TST_DIR ..." | tee -a $LOG_FIL |
pwd | tee -a $LOG_FIL |
81 |
#/bin/rm -rf $TST_DIR |
fi |
82 |
mkdir $TST_DIR |
if test ! -d $srcDIR ; then |
83 |
|
echo -n "Creating a working dir: $srcDIR ..." | tee -a $LOG_FIL |
84 |
|
#/bin/rm -rf $srcDIR |
85 |
|
mkdir $srcDIR |
86 |
retVal=$? |
retVal=$? |
87 |
if test "x$retVal" != x0 ; then |
if test "x$retVal" != x0 ; then |
88 |
echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL |
echo "Error: unable to make dir: $srcDIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL |
89 |
exit 1 |
exit 1 |
90 |
fi |
fi |
91 |
fi |
fi |
92 |
cd $TST_DIR |
cd $srcDIR |
93 |
|
pwd | tee -a $LOG_FIL |
94 |
|
|
95 |
#- remove date/lock-file: |
#- remove date/lock-file: |
96 |
if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi |
if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi |
97 |
|
|
98 |
if [ $checkOut -eq 1 ] ; then |
if [ $checkOut -eq 1 ] ; then |
99 |
if test -d $gcmDIR/CVS ; then |
if test -d $srcCode/CVS ; then |
100 |
echo -n "Update dir $gcmDIR using '$cmdCVS update -P -d' ..." | tee -a $LOG_FIL |
echo -n "Update dir $srcCode using '$cmdCVS update -P -d' ..." | tee -a $LOG_FIL |
101 |
echo '' >> $LOG_FIL |
echo '' >> $LOG_FIL |
102 |
( cd $gcmDIR ; $cmdCVS update -P -d ) >> $LOG_FIL 2>&1 |
( cd $srcCode ; $cmdCVS update -P -d ) >> $LOG_FIL 2>&1 |
103 |
RETVAL=$? |
RETVAL=$? |
104 |
if test "x$RETVAL" != x0 ; then echo '' |
if test "x$RETVAL" != x0 ; then echo '' |
105 |
echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL |
echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL |
107 |
else echo " done" | tee -a $LOG_FIL |
else echo " done" | tee -a $LOG_FIL |
108 |
fi |
fi |
109 |
else |
else |
110 |
echo "no dir: $gcmDIR/CVS => try a fresh check-out" | tee -a $LOG_FIL |
echo "no dir: $srcCode/CVS => try a fresh check-out" | tee -a $LOG_FIL |
111 |
checkOut=2 |
checkOut=2 |
112 |
fi |
fi |
113 |
fi |
fi |
114 |
if [ $checkOut -eq 2 ] ; then |
if [ $checkOut -eq 2 ] ; then |
115 |
test -e $gcmDIR && rm -rf $gcmDIR |
test -e $srcCode && rm -rf $srcCode |
116 |
echo -n "Downloading using '$cmdCVS co -P -d $gcmDIR MITgcm' ..." | tee -a $LOG_FIL |
echo -n "Downloading using '$cmdCVS co -P -d $srcCode MITgcm' ..." | tee -a $LOG_FIL |
117 |
$cmdCVS co -P -d $gcmDIR MITgcm > /dev/null |
$cmdCVS co -P -d $srcCode MITgcm > /dev/null |
118 |
RETVAL=$? |
RETVAL=$? |
119 |
if test "x$RETVAL" != x0 ; then echo '' | tee -a $LOG_FIL |
if test "x$RETVAL" != x0 ; then echo '' | tee -a $LOG_FIL |
120 |
echo "cvs co on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL |
echo "cvs co on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL |
121 |
exit |
exit |
122 |
else echo " done" | tee -a $LOG_FIL |
else echo " done" | tee -a $LOG_FIL |
123 |
fi |
fi |
124 |
if test -d $gcmDIR/verification ; then |
if test -d $srcCode/verification ; then |
125 |
for exp2add in $addExp ; do |
for exp2add in $addExp ; do |
126 |
echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL |
echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL |
127 |
( cd $gcmDIR/verification ; $cmdCVS co -P -d $exp2add \ |
( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \ |
128 |
MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
129 |
done |
done |
130 |
fi |
fi |
131 |
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
/usr/bin/find $srcCode -type d | xargs chmod g+rxs |
132 |
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
/usr/bin/find $srcCode -type f | xargs chmod g+r |
133 |
fi |
fi |
134 |
|
|
135 |
#- update date/lock-file: |
#- update date/lock-file: |
136 |
if test -d $gcmDIR/verification ; then |
if test -d $srcCode/verification ; then |
137 |
echo $today > $updFile ; sleep 2 |
echo $today > $updFile ; sleep 2 |
138 |
ls -l $updFile | tee -a $LOG_FIL |
ls -l $updFile | tee -a $LOG_FIL |
139 |
fi |
fi |
148 |
for i in $JOB_LIST |
for i in $JOB_LIST |
149 |
do |
do |
150 |
case $i in |
case $i in |
|
'pgiMPI') sfx='pgi_mpi' ;; |
|
151 |
'pgiAdm') sfx='pgi_adm' ;; |
'pgiAdm') sfx='pgi_adm' ;; |
152 |
*) sfx=${i}'_mpi' ;; |
'pgiMth') sfx='pgi_mth' ;; |
153 |
|
*) sfx=`echo ${i} | sed 's/MPI$/_mpi/'` ;; |
154 |
esac |
esac |
155 |
BATCH_SCRIPT="test_svante_$sfx" |
BATCH_SCRIPT="test_${dNam}_$sfx" |
156 |
if test -f $SUB_DIR/$BATCH_SCRIPT ; then |
if test -f $SUB_DIR/$BATCH_SCRIPT ; then |
157 |
JOB="tst_"$i |
#- job name ( $JOB ) & output-file name ( $JOB.std??? ) must match |
158 |
job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l` |
# definition within $BATCH_SCRIPT slurm script |
159 |
|
JOB="${i}_tst" |
160 |
|
sJob=`printf "%8.8s" $JOB` #- squeue truncate name to only 1rst 8c |
161 |
|
#job_exist=`$QSTAT | grep $JOB | wc -l` |
162 |
|
job_exist=`$QLIST | grep $sJob | wc -l` |
163 |
if test "x_$job_exist" = x_0 ; then |
if test "x_$job_exist" = x_0 ; then |
164 |
#-- move previous output file |
#-- move previous output file |
165 |
outList=`ls $JOB.std??? 2> /dev/null` |
outList=`ls $JOB.std??? 2> /dev/null` |
184 |
NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1` |
NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1` |
185 |
else |
else |
186 |
echo "--> $JOB :" | tee -a $LOG_FIL |
echo "--> $JOB :" | tee -a $LOG_FIL |
187 |
$QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL |
#$QSTAT | grep $JOB | tee -a $LOG_FIL |
188 |
|
$QLIST | grep $sJob | tee -a $LOG_FIL |
189 |
echo ' job already exist => skip this test' | tee -a $LOG_FIL |
echo ' job already exist => skip this test' | tee -a $LOG_FIL |
190 |
fi |
fi |
191 |
else |
else |