/[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.1 - (show annotations) (download)
Sun Nov 8 17:33:13 2015 UTC (9 years, 8 months ago) by jmc
Branch: MAIN
add new PGI test, compiled and run on (new) compute node but using copy of
 MITgcm code that is updated from head node (since I can't ssh to mitgcm.org
 from compute note).

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

  ViewVC Help
Powered by ViewVC 1.1.22