8 |
|
|
9 |
if test $# = 0 |
if test $# = 0 |
10 |
then |
then |
11 |
TEST_LIST='ifcMPI pgiMPI pgiAdm pgiMth' |
TEST_LIST='ifcMPI ifcAdm pgiMPI pgiAdm pgiMth' |
12 |
else |
else |
13 |
TEST_LIST=$* |
TEST_LIST=$* |
14 |
fi |
fi |
15 |
|
|
16 |
headNode=`hostname -s` |
headNode=`hostname -s` |
17 |
#QSUB="qsub" |
#QSUB="qsub" |
18 |
#QSTAT="qstat -u $USER" |
#QLIST="qstat -u $USER" |
19 |
#dNam=$headNode |
#dNam=$headNode |
20 |
QSUB="/usr/bin/sbatch" |
QSUB="/usr/bin/sbatch" |
21 |
QLIST="/usr/bin/squeue -u $USER" |
QLIST="/usr/bin/squeue -u $USER" |
69 |
#- method to access CVS: |
#- method to access CVS: |
70 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
71 |
#- which GitHub repository to use and how to access it: |
#- which GitHub repository to use and how to access it: |
72 |
git_repo='MITgcm'; git_code='MITgcm' |
git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other' |
73 |
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
74 |
#-- |
#-- |
75 |
git_repo="https://github.com/$git_repo" |
git_repo="https://github.com/$git_repo" |
107 |
test -e $srcCode && rm -rf $srcCode |
test -e $srcCode && rm -rf $srcCode |
108 |
|
|
109 |
if [ $checkOut -eq 1 ] ; then |
if [ $checkOut -eq 1 ] ; then |
110 |
if test -e $git_code/.git/config ; then |
if test ! -e $git_code/.git/config ; then |
111 |
( cd $git_code ; git checkout master ) | tee -a $LOG_FIL |
echo "no file: $git_code/.git/config => try a new clone" | tee -a $LOG_FIL |
112 |
echo -n "Updating current clone ( $git_code ) ..." | tee -a $LOG_FIL |
checkOut=2 |
113 |
echo '' >> $LOG_FIL |
fi |
114 |
( cd $git_code ; git pull ) >> $LOG_FIL 2>&1 |
if test ! -e $git_other/.git/config ; then |
115 |
retVal=$? |
echo "no file: $git_other/.git/config => try a new clone" | tee -a $LOG_FIL |
|
if test "x$retVal" != x0 ; then echo '' |
|
|
echo "'git pull' on '"`hostname`"' fail (return val=$retVal) => exit" | tee -a $LOG_FIL |
|
|
exit |
|
|
else echo " done" | tee -a $LOG_FIL |
|
|
fi |
|
|
else |
|
|
echo "missing file: $git_code/.git/config => try a new clone" | tee -a $LOG_FIL |
|
116 |
checkOut=2 |
checkOut=2 |
117 |
fi |
fi |
118 |
fi |
fi |
119 |
if [ $checkOut -eq 2 ] ; then |
if [ $checkOut -eq 2 ] ; then |
120 |
if test -e $git_code ; then |
if test -e $git_code ; then |
121 |
echo -n " removing dir: $git_code ..." | tee -a $LOG_FIL |
echo -n " removing dir: $git_code ..." | tee -a $LOG_FIL |
122 |
rm -rf $git_code |
rm -rf $git_code |
123 |
echo " done" | tee -a $LOG_FIL |
echo " done" | tee -a $LOG_FIL |
124 |
fi |
fi |
125 |
echo -n "Make a clone of $git_code from repo: $git_repo ..." | tee -a $LOG_FIL |
echo -n "Make a clone of $git_code from repo: $git_repo ..." | tee -a $LOG_FIL |
126 |
git clone $git_repo/${git_code}.git 2> $tmpFil |
git clone $git_repo/${git_code}.git 2> $tmpFil |
133 |
cat $tmpFil ; rm -f $tmpFil |
cat $tmpFil ; rm -f $tmpFil |
134 |
exit 2 |
exit 2 |
135 |
fi |
fi |
136 |
|
#-- |
137 |
|
if test -e $git_other ; then |
138 |
|
echo -n " removing dir: $git_other ..." | tee -a $LOG_FIL |
139 |
|
rm -rf $git_other |
140 |
|
echo " done" | tee -a $LOG_FIL |
141 |
|
fi |
142 |
|
echo -n "Make a clone of $git_other from repo: $git_repo ..." | tee -a $LOG_FIL |
143 |
|
git clone $git_repo/${git_other}.git 2> $tmpFil |
144 |
|
retVal=$? |
145 |
|
if test $retVal = 0 ; then |
146 |
|
echo ' --> done!' | tee -a $LOG_FIL |
147 |
|
rm -f $tmpFil |
148 |
|
else echo '' | tee -a $LOG_FIL |
149 |
|
echo " Error: 'git clone' returned: $retVal" | tee -a $LOG_FIL |
150 |
|
cat $tmpFil ; rm -f $tmpFil |
151 |
|
exit 2 |
152 |
|
fi |
153 |
|
fi |
154 |
|
#-- |
155 |
|
if [ $checkOut -eq 1 ] ; then |
156 |
|
echo -n "Updating current clone ( $git_code ) ..." | tee -a $LOG_FIL |
157 |
|
echo '' >> $LOG_FIL |
158 |
|
( cd $git_code ; git pull ) >> $LOG_FIL 2>&1 |
159 |
|
retVal=$? |
160 |
|
if test "x$retVal" != x0 ; then echo '' |
161 |
|
echo "'git pull' on '"`hostname`"' fail (return val=$retVal) => exit" | tee -a $LOG_FIL |
162 |
|
exit |
163 |
|
else echo " done" | tee -a $LOG_FIL |
164 |
|
fi |
165 |
|
echo " and checkout master:" | tee -a $LOG_FIL |
166 |
|
( cd $git_code ; git checkout master -- . ) | tee -a $LOG_FIL |
167 |
|
#--- |
168 |
|
echo -n "Updating current clone ( $git_other ) ..." | tee -a $LOG_FIL |
169 |
|
echo '' >> $LOG_FIL |
170 |
|
( cd $git_other ; git pull ) >> $LOG_FIL 2>&1 |
171 |
|
retVal=$? |
172 |
|
if test "x$retVal" != x0 ; then echo '' |
173 |
|
echo "'git pull' on '"`hostname`"' fail (return val=$retVal) => exit" | tee -a $LOG_FIL |
174 |
|
exit |
175 |
|
else echo " done" | tee -a $LOG_FIL |
176 |
|
fi |
177 |
|
echo " and checkout master:" | tee -a $LOG_FIL |
178 |
|
( cd $git_other ; git checkout master -- . ) | tee -a $LOG_FIL |
179 |
fi |
fi |
180 |
#---- making a new working copy: MITgcm_today |
#---- making a new working copy: MITgcm_today |
181 |
rsync -a $git_code/ $srcCode --exclude '.git' |
rsync -a $git_code/ $srcCode --exclude '.git' |
182 |
ls -ld $srcCode | tee -a $LOG_FIL |
ls -ld $srcCode | tee -a $LOG_FIL |
|
if test -d $srcCode/verification ; then |
|
|
for exp2add in $addExp ; do |
|
|
echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL |
|
|
( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \ |
|
|
MITgcm_contrib/verification_other/$exp2add > /dev/null ) |
|
|
done |
|
|
fi |
|
183 |
/usr/bin/find $srcCode -type d | xargs chmod g+rxs |
/usr/bin/find $srcCode -type d | xargs chmod g+rxs |
184 |
/usr/bin/find $srcCode -type f | xargs chmod g+r |
/usr/bin/find $srcCode -type f | xargs chmod g+r |
185 |
#- update date/lock-file: |
#- update date/lock-file: |
202 |
for i in $JOB_LIST |
for i in $JOB_LIST |
203 |
do |
do |
204 |
case $i in |
case $i in |
|
'pgiAdm') sfx='pgi_adm' ;; |
|
205 |
'pgiMth') sfx='pgi_mth' ;; |
'pgiMth') sfx='pgi_mth' ;; |
206 |
*) sfx=`echo ${i} | sed 's/MPI$/_mpi/'` ;; |
*) sfx=`echo ${i} | sed 's/MPI$/_mpi/' | sed 's/Adm$/_adm/'` ;; |
207 |
esac |
esac |
208 |
BATCH_SCRIPT="test_${dNam}_$sfx" |
BATCH_SCRIPT="test_${dNam}_$sfx" |
209 |
if test -f $SUB_DIR/$BATCH_SCRIPT ; then |
if test -f $SUB_DIR/$BATCH_SCRIPT ; then |
211 |
# definition within $BATCH_SCRIPT slurm script |
# definition within $BATCH_SCRIPT slurm script |
212 |
JOB="${i}_tst" |
JOB="${i}_tst" |
213 |
sJob=`printf "%8.8s" $JOB` #- squeue truncate name to only 1rst 8c |
sJob=`printf "%8.8s" $JOB` #- squeue truncate name to only 1rst 8c |
214 |
#job_exist=`$QSTAT | grep $JOB | wc -l` |
#job_exist=`$QLIST | grep $JOB | wc -l` |
215 |
job_exist=`$QLIST | grep $sJob | wc -l` |
job_exist=`$QLIST | grep $sJob | wc -l` |
216 |
if test "x_$job_exist" = x_0 ; then |
if test "x_$job_exist" = x_0 ; then |
217 |
#-- move previous output file |
#-- move previous output file |
232 |
else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL |
else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL |
233 |
fi |
fi |
234 |
#-- submit job |
#-- submit job |
235 |
echo -n "--> $JOB : " | tee -a $LOG_FIL |
echo -n "--> $JOB : $BATCH_SCRIPT , " | tee -a $LOG_FIL |
236 |
$QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL |
$QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL |
237 |
NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1` |
NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1` |
238 |
sleep 1 |
sleep 1 |
239 |
else |
else |
240 |
echo "--> $JOB :" | tee -a $LOG_FIL |
echo "--> $JOB :" | tee -a $LOG_FIL |
|
#$QSTAT | grep $JOB | tee -a $LOG_FIL |
|
241 |
$QLIST | grep $sJob | tee -a $LOG_FIL |
$QLIST | grep $sJob | tee -a $LOG_FIL |
242 |
echo ' job already exist => skip this test' | tee -a $LOG_FIL |
echo ' job already exist => skip this test' | tee -a $LOG_FIL |
243 |
fi |
fi |
245 |
echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL |
echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL |
246 |
fi |
fi |
247 |
done |
done |
248 |
echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL |
#echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL |
249 |
|
echo "Submitted $NB_SUB_JOBS jobs from dir: $SUB_DIR" | tee -a $LOG_FIL |
250 |
echo -n '-- Finished at: ' | tee -a $LOG_FIL |
echo -n '-- Finished at: ' | tee -a $LOG_FIL |
251 |
date | tee -a $LOG_FIL |
date | tee -a $LOG_FIL |
252 |
|
|