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

Annotation 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.1 - (hide annotations) (download) (as text)
Sun Nov 8 17:30:45 2015 UTC (9 years, 8 months ago) by jmc
Branch: MAIN
File MIME type: application/x-sh
rename "test_svante.sh" to "test_comp_svante.sh" + fix detail in run_tst_ifc.pbs

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

  ViewVC Help
Powered by ViewVC 1.1.22