/[MITgcm]/MITgcm_contrib/test_scripts/svante/test_comp_svante.sh
ViewVC logotype

Contents of /MITgcm_contrib/test_scripts/svante/test_comp_svante.sh

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


Revision 1.3 - (show annotations) (download) (as text)
Thu Jan 12 17:36:35 2017 UTC (8 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
File MIME type: application/x-sh
FILE REMOVED
rename (again) "test_comp_svante.sh" to "test_comp_ifc.sh"

1 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_comp_svante.sh,v 1.2 2016/01/27 22:45:34 jmc Exp $
4
5 # Test script for MITgcm to run on head-node of svante cluster
6
7 # defaults
8 #export PATH="$PATH:/usr/local/bin"
9 if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi
10 #- to get case insensitive "ls" (and order of tested experiments)
11 export LC_ALL="en_US.UTF-8"
12 # Turn off stack limit for FIZHI & AD-tests
13 ulimit -s unlimited
14
15 if test -f /etc/profile.d/modules.sh ; then
16 . /etc/profile.d/modules.sh
17 fi
18
19 #- load standard modules:
20 module add fedora torque maui svante
21 module list
22
23 #- method to acces CVS:
24 cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
25
26 QSUB="qsub"
27 QSTAT="qstat"
28 dNam=`hostname -s`
29 HERE="$HOME/test_${dNam}"
30
31 SUB_DIR="$HERE/$dNam"
32 OUT_DIR="$HERE/output"
33 TST_DISK="/net/fs09/d0/jm_c"
34 TST_DIR="$TST_DISK/test_${dNam}"
35 #SUB_DIR="$HERE/temp"
36
37 # checkOut=2 : download new code ;
38 # =1 : update code (if no existing code -> swith to 2)
39 # =0 : use existing code (if no existing code -> swith to 2)
40 checkOut=1
41 option=
42
43 dInWeek=`date +%a`
44 TODAY=`date +%d`
45 #tst_list='gads gadm gfo+rs gmpi gmth gmp2+rs ifc pgi'
46 #if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm oad" ; fi
47 tst_list='ifc+rs'
48
49 #option="-nc" ; checkOut=1
50 #option="-q" ; checkOut=0
51
52 cd $TST_DISK ; pwd
53 if test ! -d $TST_DIR ; then
54 echo -n "Creating a working dir: $TST_DIR ..."
55 #/bin/rm -rf $TST_DIR
56 mkdir $TST_DIR
57 retVal=$?
58 if test "x$retVal" != x0 ; then
59 echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit"
60 exit 1
61 fi
62 fi
63 cd $TST_DIR
64
65 #------------------------------------------------------------------------
66
67 #firstTst=`echo $tst_list | awk '{print $1}'`
68 #last_Tst=`echo $tst_list | awk '{print $NF}'`
69 for tt in $tst_list
70 do
71
72 echo "================================================================"
73 newCode=$checkOut
74 typ=`echo $tt | sed 's/+rs//'`
75 gcmDIR="MITgcm_$typ"
76 tst2submit="run_tst_$typ"
77 addExp=''
78 LOG_FIL=$OUT_DIR/output_${typ}
79 #- check day and time:
80 curDay=`date +%d` ; curHour=`date +%H`
81 if [ $curDay -ne $TODAY ] ; then
82 date ; echo "day is over => skip test $typ"
83 continue
84 fi
85 if [ $curHour -ge 18 ] ; then
86 date ; echo "too late to run test $typ"
87 continue
88 fi
89 #- check for unfinished jobs
90 job_exist=`$QSTAT -a | grep $USER | grep $tst2submit | wc -l`
91 if test "x$job_exist" != x0 ; then
92 echo $tst2submit
93 echo "job '$tst2submit' still in queue:"
94 $QSTAT -a | grep $USER | grep $tst2submit
95 echo " => skip this test"
96 continue
97 fi
98 #- clean-up old output files
99 rm -f ${LOG_FIL}*.old $OUT_DIR/$tst2submit.std???.old
100 oldS=`ls $LOG_FIL $OUT_DIR/$tst2submit.std??? 2> /dev/null`
101 for xx in $oldS ; do mv $xx $xx.old ; done
102 #for xx in $oldS ; do
103 # if test -f $xx.sav ; then mv $xx.sav $xx.old ; fi
104 # mv $xx $xx.sav
105 #done
106 if test -d prev ; then
107 #-- save previous summary: tr_out.txt* tst_2+2_out.txt
108 oldS=`( cd ${gcmDIR}/verification ; ls t*_out.txt* ) 2> /dev/null`
109 for xx in $oldS ; do
110 #ss=`/bin/ls -l ${gcmDIR}/verification/$xx | awk '{print $6 $7}'`
111 ss=`/bin/ls -l --time-style=iso ${gcmDIR}/verification/$xx | awk '{print $6}'`
112 yy=`echo $xx | sed -e "s/\.txt.old/.$typ.c/" \
113 -e "s/2_out.txt/2.$typ./" -e "s/\.txt/.$typ.r/"`
114 cp -p ${gcmDIR}/verification/$xx prev/${yy}$ss
115 done
116 fi
117 touch $LOG_FIL
118
119 #- clean and update code
120 if [ $newCode -eq 1 ] ; then
121 if test -d $gcmDIR/CVS ; then
122 echo "cleaning output from $gcmDIR/verification :" | tee -a $LOG_FIL
123 #- remove previous output tar files and tar & remove previous output-dir
124 /bin/rm -f $gcmDIR/verification/??_${dNam}*_????????_?.tar.gz
125 ( cd $gcmDIR/verification
126 listD=`ls -1 -d tr_${dNam}_????????_? ??_${dNam}-${typ}_????????_? 2> /dev/null`
127 for dd in $listD
128 do
129 if test -d $dd ; then
130 tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd
131 retVal=$?
132 if test "x$retVal" != x0 ; then
133 echo "ERROR in tar+gzip prev outp-dir: $dd"
134 echo " on '"`hostname`"' (return val=$retVal) but continue"
135 fi
136 fi
137 done )
138 if test $tt != $typ ; then
139 ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) >> $LOG_FIL 2>&1
140 fi
141 ( cd $gcmDIR/verification ; ./testreport -clean ) >> $LOG_FIL 2>&1
142 echo "cvs update of dir $gcmDIR :" | tee -a $LOG_FIL
143 ( cd $gcmDIR ; $cmdCVS update -P -d ) >> $LOG_FIL 2>&1
144 retVal=$?
145 if test "x$retVal" != x0 ; then
146 echo "cvs update on '"`hostname`"' fail (return val=$retVal) => exit"
147 exit
148 fi
149 else
150 echo "no dir: $gcmDIR/CVS => try a fresh check-out" | tee -a $LOG_FIL
151 newCode=2
152 fi
153 fi
154 #- download new code
155 if [ $newCode -eq 2 ] ; then
156 test -e $gcmDIR && rm -rf $gcmDIR
157 echo -n "Downloading the MITgcm code using: $cmdCVS ..." | tee -a $LOG_FIL
158 $cmdCVS co -P -d $gcmDIR MITgcm > /dev/null
159 echo " done" | tee -a $LOG_FIL
160 for exp2add in $addExp ; do
161 echo " add dir: $exp2add (from Contrib:verification_other)"| tee -a $LOG_FIL
162 ( cd $gcmDIR/verification ; $cmdCVS co -P -d $exp2add \
163 MITgcm_contrib/verification_other/$exp2add > /dev/null 2>&1 )
164 done
165 /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs
166 /usr/bin/find $gcmDIR -type f | xargs chmod g+r
167 fi
168 #---------------------------------------------------
169 #-- set the testreport command:
170 comm="./testreport"
171 # if test $typ = $typ = 'gads' -o $typ = 'gadm' ; then
172 # comm="$comm -adm"
173 # elif test $typ = 'oad' ; then
174 # comm="$comm -oad"
175 # elif test $typ = 'tlm' ; then
176 # comm="$comm -tlm"
177 # elif test $typ = 'gmth' -o $typ = 'gmp2' ; then
178 # export GOMP_STACKSIZE=400m
179 # export OMP_NUM_THREADS=2
180 # comm="$comm -mth"
181 # else
182 # comm="$comm -md cyrus-makedepend"
183 # comm="$comm -t hs94.cs-32x32x5"
184 # fi
185 if test "x$dInWeek" = xSun ; then
186 comm="$comm -fast"
187 #else
188 # comm="$comm -devel"
189 fi
190
191 #-- set the optfile (+ mpi & match-precision)
192 MPI=0 ; MC=13
193 case $typ in
194 'gfo'|'gads'|'oad'|'tlm'|'gmth') comm="$comm -match $MC -devel"
195 OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
196 'ifc') MPI=6; #comm="$comm -devel"
197 OPTFILE='../tools/build_options/linux_amd64_ifort11' ;;
198 'pgi') MPI=6; #comm="$comm -devel"
199 OPTFILE='../tools/build_options/linux_amd64_pgf77' ;;
200 'gadm'|'gmpi'|'gmp2') MPI=6; comm="$comm -match $MC -devel"
201 if test $typ = 'gmp2' ; then MPI=3 ; fi
202 OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
203 *) OPTFILE= ;;
204 esac
205 #-- set MPI command:
206 # if test $MPI != 0 ; then
207 # fi
208
209 #-- set specific Env Vars:
210 #if test $typ = 'oad' ; then
211 # source ~jmc/mitgcm/bin/setenv_OpenAD.sh
212 #fi
213 if test $typ = 'ifc' ; then
214 module add intel
215 module add mvapich2
216 fi
217 #if test $typ = 'pgi' ; then
218 #fi
219
220 #-- run the testreport command:
221 echo -n "Running testreport using" | tee -a $LOG_FIL
222 if test "x$OPTFILE" != x ; then
223 comm="$comm -of=$OPTFILE"
224 fi
225 if test $MPI != 0 ; then comm="$comm -MPI $MPI" ; fi
226 echo " -norun option ('-nr'):" | tee -a $LOG_FIL
227 comm="$comm -nr"
228 if test "x$option" != x ; then comm="$comm $option" ; fi
229 echo " \"eval $comm\"" | tee -a $LOG_FIL
230 echo "======================"
231 ( cd $gcmDIR/verification
232 eval $comm >> $LOG_FIL 2>&1
233 )
234 #sed -n "/^An email /,/^======== End of testreport / p" $LOG_FIL
235 sed -n "/^No results email was sent/,/^======== End of testreport / p" $LOG_FIL
236 echo "" | tee -a $LOG_FIL
237
238 #-- submit PBS script to run
239 if test -e $SUB_DIR/${tst2submit}.pbs ; then
240 echo " submit PBS bach script '$SUB_DIR/${tst2submit}.pbs'" | tee -a $LOG_FIL
241 $QSUB $SUB_DIR/${tst2submit}.pbs | tee -a $LOG_FIL
242 echo " job '$tst2submit' in queue:" | tee -a $LOG_FIL
243 $QSTAT -a | grep $USER | grep $tst2submit | tee -a $LOG_FIL
244 else
245 echo " no PBS script '$SUB_DIR/${tst2submit}.pbs' to submit"| tee -a $LOG_FIL
246 continue
247 fi
248
249 #-- also test restart (test 2+2=4)
250 # if test $tt != $typ ; then
251 # echo "testing restart using:" | tee -a $LOG_FIL
252 # comm="../tools/do_tst_2+2 -o $dNam -a jmc@mitgcm.org"
253 # if test $MPI = 0 ; then
254 # echo " \"$comm\"" | tee -a $LOG_FIL
255 # echo "======================"
256 # $comm >> $LOG_FIL 2>&1
257 # else
258 # echo " \"$comm -mpi\"" | tee -a $LOG_FIL
259 # echo "======================"
260 # $comm -mpi >> $LOG_FIL 2>&1
261 # fi
262 # echo ; cat tst_2+2_out.txt
263 # echo
264 # fi
265 #--reset special setting:
266 export OMP_NUM_THREADS=1
267
268 done

  ViewVC Help
Powered by ViewVC 1.1.22