/[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.4 - (hide annotations) (download)
Tue May 10 18:41:31 2022 UTC (4 years, 5 months ago) by jmc
Branch: MAIN
Changes since 1.3: +2 -2 lines
switch DISK from nobackupp2 to nobackupp17

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.4 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/nasa_ames/test_submit_pleiades,v 1.3 2018/11/07 23:10:02 jmc Exp $
4 jmc 1.1 # $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 jmc 1.4 TST_DISK="/nobackupp17/$USER"
25 jmc 1.1 TST_DIR="$TST_DISK/test_${dNam}"
26 jmc 1.2 tmpFil="/tmp/"`basename $0`".$$"
27     #- where local copy of code is (need to be consistent with run-job scripts):
28     srcDIR=$TST_DIR
29     srcCode="MITgcm_today"
30    
31 jmc 1.1 logPfix='test_submit'
32     SUB_DIR="$HERE/nasa_ames"
33     OUT_DIR="$HERE/output"
34     LOG_FIL="$OUT_DIR/$logPfix."`date +%m%d`".log"
35     #SUB_DIR="$HERE/temp"
36    
37     #-- clean up old log files and start a new one:
38     cd $OUT_DIR
39    
40     rm -f $logPfix.*.log_bak
41     if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
42     echo -n '-- Starting: ' | tee -a $LOG_FIL
43     date | tee -a $LOG_FIL
44    
45     n=$(( `ls $logPfix.*.log | wc -l` - 10 ))
46     if test $n -gt 0 ; then
47     echo ' remove old log files:' | tee -a $LOG_FIL
48     ls -lt $logPfix.*.log | tail -"$n" | tee -a $LOG_FIL
49     ls -t $logPfix.*.log | tail -"$n" | xargs rm -f
50     fi
51    
52     #-------------------------------------------------------------
53     # defaults
54     #export PATH="$PATH:/usr/local/bin"
55     if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi
56     #- to get case insensitive "ls" (and order of tested experiments)
57     export LC_ALL="en_US.UTF-8"
58     # Turn off stack limit for FIZHI & AD-tests
59     #ulimit -s unlimited
60    
61     if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi
62     #- load standard modules:
63     #module add fedora slurm maui svante
64     #module add slurm
65     module list >> $LOG_FIL 2>&1
66    
67     #- method to acces CVS:
68     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
69 jmc 1.2 #- and which GitHub repository to use:
70     git_repo='MITgcm'; git_code='MITgcm'
71     #git_repo='altMITgcm'; #git_code='MITgcm66h'
72 jmc 1.1
73     checkOut=1
74 jmc 1.2 addExp=''
75 jmc 1.1 updFile='updated_code'
76    
77 jmc 1.2 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
78     if [ $checkOut -ge 1 ] ; then
79     #-- Download/Update reference version of MITgcm code:
80 jmc 1.1
81 jmc 1.2 if test $srcDIR = $TST_DIR ; then
82     echo "cd $TST_DISK ; pwd (x2)" | tee -a $LOG_FIL
83     cd $TST_DISK | tee -a $LOG_FIL 2>&1
84     pwd | tee -a $LOG_FIL
85     fi
86     if test ! -d $srcDIR ; then
87     echo -n "Creating a working dir: $srcDIR ..." | tee -a $LOG_FIL
88     #/bin/rm -rf $srcDIR
89     mkdir $srcDIR
90     retVal=$?
91     if test "x$retVal" != x0 ; then
92     echo "Error: unable to make dir: $srcDIR (err=$retVal ) --> Exit" | tee -a $LOG_FIL
93     exit 1
94     fi
95     fi
96     cd $srcDIR
97     pwd | tee -a $LOG_FIL
98 jmc 1.1
99 jmc 1.2 #- remove date/lock-file and old copy:
100     if test -f $updFile ; then rm -f $updFile ; sleep 2 ; fi
101     test -e $srcCode && rm -rf $srcCode
102    
103     if [ $checkOut -eq 1 ] ; then
104     if test -e $git_code/.git/config ; then
105     echo -n "Updating current clone ( $git_code ) ..." | tee -a $LOG_FIL
106     echo '' >> $LOG_FIL
107     ( cd $git_code ; git pull ) >> $LOG_FIL 2>&1
108     retVal=$?
109     if test "x$retVal" != x0 ; then echo ''
110     echo "'git pull' on '"`hostname`"' fail (return val=$retVal) => exit" | tee -a $LOG_FIL
111     exit
112     else echo " done" | tee -a $LOG_FIL
113     fi
114 jmc 1.3 echo " and checkout master:" | tee -a $LOG_FIL
115     ( cd $git_code ; git checkout master -- . ) | tee -a $LOG_FIL
116 jmc 1.2 else
117     echo "missing file: $git_code/.git/config => try a new clone" | tee -a $LOG_FIL
118     checkOut=2
119 jmc 1.1 fi
120     fi
121 jmc 1.2 if [ $checkOut -eq 2 ] ; then
122     if test -e $git_code ; then
123     echo -n " removing dir: $git_code ..." | tee -a $LOG_FIL
124     rm -rf $git_code
125     echo " done" | tee -a $LOG_FIL
126 jmc 1.1 fi
127 jmc 1.2 echo -n "Make a clone of $git_code from repo: $git_repo ..." | tee -a $LOG_FIL
128     git clone https://github.com/$git_repo/${git_code}.git 2> $tmpFil
129     retVal=$?
130     if test $retVal = 0 ; then
131     echo ' --> done!' | tee -a $LOG_FIL
132     rm -f $tmpFil
133     else echo '' | tee -a $LOG_FIL
134     echo " Error: 'git clone' returned: $retVal" | tee -a $LOG_FIL
135     cat $tmpFil ; rm -f $tmpFil
136     exit 2
137 jmc 1.1 fi
138 jmc 1.2 fi
139     #---- making a new working copy: MITgcm_today
140     rsync -a $git_code/ $srcCode --exclude '.git'
141     ls -ld $srcCode | tee -a $LOG_FIL
142     if test -d $srcCode/verification ; then
143     for exp2add in $addExp ; do
144     echo " add dir: $exp2add (from Contrib:verification_other)" | tee -a $LOG_FIL
145     ( cd $srcCode/verification ; $cmdCVS co -P -d $exp2add \
146     MITgcm_contrib/verification_other/$exp2add > /dev/null )
147     done
148     fi
149     /usr/bin/find $srcCode -type d | xargs chmod g+rxs
150     /usr/bin/find $srcCode -type f | xargs chmod g+r
151     #- update date/lock-file:
152     if test -d $srcCode/verification ; then
153     echo $today > $updFile ; sleep 2
154     ls -l $updFile | tee -a $LOG_FIL
155     echo '' | tee -a $LOG_FIL
156     fi
157 jmc 1.1
158 jmc 1.2 #-- Done with Download/Update of MITgcm code
159 jmc 1.1 fi
160 jmc 1.2 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
161 jmc 1.1
162 jmc 1.2 #-- leave srcDIR and go back to output dir
163 jmc 1.1 cd $OUT_DIR
164     #-- now really do something:
165    
166     JOB_LIST=$TEST_LIST
167     NB_SUB_JOBS=0
168     for i in $JOB_LIST
169     do
170     case $i in
171     'pgiAdm') sfx='pgi_adm' ;;
172     'pgiMth') sfx='pgi_mth' ;;
173     *) sfx=`echo ${i} | sed 's/MPI$/_mpi/'` ;;
174     esac
175     BATCH_SCRIPT="test_${dNam}_$sfx"
176     if test -f $SUB_DIR/$BATCH_SCRIPT ; then
177     #- job name ( $JOB ) & output-file name ( $JOB.std??? ) must match
178     # definition within $BATCH_SCRIPT slurm script
179     JOB="tst_${i}"
180     job_exist=`$QSTAT | grep $JOB | wc -l`
181     #sJob=`printf "%8.8s" $JOB` #- squeue truncate name to only 1rst 8c
182     #job_exist=`$QLIST | grep $sJob | wc -l`
183     if test "x_$job_exist" = x_0 ; then
184     #-- move previous output file
185     outList=`ls $JOB.std??? 2> /dev/null`
186     if test "x$outList" != x ; then
187     echo -n " moving job $JOB old output files:" | tee -a $LOG_FIL
188     if test -d $OUT_DIR/prev ; then
189     for xx in $outList ; do
190     pp=$OUT_DIR/prev/$xx ; echo -n " $xx" | tee -a $LOG_FIL
191     test -f $pp.sav && mv -f $pp.sav $pp.old
192     test -f $pp && mv -f $pp $pp.sav
193     chmod a+r $xx ; mv -f $xx $OUT_DIR/prev
194     done
195     echo " to dir ./prev" | tee -a $LOG_FIL
196     else
197     echo " <-- missing dir $OUT_DIR/prev" | tee -a $LOG_FIL
198     fi
199     else echo " no old output files from job '$JOB'" | tee -a $LOG_FIL
200     fi
201     #-- submit job
202     echo -n "--> $JOB : " | tee -a $LOG_FIL
203     $QSUB $SUB_DIR/$BATCH_SCRIPT | tee -a $LOG_FIL
204     NB_SUB_JOBS=`expr $NB_SUB_JOBS + 1`
205     else
206     echo "--> $JOB :" | tee -a $LOG_FIL
207     $QSTAT | grep $JOB | tee -a $LOG_FIL
208     #$QLIST | grep $sJob | tee -a $LOG_FIL
209     echo ' job already exist => skip this test' | tee -a $LOG_FIL
210     fi
211     else
212     echo 'no file:' $BATCH_SCRIPT 'to submit' | tee -a $LOG_FIL
213     fi
214     done
215     echo "info-sub-list: NB_SUB_JOBS='$NB_SUB_JOBS'" >> $LOG_FIL
216     echo -n '-- Finished at: ' | tee -a $LOG_FIL
217     date | tee -a $LOG_FIL
218    
219     #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
220     exit 0

  ViewVC Help
Powered by ViewVC 1.1.22