/[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.11 - (show annotations) (download)
Thu Feb 16 21:39:48 2017 UTC (8 years, 5 months ago) by jmc
Branch: MAIN
Changes since 1.10: +2 -2 lines
try Adjoint MPI test using PGI compiler, all run on compute node
 with access to TAF via (ssh) ProxyCommand.

1 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_submit_svante,v 1.10 2017/01/16 14:20:00 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='pgiMPI pgiAdm'
12 #if test "x$dInWeek" = xSun ; then TEST_LIST="$TEST_LIST iad ifc oad" ; fi
13 else
14 TEST_LIST=$*
15 fi
16
17 headNode=`hostname -s`
18 #QSUB="qsub"
19 #QSTAT="qstat -u $USER"
20 #dNam=$headNode
21 QSUB="/usr/bin/sbatch"
22 #QSTAT="/usr/bin/qstat -u $USER"
23 QLIST="/usr/bin/squeue -u $USER"
24 dNam='svante'
25 HERE="$HOME/test_${dNam}"
26 TST_DISK="/net/fs09/d0/jm_c"
27 TST_DIR="$TST_DISK/test_${dNam}"
28 logPfix='test_submit'
29
30 SUB_DIR="$HERE/$dNam"
31 OUT_DIR="$HERE/output"
32 LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
33 #SUB_DIR="$HERE/temp"
34
35 #-- clean up old log files and start a new one:
36 cd $OUT_DIR
37
38 rm -f $logPfix.*.log_bak
39 if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
40 echo -n '-- Starting: ' | tee -a $LOG_FIL
41 date | tee -a $LOG_FIL
42
43 n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
44 if test $n -gt 0 ; then
45 echo ' remove old log files:' | tee -a $LOG_FIL
46 ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL
47 ls -t $logPfix.*.log | tail -"$n" | xargs rm -f
48 fi
49
50 #-------------------------------------------------------------
51 # defaults
52 #export PATH="$PATH:/usr/local/bin"
53 if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi
54 #- to get case insensitive "ls" (and order of tested experiments)
55 export LC_ALL="en_US.UTF-8"
56 # Turn off stack limit for FIZHI & AD-tests
57 ulimit -s unlimited
58
59 if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi
60 if test -f /etc/profile.d/zz_modules.sh ; then . /etc/profile.d/zz_modules.sh ; fi
61 #- load standard modules:
62 #module add fedora slurm maui svante
63 module add slurm
64 module list >> $LOG_FIL 2>&1
65
66 #- method to acces CVS:
67 cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
68
69 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
70 #-- Download/Update reference version of MITgcm code:
71 checkOut=1
72 gcmDIR='MITgcm'
73 exp2add=''
74 updFile='updated_code'
75
76 echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL
77 cd $TST_DISK | tee -a $LOG_FIL 2>&1
78 pwd | tee -a $LOG_FIL
79 if test ! -d $TST_DIR ; then
80 echo -n "Creating a working dir: $TST_DIR ..." | tee -a $LOG_FIL
81 #/bin/rm -rf $TST_DIR
82 mkdir $TST_DIR
83 retVal=$?
84 if test "x$retVal" != x0 ; then
85 echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL
86 exit 1
87 fi
88 fi
89 cd $TST_DIR
90 pwd | tee -a $LOG_FIL
91
92 #- remove date/lock-file:
93 if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi
94
95 if [ $checkOut -eq 1 ] ; then
96 if test -d $gcmDIR/CVS ; then
97 echo -n "Update dir $gcmDIR using '$cmdCVS update -P -d' ..." | tee -a $LOG_FIL
98 echo '' >> $LOG_FIL
99 ( cd $gcmDIR ; $cmdCVS update -P -d ) >> $LOG_FIL 2>&1
100 RETVAL=$?
101 if test "x$RETVAL" != x0 ; then echo ''
102 echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL
103 exit
104 else echo " done" | tee -a $LOG_FIL
105 fi
106 else
107 echo "no dir: $gcmDIR/CVS => try a fresh check-out" | tee -a $LOG_FIL
108 checkOut=2
109 fi
110 fi
111 if [ $checkOut -eq 2 ] ; then
112 test -e $gcmDIR && rm -rf $gcmDIR
113 echo -n "Downloading using '$cmdCVS co -P -d $gcmDIR MITgcm' ..." | tee -a $LOG_FIL
114 $cmdCVS co -P -d $gcmDIR MITgcm > /dev/null
115 RETVAL=$?
116 if test "x$RETVAL" != x0 ; then echo '' | tee -a $LOG_FIL
117 echo "cvs co on '"`hostname`"' fail (return val=$RETVAL) => exit" | tee -a $LOG_FIL
118 exit
119 else echo " done" | tee -a $LOG_FIL
120 fi
121 if test -d $gcmDIR/verification ; then
122 for exp2add in $addExp ; do
123 echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL
124 ( cd $gcmDIR/verification ; $cmdCVS co -P -d $exp2add \
125 MITgcm_contrib/verification_other/$exp2add > /dev/null )
126 done
127 fi
128 /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs
129 /usr/bin/find $gcmDIR -type f | xargs chmod g+r
130 fi
131
132 #- update date/lock-file:
133 if test -d $gcmDIR/verification ; then
134 echo $today > $updFile ; sleep 2
135 ls -l $updFile | tee -a $LOG_FIL
136 fi
137
138 #-- leave TST Dir and go back to output dir
139 cd $OUT_DIR
140 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
141 #-- now really do something:
142
143 JOB_LIST=$TEST_LIST
144 NB_SUB_JOBS=0
145 for i in $JOB_LIST
146 do
147 case $i in
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