/[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.6 - (hide annotations) (download)
Wed Jan 4 20:08:11 2017 UTC (8 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.5: +4 -5 lines
minor adjustment

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

  ViewVC Help
Powered by ViewVC 1.1.22