/[MITgcm]/MITgcm_contrib/test_scripts/svante/test_submit_svante
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/svante/test_submit_svante

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Wed Jan 27 22:45:34 2016 UTC (9 years, 5 months ago) by jmc
Branch: MAIN
Changes since 1.1: +7 -4 lines
add a "cd" to /net/fs09/d0 disk before checking if dir there exist

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.2 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_submit_svante,v 1.1 2015/11/08 17:33:13 jmc Exp $
4 jmc 1.1 # $Name: $
5    
6     today=`date +%Y%m%d`
7     dInWeek=`date +%a`
8    
9     if test $# = 0
10     then
11     TEST_LIST='pgiMPI'
12     #if test "x$dInWeek" = xSun ; then TEST_LIST="$TEST_LIST iad ifc oad" ; fi
13     else
14     TEST_LIST=$*
15     fi
16    
17     QSUB="qsub"
18     QSTAT="qstat"
19     dNam=`hostname -s`
20 jmc 1.2 HERE="$HOME/test_${dNam}"
21     TST_DISK="/net/fs09/d0/jm_c"
22     TST_DIR="$TST_DISK/test_${dNam}"
23 jmc 1.1 logPfix='test_submit'
24    
25     SUB_DIR="$HERE/$dNam"
26     OUT_DIR="$HERE/output"
27     LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
28     #SUB_DIR="$HERE/temp"
29    
30     #-- clean up old log files and start a new one:
31     cd $OUT_DIR
32    
33     rm -f $logPfix.*.log_bak
34     if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
35     echo -n '-- Starting: ' | tee -a $LOG_FIL
36     date | tee -a $LOG_FIL
37    
38     n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
39     if test $n -gt 0 ; then
40     echo ' remove old log files:' | tee -a $LOG_FIL
41     ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL
42     ls -t $logPfix.*.log | tail -"$n" | xargs rm -f
43     fi
44    
45     #-------------------------------------------------------------
46     # defaults
47     #export PATH="$PATH:/usr/local/bin"
48     if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi
49     #- to get case insensitive "ls" (and order of tested experiments)
50     export LC_ALL="en_US.UTF-8"
51     # Turn off stack limit for FIZHI & AD-tests
52     ulimit -s unlimited
53    
54     if test -f /etc/profile.d/modules.sh ; then
55     . /etc/profile.d/modules.sh
56     fi
57     #- load standard modules:
58     module add fedora torque maui svante
59     module list >> $LOG_FIL 2>&1
60    
61     #- method to acces CVS:
62     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
63    
64     #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
65     #-- Download/Update reference version of MITgcm code:
66     checkOut=1
67     gcmDIR='MITgcm'
68     exp2add=''
69     updFile='updated_code'
70    
71 jmc 1.2 cd $TST_DISK | tee -a $LOG_FIL 2>&1
72     pwd | tee -a $LOG_FIL
73 jmc 1.1 if test ! -d $TST_DIR ; then
74     echo -n "Creating a working dir: $TST_DIR ..." | tee -a $LOG_FIL
75 jmc 1.2 #/bin/rm -rf $TST_DIR
76 jmc 1.1 mkdir $TST_DIR
77     retVal=$?
78     if test "x$retVal" != x0 ; then
79     echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL
80     exit 1
81     fi
82     fi
83     cd $TST_DIR
84    
85     #- remove date/lock-file:
86     if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi
87    
88     if [ $checkOut -eq 1 ] ; then
89     if test -d $gcmDIR/CVS ; then
90     echo -n "Update dir $gcmDIR using '$cmdCVS update -P -d' ..." | tee -a $LOG_FIL
91     echo '' >> $LOG_FIL
92     ( cd $gcmDIR ; $cmdCVS update -P -d ) >> $LOG_FIL 2>&1
93     RETVAL=$?
94     if test "x$RETVAL" != x0 ; then echo ''
95     echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL
96     exit
97     else echo " done" | tee -a $LOG_FIL
98     fi
99     else
100     echo "no dir: $gcmDIR/CVS => try a fresh check-out" | tee -a $LOG_FIL
101     checkOut=2
102     fi
103     fi
104     if [ $checkOut -eq 2 ] ; then
105     test -e $gcmDIR && rm -rf $gcmDIR
106     echo -n "Downloading using '$cmdCVS co -P -d $gcmDIR MITgcm' ..." | tee -a $LOG_FIL
107     $cmdCVS co -P -d $gcmDIR MITgcm > /dev/null
108     RETVAL=$?
109     if test "x$RETVAL" != x0 ; then echo '' | tee -a $LOG_FIL
110     echo "cvs co on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL
111     exit
112     else echo " done" | tee -a $LOG_FIL
113     fi
114     if test -d $gcmDIR/verification ; then
115     for exp2add in $addExp ; do
116     echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL
117     ( cd $gcmDIR/verification ; $cmdCVS co -P -d $exp2add \
118     MITgcm_contrib/verification_other/$exp2add > /dev/null )
119     done
120     fi
121     /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs
122     /usr/bin/find $gcmDIR -type f | xargs chmod g+r
123     fi
124    
125     #- update date/lock-file:
126     if test -d $gcmDIR/verification ; then
127     echo $today > $updFile ; sleep 2
128     ls -l $updFile | tee -a $LOG_FIL
129     fi
130    
131     #-- leave TST Dir and go back to output dir
132     cd $OUT_DIR
133     #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
134     #-- now really do something:
135    
136     JOB_LIST=$TEST_LIST
137     NB_SUB_JOBS=0
138     for i in $JOB_LIST
139     do
140     case $i in
141     'pgiMPI') sfx='pgi_mpi' ;;
142     'pgiAdm') sfx='pgi_adm' ;;
143     *) sfx=${i}'_mpi' ;;
144     esac
145     BATCH_SCRIPT="test_svante_$sfx"
146     if test -f $SUB_DIR/$BATCH_SCRIPT ; then
147     JOB="tst_"$i
148     job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l`
149     if test "x_$job_exist" = x_0 ; then
150     #-- move previous output file
151     outList=`ls $JOB.std??? 2> /dev/null`
152     if test "x$outList" != x ; then
153     echo -n " moving job $JOB old output files:" | tee -a $LOG_FIL
154     if test -d $OUT_DIR/prev ; then
155     for xx in $outList ; do
156     pp=$OUT_DIR/prev/$xx ; echo -n " $xx" | tee -a $LOG_FIL
157     test -f $pp.sav && mv -f $pp.sav $pp.old
158     test -f $pp && mv -f $pp $pp.sav
159     chmod a+r $xx ; mv -f $xx $OUT_DIR/prev
160     done
161     echo " to dir ./prev" | tee -a $LOG_FIL
162     else
163     echo " <-- missing dir $OUT_DIR/prev" | tee -a $LOG_FIL
164     fi
165     else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL
166     fi
167     #-- submit job
168     echo -n "--> $JOB : " | tee -a $LOG_FIL
169     $QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL
170     NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
171     else
172     echo "--> $JOB :" | tee -a $LOG_FIL
173     $QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL
174     echo ' job already exist => skip this test' | tee -a $LOG_FIL
175     fi
176     else
177     echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL
178     fi
179     done
180     echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL
181     echo -n '-- Finished at: ' | tee -a $LOG_FIL
182     date | tee -a $LOG_FIL
183    
184     #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
185     exit 0

  ViewVC Help
Powered by ViewVC 1.1.22