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

Contents of /MITgcm_contrib/test_scripts/svante/test_submit_svante

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


Revision 1.12 - (show annotations) (download)
Sun Feb 19 16:50:34 2017 UTC (8 years, 5 months ago) by jmc
Branch: MAIN
Changes since 1.11: +3 -3 lines
testing on new head-node: add intel compiler (intel-2017.0.1) with openMPI
 test, but still running on sandy nodes, i.e., fdr partition.

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

  ViewVC Help
Powered by ViewVC 1.1.22