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

Diff of /MITgcm_contrib/test_scripts/svante/test_submit_svante

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

revision 1.2 by jmc, Wed Jan 27 22:45:34 2016 UTC revision 1.19 by jmc, Fri Feb 9 17:22:14 2018 UTC
# Line 8  dInWeek=`date +%a` Line 8  dInWeek=`date +%a`
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'  tmpFil="/tmp/"`basename $0`".$$"
27    #- where local copy of code is (need to be consistent with run-job scripts):
28    #srcDIR=$TST_DIR
29    srcDIR=$HERE
30    srcCode="MITgcm_today"
31    
32    logPfix='test_submit'
33  SUB_DIR="$HERE/$dNam"  SUB_DIR="$HERE/$dNam"
34  OUT_DIR="$HERE/output"  OUT_DIR="$HERE/output"
35  LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"  LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
# Line 51  export LC_ALL="en_US.UTF-8" Line 59  export LC_ALL="en_US.UTF-8"
59  #  Turn off stack limit for FIZHI & AD-tests  #  Turn off stack limit for FIZHI & AD-tests
60  ulimit -s unlimited  ulimit -s unlimited
61    
62  if test -f /etc/profile.d/modules.sh ; then  if test -f /etc/profile.d/modules.sh    ; then . /etc/profile.d/modules.sh    ; fi
63      . /etc/profile.d/modules.sh  if test -f /etc/profile.d/zz_modules.sh ; then . /etc/profile.d/zz_modules.sh ; fi
 fi  
64  #- load standard modules:  #- load standard modules:
65  module add fedora torque maui svante  #module add fedora slurm maui svante
66    module add slurm
67  module list                                             >> $LOG_FIL 2>&1  module list                                             >> $LOG_FIL 2>&1
68    
69  #- method to acces CVS:  #- method to acces CVS:
70  cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'    cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
71    #- and which GitHub repository to use:
72      git_repo='MITgcm';  git_code='MITgcm'
73     #git_repo='altMITgcm'; #git_code='MITgcm66h'
74    
 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  
 #-- Download/Update reference version of MITgcm code:  
75  checkOut=1  checkOut=1
76  gcmDIR='MITgcm'  addExp=''
 exp2add=''  
77  updFile='updated_code'  updFile='updated_code'
78    
79  cd $TST_DISK    | tee -a $LOG_FIL 2>&1  #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
80  pwd             | tee -a $LOG_FIL  #-- Download/Update reference version of MITgcm code:
81  if test ! -d $TST_DIR ; then  if [ $checkOut -ge 1 ] ; then
    echo -n "Creating a working dir: $TST_DIR ..."       | tee -a $LOG_FIL  
   #/bin/rm -rf $TST_DIR  
    mkdir $TST_DIR  
    retVal=$?  
    if test "x$retVal" != x0 ; then  
       echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL  
       exit 1  
    fi  
 fi  
 cd $TST_DIR  
82    
83  #- remove date/lock-file:    if test $srcDIR = $TST_DIR ; then
84  if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi      echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL
85        cd $TST_DISK        | tee -a $LOG_FIL 2>&1
86        pwd                 | tee -a $LOG_FIL
87      fi
88      if test ! -d $srcDIR ; then
89         echo -n "Creating a working dir: $srcDIR ..."      | tee -a $LOG_FIL
90        #/bin/rm -rf $srcDIR
91         mkdir $srcDIR
92         retVal=$?
93         if test "x$retVal" != x0 ; then
94           echo "Error: unable to make dir: $srcDIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL
95           exit 1
96         fi
97      fi
98      cd $srcDIR
99      pwd           | tee -a $LOG_FIL
100    
101  if [ $checkOut -eq 1 ] ; then    #- remove date/lock-file and old copy:
102    if test -d $gcmDIR/CVS ; then    if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi
103      echo -n "Update dir $gcmDIR using '$cmdCVS update -P -d' ..." | tee -a $LOG_FIL    test -e $srcCode && rm -rf $srcCode
104      echo '' >> $LOG_FIL  
105      ( cd $gcmDIR ; $cmdCVS update -P -d )               >> $LOG_FIL 2>&1    if [ $checkOut -eq 1 ] ; then
106      RETVAL=$?      if test -e $git_code/.git/config ; then
107      if test "x$RETVAL" != x0 ; then echo ''        ( cd $git_code ; git checkout master )                    | tee -a $LOG_FIL
108         echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL        echo -n "Updating current clone ( $git_code ) ..."        | tee -a $LOG_FIL
109         exit        echo '' >> $LOG_FIL
110      else echo "  done"                                  | tee -a $LOG_FIL        ( cd $git_code ; git pull )                               >> $LOG_FIL 2>&1
111          retVal=$?
112          if test "x$retVal" != x0 ; then echo ''
113             echo "'git pull' on '"`hostname`"' fail (return val=$retVal) => exit" | tee -a $LOG_FIL
114             exit
115          else echo "  done"                                        | tee -a $LOG_FIL
116          fi
117        else
118          echo "missing file: $git_code/.git/config => try a new clone"     | tee -a $LOG_FIL
119          checkOut=2
120      fi      fi
  else  
     echo "no dir: $gcmDIR/CVS => try a fresh check-out" | tee -a $LOG_FIL  
     checkOut=2  
