/[MITgcm]/MITgcm_contrib/test_scripts/nasa_ames/test_submit_pleiades
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/nasa_ames/test_submit_pleiades

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


Revision 1.1 - (hide annotations) (download)
Mon Jan 29 19:58:45 2018 UTC (8 years, 9 months ago) by jmc
Branch: MAIN
copy here scripts from "MITgcm/tools/example_scripts/nasa_ames"

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

  ViewVC Help
Powered by ViewVC 1.1.22