/[MITgcm]/MITgcm_contrib/test_scripts/engaging/test_submit_engag
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/engaging/test_submit_engag

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


Revision 1.4 - (hide annotations) (download)
Sat Jul 16 13:47:39 2016 UTC (9 years ago) by jmc
Branch: MAIN
Changes since 1.3: +3 -2 lines
test intel compiler with intel MPI (impi) and -devel

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.4 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_submit_engag,v 1.3 2015/11/07 18:35:41 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 jmc 1.4 TEST_LIST='o64Adm gfoTlm gfoMp2 ifort'
12 jmc 1.1 #if test "x$dInWeek" = xSun ; then TEST_LIST="$TEST_LIST iad ifc oad" ; fi
13     else
14     TEST_LIST=$*
15     fi
16    
17     QSUB="/usr/bin/sbatch"
18     QSTAT="/usr/bin/qstat"
19     dNam='engaging'
20     HERE="$HOME/test_$dNam"
21     TST_DIR="/pool001/jm_c/test_$dNam"
22     logPfix='test_submit'
23    
24     SUB_DIR="$HERE/engaging"
25     OUT_DIR="$HERE/output"
26     LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
27 jmc 1.2 #SUB_DIR="$HERE/temp"
28 jmc 1.1
29     #-- clean up old log files and start a new one:
30     cd $OUT_DIR
31    
32     rm -f $logPfix.*.log_bak
33     if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
34 jmc 1.3 echo -n '-- Starting: ' | tee -a $LOG_FIL
35     date | tee -a $LOG_FIL
36 jmc 1.1
37     n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
38     if test $n -gt 0 ; then
39 jmc 1.3 echo ' remove old log files:' | tee -a $LOG_FIL
40     ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL
41 jmc 1.1 ls -t $logPfix.*.log | tail -"$n" | xargs rm -f
42     fi
43    
44 jmc 1.3 if test -f /etc/profile.d/modules.sh ; then
45     . /etc/profile.d/modules.sh
46     fi
47     module list >> $LOG_FIL 2>&1
48 jmc 1.1
49 jmc 1.2 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
50 jmc 1.1 #-- now really do something:
51    
52     JOB_LIST=$TEST_LIST
53     NB_SUB_JOBS=0
54     for i in $JOB_LIST
55     do
56     case $i in
57     'o64Adm') sfx='op64_adm' ;;
58     'gfoTlm') sfx='gfo_tlm' ;;
59 jmc 1.4 'gfoMp2') sfx='gfo_mp2' ;;
60 jmc 1.1 *) sfx=${i}'_mpi' ;;
61     esac
62     BATCH_SCRIPT="test_engag_$sfx"
63     if test -f $SUB_DIR/$BATCH_SCRIPT ; then
64     JOB="tst_"$i
65     job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l`
66     if test "x_$job_exist" = x_0 ; then
67     #-- move previous output file
68     outList=`ls $JOB.std??? 2> /dev/null`
69     if test "x$outList" != x ; then
70 jmc 1.3 echo -n " moving job $JOB old output files:" | tee -a $LOG_FIL
71 jmc 1.1 if test -d $OUT_DIR/prev ; then
72     for xx in $outList ; do
73 jmc 1.3 pp=$OUT_DIR/prev/$xx ; echo -n " $xx" | tee -a $LOG_FIL
74     test -f $pp.sav && mv -f $pp.sav $pp.old
75     test -f $pp && mv -f $pp $pp.sav
76     chmod a+r $xx ; mv -f $xx $OUT_DIR/prev
77 jmc 1.1 done
78 jmc 1.3 echo " to dir ./prev" | tee -a $LOG_FIL
79 jmc 1.1 else
80 jmc 1.3 echo " <-- missing dir $OUT_DIR/prev" | tee -a $LOG_FIL
81 jmc 1.1 fi
82 jmc 1.2 else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL
83 jmc 1.1 fi
84     #-- submit job
85 jmc 1.3 echo -n "--> $JOB : " | tee -a $LOG_FIL
86     $QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL
87 jmc 1.1 NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
88     else
89 jmc 1.3 echo "--> $JOB :" | tee -a $LOG_FIL
90     $QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL
91     echo ' job already exist => skip this test' | tee -a $LOG_FIL
92 jmc 1.1 fi
93     else
94 jmc 1.3 echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL
95 jmc 1.1 fi
96     done
97 jmc 1.3 echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL
98     echo -n '-- Finished at: ' | tee -a $LOG_FIL
99     date | tee -a $LOG_FIL
100 jmc 1.1
101     #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
102     exit 0

  ViewVC Help
Powered by ViewVC 1.1.22