121    fi    fi
122  fi    if [ $checkOut -eq 2 ] ; then
123  if [ $checkOut -eq 2 ] ; then      echo -n "Make a clone of $git_code from repo: $git_repo ..."        | tee -a $LOG_FIL
124      test -e $gcmDIR && rm -rf $gcmDIR      git clone https://github.com/$git_repo/${git_code}.git 2> $tmpFil
125      echo -n "Downloading using '$cmdCVS co -P -d $gcmDIR MITgcm' ..."   | tee -a $LOG_FIL      retVal=$?
126      $cmdCVS co -P -d $gcmDIR MITgcm > /dev/null      if test $retVal = 0 ; then
127      RETVAL=$?         echo ' --> done!'                                | tee -a $LOG_FIL
128      if test "x$RETVAL" != x0 ; then echo ''             | tee -a $LOG_FIL         rm -f $tmpFil
129        echo "cvs co on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL      else echo ''                                        | tee -a $LOG_FIL
130        exit         echo " Error: 'git clone' returned: $retVal"     | tee -a $LOG_FIL
131      else echo "  done"                                  | tee -a $LOG_FIL         cat $tmpFil ; rm -f $tmpFil
132           exit 2
133      fi      fi
134      if test -d $gcmDIR/verification ; then    fi
135        for exp2add in $addExp ; do    #---- making a new working copy: MITgcm_today
136          echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL    rsync -a $git_code/ $srcCode --exclude '.git'
137          ( cd $gcmDIR/verification ; $cmdCVS co -P -d $exp2add \    ls -ld $srcCode                                       | tee -a $LOG_FIL
138                         MITgcm_contrib/verification_other/$exp2add > /dev/null )    if test -d $srcCode/verification ; then
139        done      for exp2add in $addExp ; do
140      fi        echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL
141      /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs        ( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \
142      /usr/bin/find $gcmDIR -type f | xargs chmod g+r                      MITgcm_contrib/verification_other/$exp2add > /dev/null )
143  fi      done
144      fi
145      /usr/bin/find $srcCode -type d | xargs chmod g+rxs
146      /usr/bin/find $srcCode -type f | xargs chmod g+r
147      #- update date/lock-file:
148      if test -d $srcCode/verification ; then
149        echo $today > $updFile ; sleep 2
150        ls -l $updFile                                      | tee -a $LOG_FIL
151        echo ''                                             | tee -a $LOG_FIL
152      fi
153    
154  #- update date/lock-file:  #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
155  if test -d $gcmDIR/verification ; then  #-- Done with Download/Update of MITgcm code
   echo $today > $updFile ; sleep 2  
   ls -l $updFile                                        | tee -a $LOG_FIL  
156  fi  fi
157    
158  #-- leave TST Dir and go back to output dir  #-- leave srcDIR and go back to output dir
159  cd $OUT_DIR  cd $OUT_DIR
 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  
160  #-- now really do something:  #-- now really do something:
161    
162    JOB_LIST=$TEST_LIST    JOB_LIST=$TEST_LIST
# Line 138  cd $OUT_DIR Line 164  cd $OUT_DIR
164    for i in $JOB_LIST    for i in $JOB_LIST
165    do    do
166      case $i in      case $i in
       'pgiMPI') sfx='pgi_mpi' ;;  
167        'pgiAdm') sfx='pgi_adm' ;;        'pgiAdm') sfx='pgi_adm' ;;
168               *) sfx=${i}'_mpi'  ;;        'pgiMth') sfx='pgi_mth' ;;
169                 *) sfx=`echo ${i} | sed 's/MPI$/_mpi/'`  ;;
170      esac      esac
171      BATCH_SCRIPT="test_svante_$sfx"      BATCH_SCRIPT="test_${dNam}_$sfx"
172      if test -f $SUB_DIR/$BATCH_SCRIPT ; then      if test -f $SUB_DIR/$BATCH_SCRIPT ; then
173        JOB="tst_"$i        #- job name ( $JOB ) & output-file name ( $JOB.std??? ) must match
174        job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l`        #  definition within $BATCH_SCRIPT slurm script
175          JOB="${i}_tst"
176          sJob=`printf "%8.8s" $JOB` #- squeue truncate name to only 1rst 8c
177          #job_exist=`$QSTAT | grep $JOB | wc -l`
178          job_exist=`$QLIST | grep $sJob | wc -l`
179        if test "x_$job_exist" = x_0 ; then        if test "x_$job_exist" = x_0 ; then
180          #-- move previous output file          #-- move previous output file
181          outList=`ls $JOB.std??? 2> /dev/null`          outList=`ls $JOB.std??? 2> /dev/null`
# Line 168  cd $OUT_DIR Line 198  cd $OUT_DIR
198            echo -n "--> $JOB : "                         | tee -a $LOG_FIL            echo -n "--> $JOB : "                         | tee -a $LOG_FIL
199            $QSUB $SUB_DIR/$BATCH_SCRIPT                  | tee -a $LOG_FIL            $QSUB $SUB_DIR/$BATCH_SCRIPT                  | tee -a $LOG_FIL
200            NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`            NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
201              sleep 1
202        else        else
203            echo "--> $JOB :"                             | tee -a $LOG_FIL            echo "--> $JOB :"                             | tee -a $LOG_FIL
204            $QSTAT -a | grep $USER | grep $JOB            | tee -a $LOG_FIL            #$QSTAT | grep $JOB                           | tee -a $LOG_FIL
205              $QLIST | grep $sJob                           | tee -a $LOG_FIL
206            echo ' job already exist => skip this test'   | tee -a $LOG_FIL            echo ' job already exist => skip this test'   | tee -a $LOG_FIL
207        fi        fi
208      else      else

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.22