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

Annotation of /MITgcm_contrib/test_scripts/svante/test_comp_pgiAdm.sh

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


Revision 1.2 - (hide annotations) (download) (as text)
Sat Jan 14 16:20:04 2017 UTC (8 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.1: +9 -8 lines
File MIME type: application/x-sh
fix previous modif

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.2 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/svante/test_comp_pgiAdm.sh,v 1.1 2017/01/13 22:40:45 jmc Exp $
4 jmc 1.1
5     # Test script for MITgcm to run on head-node of svante cluster (svante-login.mit.edu)
6     # to just generate source code (*.f) including TAF output src code.
7    
8     headNode=`hostname -s`
9     #QSUB="qsub"
10 jmc 1.2 #QSTAT="qstat -u $USER"
11 jmc 1.1 #dNam=$headNode
12     QSUB="/usr/bin/sbatch"
13     QSTAT="/usr/bin/squeue -u $USER"
14     dNam='svante'
15     HERE="$HOME/test_${dNam}"
16    
17     SUB_DIR="$HERE/$dNam"
18     OUT_DIR="$HERE/output"
19     TST_DISK="/net/fs09/d0/jm_c"
20     TST_DIR="$TST_DISK/test_${dNam}"
21     #SUB_DIR="$HERE/temp"
22    
23     dInWeek=`date +%a`
24     TODAY=`date +%d`
25    
26     #- main options
27     sfx='pgiAdm'; typ='-adm'
28     addExp=''
29    
30     logPfix="test_comp_$sfx"
31     tst2submit="run_tst_$sfx"
32 jmc 1.2 JOB="t_$sfx"
33 jmc 1.1
34     #-------------------------------
35     # checkOut=2 : download new code ;
36     # =1 : update code (if no existing code -> swith to 2)
37     # =0 : use existing code (if no existing code -> swith to 2)
38     checkOut=1
39     option=
40    
41     #option="-nc" ; checkOut=1
42     #option="-q" ; checkOut=0
43    
44     dAlt=`date +%d` ; dAlt=`expr $dAlt % 3`
45     if [ $dAlt -eq 1 ] ; then options="$options -fast"
46     else options="$options -devel" ; fi
47    
48     #- defaults
49     umask 0022
50     if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi
51     #- to get case insensitive "ls" (and order of tested experiments)
52     export LC_ALL="en_US.UTF-8"
53     # Turn off stack limit for FIZHI & AD-tests
54     ulimit -s unlimited
55    
56     if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi
57     if test -f /etc/profile.d/zz_modules.sh ; then . /etc/profile.d/zz_modules.sh ; fi
58    
59     #- method to acces CVS:
60     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
61    
62     #-- clean up old log files and start a new one:
63     LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
64     cd $OUT_DIR
65    
66     rm -f $logPfix.*.log_bak
67     if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
68     echo -n '-- Starting: ' | tee -a $LOG_FIL
69     date | tee -a $LOG_FIL
70    
71     n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
72     if test $n -gt 0 ; then
73     echo ' remove old log files:' | tee -a $LOG_FIL
74     ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL
75     ls -t $logPfix.*.log | tail -"$n" | xargs rm -f
76     fi
77    
78     #- load standard modules:
79     module add slurm
80    
81     #- load specific modules & set ENV variables:
82     module add pgi/16.9
83     module add openmpi
84     module add netcdf
85     OPTFILE="../tools/build_options/linux_amd64_pgf77"
86     MPI=6
87     #- needed for DIVA with MPI:
88     export MPI_INC_DIR="/home/software/pgi/16.9/linux86-64/2016/mpi/openmpi-1.10.2/include"
89    
90     echo '======= modules =======================================' | tee -a $LOG_FIL
91     module list 2>&1 | tee -a $LOG_FIL
92     echo '=======================================================' | tee -a $LOG_FIL
93    
94     dInWeek=`date +%a`
95     TODAY=`date +%d`
96     #tst_list='gads gadm gfo+rs gmpi gmth gmp2+rs ifc pgi'
97     #if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm oad" ; fi
98     tst_list='pgiAdm'
99    
100     echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL
101     cd $TST_DISK 2>&1 | tee -a $LOG_FIL
102     pwd | tee -a $LOG_FIL
103     if test ! -d $TST_DIR ; then
104     echo -n "Creating a working dir: $TST_DIR ..." | tee -a $LOG_FIL
105     #/bin/rm -rf $TST_DIR
106     mkdir $TST_DIR
107     retVal=$?
108     if test "x$retVal" != x0 ; then
109     echo "Error: unable to make dir: $TST_DIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL
110     exit 1
111     fi
112     fi
113     cd $TST_DIR
114     pwd | tee -a $LOG_FIL
115    
116     #------------------------------------------------------------------------
117    
118     echo "================================================================"
119     gcmDIR="MITgcm_$sfx"
120    
121     #- check day and time:
122     curDay=`date +%d` ; curHour=`date +%H`
123     if [ $curDay -ne $TODAY ] ; then
124     date ; echo "day is over => skip test $sfx" | tee -a $LOG_FIL
125     exit 2
126     fi
127     if [ $curHour -ge 18 ] ; then
128     date ; echo "too late to run test $sfx" | tee -a $LOG_FIL
129     exit 2
130     fi
131     #- check for unfinished jobs
132 jmc 1.2 job_exist=`$QSTAT | grep $JOB | wc -l`
133 jmc 1.1 if test "x$job_exist" != x0 ; then
134     echo $tst2submit | tee -a $LOG_FIL
135 jmc 1.2 echo "job '$JOB' still in queue:" | tee -a $LOG_FIL
136     $QSTAT | grep $JOB | tee -a $LOG_FIL
137 jmc 1.1 echo " => skip this test" | tee -a $LOG_FIL
138     exit 2
139     fi
140     if test -d prev ; then
141     #-- save previous summary: tr_out.txt* tst_2+2_out.txt
142     oldS=`( cd ${gcmDIR}/verification ; ls t*_out.txt* ) 2> /dev/null`
143     for xx in $oldS ; do
144     #ss=`/bin/ls -l ${gcmDIR}/verification/$xx | awk '{print $6 $7}'`
145     ss=`/bin/ls -l --time-style=iso ${gcmDIR}/verification/$xx | awk '{print $6}'`
146     yy=`echo $xx | sed -e "s/\.txt.old/.$sfx.c/" \
147     -e "s/2_out.txt/2.$sfx./" -e "s/\.txt/.$sfx.r/"`
148     cp -p ${gcmDIR}/verification/$xx prev/${yy}$ss
149     done
150     fi
151     # touch $LOG_FIL
152    
153     #- clean and update code
154     if [ $checkOut -eq 1 ] ; then
155     if test -d $gcmDIR/CVS ; then
156     echo "cleaning output from $gcmDIR/verification :" | tee -a $LOG_FIL
157     #- remove previous output tar files and tar & remove previous output-dir
158     /bin/rm -f $gcmDIR/verification/??_${dNam}*_????????_?.tar.gz
159     ( cd $gcmDIR/verification
160     listD=`ls -1 -d tr_${headNode}_????????_? ??_${dNam}-${sfx}_????????_? 2> /dev/null`
161     for dd in $listD
162     do
163     if test -d $dd ; then
164     tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd
165     retVal=$?
166     if test "x$retVal" != x0 ; then
167     echo "ERROR in tar+gzip prev outp-dir: $dd"
168     echo " on '"`hostname`"' (return val=$retVal) but continue"
169     fi
170     fi
171     done )
172     # ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) >> $LOG_FIL 2>&1
173     ( cd $gcmDIR/verification ; ./testreport $typ -clean ) >> $LOG_FIL 2>&1
174     echo "cvs update of dir $gcmDIR :" | tee -a $LOG_FIL
175     ( cd $gcmDIR ; $cmdCVS update -P -d ) >> $LOG_FIL 2>&1
176     retVal=$?
177     if test "x$retVal" != x0 ; then
178     echo "cvs update on '"`hostname`"' fail (return val=$retVal) => exit"
179     exit 3
180     fi
181     else
182     echo "no dir: $gcmDIR/CVS => try a fresh check-out" | tee -a $LOG_FIL
183     checkOut=2
184     fi
185     fi
186     #- download new code
187     if [ $checkOut -eq 2 ] ; then
188     test -e $gcmDIR && rm -rf $gcmDIR
189     echo -n "Downloading the MITgcm code using: $cmdCVS ..." | tee -a $LOG_FIL
190     $cmdCVS co -P -d $gcmDIR MITgcm > /dev/null
191     echo " done" | tee -a $LOG_FIL
192     for exp2add in $addExp ; do
193     echo " add dir: $exp2add (from Contrib:verification_other)"| tee -a $LOG_FIL
194     ( cd $gcmDIR/verification ; $cmdCVS co -P -d $exp2add \
195     MITgcm_contrib/verification_other/$exp2add > /dev/null 2>&1 )
196     done
197     /usr/bin/find $gcmDIR -type d | xargs chmod g+rxs
198     /usr/bin/find $gcmDIR -type f | xargs chmod g+r
199     fi
200     #---------------------------------------------------
201     #-- set the testreport command:
202     comm="./testreport $typ"
203    
204     #-- run the testreport command:
205     echo -n "Running testreport using" | tee -a $LOG_FIL
206     if test $MPI != 0 ; then comm="$comm -MPI $MPI" ; fi
207     if test "x$options" != x ; then comm="$comm $options" ; fi
208     if test "x$OPTFILE" != x ; then
209     comm="$comm -of=$OPTFILE"
210     fi
211 jmc 1.2 echo " option '-src' (only fortran source-files):" | tee -a $LOG_FIL
212 jmc 1.1 comm="$comm -src"
213     echo " \"eval $comm\"" | tee -a $LOG_FIL
214     echo "======================"
215     ( cd $gcmDIR/verification
216     eval $comm >> $LOG_FIL 2>&1
217     )
218     #sed -n "/^An email /,/^======== End of testreport / p" $LOG_FIL
219     sed -n "/^No results email was sent/,/^======== End of testreport / p" $LOG_FIL
220     echo "" | tee -a $LOG_FIL
221    
222     #-- submit SLURM script to run
223     if test -e $SUB_DIR/${tst2submit}.slurm ; then
224     echo " submit SLURM bach script '$SUB_DIR/${tst2submit}.slurm'" | tee -a $LOG_FIL
225     $QSUB $SUB_DIR/${tst2submit}.slurm | tee -a $LOG_FIL
226 jmc 1.2 echo " job '$JOB' in queue:" | tee -a $LOG_FIL
227     $QSTAT | grep $JOB | tee -a $LOG_FIL
228 jmc 1.1 else
229     echo " no SLURM script '$SUB_DIR/${tst2submit}.slurm' to submit" | tee -a $LOG_FIL
230     continue
231     fi
232    

  ViewVC Help
Powered by ViewVC 1.1.22